Commit dcb656d3 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix axis.x.tick.fit/count logic - #156

parent ffe5202d
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
__axis_x_tick_culling = getConfig(['axis', 'x', 'tick', 'culling'], {}), __axis_x_tick_culling = getConfig(['axis', 'x', 'tick', 'culling'], {}),
__axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], 10), __axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], 10),
__axis_x_tick_count = getConfig(['axis', 'x', 'tick', 'count']), __axis_x_tick_count = getConfig(['axis', 'x', 'tick', 'count']),
__axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], false), __axis_x_tick_fit = getConfig(['axis', 'x', 'tick', 'fit'], true),
__axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], null), __axis_x_tick_values = getConfig(['axis', 'x', 'tick', 'values'], null),
__axis_x_max = getConfig(['axis', 'x', 'max']), __axis_x_max = getConfig(['axis', 'x', 'max']),
__axis_x_min = getConfig(['axis', 'x', 'min']), __axis_x_min = getConfig(['axis', 'x', 'min']),
...@@ -1553,7 +1553,7 @@ ...@@ -1553,7 +1553,7 @@
} }
function generateTickValues(xs) { function generateTickValues(xs) {
var tickValues = xs, targetCount, start, end, count, interval, i, tickValue; var tickValues = xs, targetCount, start, end, count, interval, i, tickValue;
if (!__axis_x_tick_fit && __axis_x_tick_count) { if (__axis_x_tick_count) {
// TODO: need some arguments for __axis_x_tick_count()? // TODO: need some arguments for __axis_x_tick_count()?
targetCount = typeof __axis_x_tick_count === 'function' ? __axis_x_tick_count() : __axis_x_tick_count; targetCount = typeof __axis_x_tick_count === 'function' ? __axis_x_tick_count() : __axis_x_tick_count;
// compute ticks according to __axis_x_tick_count // compute ticks according to __axis_x_tick_count
...@@ -3056,8 +3056,8 @@ ...@@ -3056,8 +3056,8 @@
y.domain(getYDomain(targetsToShow, 'y')); y.domain(getYDomain(targetsToShow, 'y'));
y2.domain(getYDomain(targetsToShow, 'y2')); y2.domain(getYDomain(targetsToShow, 'y2'));
// update axis tick values according to options, except for scatter plot // update axis tick values according to options
if (! hasScatterType(targetsToShow)) { // TODO: fix this if (__axis_x_tick_fit || __axis_x_tick_count) {
tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow)); tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow));
xAxis.tickValues(tickValues); xAxis.tickValues(tickValues);
subXAxis.tickValues(tickValues); subXAxis.tickValues(tickValues);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
}, },
axis: { axis: {
x: { x: {
label: 'Sepal.Width' label: 'Sepal.Width',
tick: {
fit: false
}
}, },
y: { y: {
label: 'Petal.Width' label: 'Petal.Width'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment