Browse Source

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

pull/183/head
Masayuki Tanaka 11 years ago
parent
commit
dcb656d3b9
  1. 8
      c3.js
  2. 4
      c3.min.js
  3. 5
      htdocs/samples/scatter.html

8
c3.js

@ -174,7 +174,7 @@
__axis_x_tick_culling = getConfig(['axis', 'x', 'tick', 'culling'], {}),
__axis_x_tick_culling_max = getConfig(['axis', 'x', 'tick', 'culling', 'max'], 10),
__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_max = getConfig(['axis', 'x', 'max']),
__axis_x_min = getConfig(['axis', 'x', 'min']),
@ -1553,7 +1553,7 @@
}
function generateTickValues(xs) {
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()?
targetCount = typeof __axis_x_tick_count === 'function' ? __axis_x_tick_count() : __axis_x_tick_count;
// compute ticks according to __axis_x_tick_count
@ -3056,8 +3056,8 @@
y.domain(getYDomain(targetsToShow, 'y'));
y2.domain(getYDomain(targetsToShow, 'y2'));
// update axis tick values according to options, except for scatter plot
if (! hasScatterType(targetsToShow)) { // TODO: fix this
// update axis tick values according to options
if (__axis_x_tick_fit || __axis_x_tick_count) {
tickValues = __axis_x_tick_values ? __axis_x_tick_values : generateTickValues(mapTargetsToUniqueXs(targetsToShow));
xAxis.tickValues(tickValues);
subXAxis.tickValues(tickValues);

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

5
htdocs/samples/scatter.html

@ -27,7 +27,10 @@
},
axis: {
x: {
label: 'Sepal.Width'
label: 'Sepal.Width',
tick: {
fit: false
}
},
y: {
label: 'Petal.Width'

Loading…
Cancel
Save