Browse Source

Fix padding when scatter chart - #457

pull/529/head
Masayuki Tanaka 10 years ago
parent
commit
140cf726c5
  1. 15
      c3.js
  2. 8
      c3.min.js
  3. 4
      src/config.js
  4. 11
      src/data.js

15
c3.js

@ -945,8 +945,8 @@
axis_x_tick_values: null, axis_x_tick_values: null,
axis_x_tick_rotate: undefined, axis_x_tick_rotate: undefined,
axis_x_tick_outer: true, axis_x_tick_outer: true,
axis_x_max: null, axis_x_max: undefined,
axis_x_min: null, axis_x_min: undefined,
axis_x_padding: {}, axis_x_padding: {},
axis_x_height: undefined, axis_x_height: undefined,
axis_x_default: undefined, axis_x_default: undefined,
@ -1471,12 +1471,11 @@
return maxTarget; return maxTarget;
}; };
c3_chart_internal_fn.getEdgeX = function (targets) { c3_chart_internal_fn.getEdgeX = function (targets) {
var target = this.getMaxDataCountTarget(targets), firstData, lastData; var $$ = this;
if (!target) { return !targets.length ? [0, 0] : [
return [0, 0]; $$.d3.min(targets, function (t) { return t.values[0].x; }),
} $$.d3.max(targets, function (t) { return t.values[t.values.length - 1].x; })
firstData = target.values[0], lastData = target.values[target.values.length - 1]; ];
return [firstData.x, lastData.x];
}; };
c3_chart_internal_fn.mapToIds = function (targets) { c3_chart_internal_fn.mapToIds = function (targets) {
return targets.map(function (d) { return d.id; }); return targets.map(function (d) { return d.id; });

8
c3.min.js vendored

File diff suppressed because one or more lines are too long

4
src/config.js

@ -87,8 +87,8 @@ c3_chart_internal_fn.getDefaultConfig = function () {
axis_x_tick_values: null, axis_x_tick_values: null,
axis_x_tick_rotate: undefined, axis_x_tick_rotate: undefined,
axis_x_tick_outer: true, axis_x_tick_outer: true,
axis_x_max: null, axis_x_max: undefined,
axis_x_min: null, axis_x_min: undefined,
axis_x_padding: {}, axis_x_padding: {},
axis_x_height: undefined, axis_x_height: undefined,
axis_x_default: undefined, axis_x_default: undefined,

11
src/data.js

@ -123,12 +123,11 @@ c3_chart_internal_fn.getMaxDataCountTarget = function (targets) {
return maxTarget; return maxTarget;
}; };
c3_chart_internal_fn.getEdgeX = function (targets) { c3_chart_internal_fn.getEdgeX = function (targets) {
var target = this.getMaxDataCountTarget(targets), firstData, lastData; var $$ = this;
if (!target) { return !targets.length ? [0, 0] : [
return [0, 0]; $$.d3.min(targets, function (t) { return t.values[0].x; }),
} $$.d3.max(targets, function (t) { return t.values[t.values.length - 1].x; })
firstData = target.values[0], lastData = target.values[target.values.length - 1]; ];
return [firstData.x, lastData.x];
}; };
c3_chart_internal_fn.mapToIds = function (targets) { c3_chart_internal_fn.mapToIds = function (targets) {
return targets.map(function (d) { return d.id; }); return targets.map(function (d) { return d.id; });

Loading…
Cancel
Save