From 8d38774cac65d1fe80534cb99a6a505eb85d29d0 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Thu, 4 Jul 2013 23:32:55 -0400 Subject: [PATCH] Added axis.tickFont as an override for axis.font. --- API.md | 1 + jquery.flot.js | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/API.md b/API.md index 6123ca3..42c638a 100644 --- a/API.md +++ b/API.md @@ -268,6 +268,7 @@ xaxis, yaxis: { tickWidth: null or number tickHeight: null or number + tickFont: null or font spec object alignTicksWithAxis: null or number reserveSpace: null or true diff --git a/jquery.flot.js b/jquery.flot.js index d8c1c12..3764c16 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -736,11 +736,12 @@ Licensed under the MIT license. axisOptions = $.extend(true, {}, options.xaxis, axisOptions); options.xaxes[i] = axisOptions; + fontDefaults.color = axisOptions.color; if (axisOptions.font) { axisOptions.font = $.extend({}, fontDefaults, axisOptions.font); - if (!axisOptions.font.color) { - axisOptions.font.color = axisOptions.color; - } + } + if (axisOptions.tickFont || axisOptions.font) { + axisOptions.tickFont = $.extend({}, axisOptions.font || fontDefaults, axisOptions.tickFont); } } @@ -755,11 +756,12 @@ Licensed under the MIT license. axisOptions = $.extend(true, {}, options.yaxis, axisOptions); options.yaxes[i] = axisOptions; + fontDefaults.color = axisOptions.color; if (axisOptions.font) { axisOptions.font = $.extend({}, fontDefaults, axisOptions.font); - if (!axisOptions.font.color) { - axisOptions.font.color = axisOptions.color; - } + } + if (axisOptions.tickFont || axisOptions.font) { + axisOptions.tickFont = $.extend({}, axisOptions.font || fontDefaults, axisOptions.tickFont); } } @@ -1376,7 +1378,7 @@ Licensed under the MIT license. maxWidth = tickWidth || axis.direction === "x" ? Math.floor(surface.width / (ticks.length || 1)) : null, legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis", layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles, - font = opts.font || "flot-tick-label tickLabel"; + font = opts.tickFont || "flot-tick-label tickLabel"; for (var i = 0; i < ticks.length; ++i) { @@ -2167,7 +2169,7 @@ Licensed under the MIT license. var box = axis.box, legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis", layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles, - font = axis.options.font || "flot-tick-label tickLabel", + font = axis.options.tickFont || "flot-tick-label tickLabel", tick, x, y, halign, valign; surface.removeText(layer);