added .xTickFormat() and .yTickFormat() API methods to make chart axis public I/F as capable as that of lineWithFocus.js - from which this code was ripped and then adjusted to compensate for the slightly different way the 2nd x and y axis are named internally.

This commit is contained in:
Ger Hobbelt 2012-07-28 00:22:43 +02:00
parent c856a295e4
commit ef3a7aefb0
3 changed files with 37 additions and 3 deletions

View File

@ -3741,6 +3741,23 @@ nv.models.lineWithFocusChart = function() {
}; };
// Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
chart.xTickFormat = function(_) {
if (!arguments.length) return xAxis.tickFormat();
xAxis.tickFormat(_);
x2Axis.tickFormat(_);
return chart;
};
chart.yTickFormat = function(_) {
if (!arguments.length) return yAxis.tickFormat();
yAxis.tickFormat(_);
y2Axis.tickFormat(_);
return chart;
};
return chart; return chart;
} }

6
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -332,5 +332,22 @@ nv.models.lineWithFocusChart = function() {
}; };
// Chart has multiple similar Axes, to prevent code duplication, probably need to link all axis functions manually like below
chart.xTickFormat = function(_) {
if (!arguments.length) return xAxis.tickFormat();
xAxis.tickFormat(_);
x2Axis.tickFormat(_);
return chart;
};
chart.yTickFormat = function(_) {
if (!arguments.length) return yAxis.tickFormat();
yAxis.tickFormat(_);
y2Axis.tickFormat(_);
return chart;
};
return chart; return chart;
} }