From 55e671b7950a64c3c1cdb0864481a31feb528e1b Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sun, 31 Mar 2013 14:53:20 -0400 Subject: [PATCH] Fix incorrect default for xaxes/yaxes tickColor. The way in which xaxes/yaxes inherit options from xaxis/yaxis resulted in a minor bug, where tickColor defaulted to the xaxis/yaxis color instead of the color for its axis. Fixed by applying the default before extending the per-axis options, resolving #984. There's still some questionable behavior here; this section should be revisited for 0.9, especially with an eye towards removing some of the code that only exists for backwards-compatibility. --- jquery.flot.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 3719004..ff5d6c8 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -674,8 +674,15 @@ Licensed under the MIT license. axisCount = options.xaxes.length || 1; for (i = 0; i < axisCount; ++i) { - axisOptions = $.extend(true, {}, options.xaxis, options.xaxes[i]); + + axisOptions = options.xaxes[i]; + if (axisOptions && !axisOptions.tickColor) { + axisOptions.tickColor = axisOptions.color; + } + + axisOptions = $.extend(true, {}, options.xaxis, axisOptions); options.xaxes[i] = axisOptions; + if (axisOptions.font) { axisOptions.font = $.extend({}, fontDefaults, axisOptions.font); if (!axisOptions.font.color) { @@ -686,8 +693,15 @@ Licensed under the MIT license. axisCount = options.yaxes.length || 1; for (i = 0; i < axisCount; ++i) { - axisOptions = $.extend(true, {}, options.yaxis, options.yaxes[i]); + + axisOptions = options.yaxes[i]; + if (axisOptions && !axisOptions.tickColor) { + axisOptions.tickColor = axisOptions.color; + } + + axisOptions = $.extend(true, {}, options.yaxis, axisOptions); options.yaxes[i] = axisOptions; + if (axisOptions.font) { axisOptions.font = $.extend({}, fontDefaults, axisOptions.font); if (!axisOptions.font.color) {