Browse Source

Modify to update dimension when redraw - #702

pull/713/merge
Masayuki Tanaka 10 years ago
parent
commit
e7d1776dea
  1. 8
      c3.js
  2. 10
      c3.min.js
  3. 8
      src/core.js

8
c3.js

@ -459,6 +459,10 @@
// update legend and transform each g // update legend and transform each g
if (withLegend && config.legend_show) { if (withLegend && config.legend_show) {
$$.updateLegend($$.mapToIds($$.data.targets), options, transitions); $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
} else if ((!config.axis_rotated && withY) || (config.axis_rotated && withUpdateXDomain)) {
// need to update dimension (e.g. axis.y.tick.values) because y tick values should change
// no need to update axis in it because they will be updated in redraw()
$$.updateDimension(true);
} }
// MEMO: needed for grids calculation // MEMO: needed for grids calculation
@ -788,8 +792,9 @@
}; };
c3_chart_internal_fn.updateDimension = function () { c3_chart_internal_fn.updateDimension = function (withoutAxis) {
var $$ = this; var $$ = this;
if (!withoutAxis) {
if ($$.config.axis_rotated) { if ($$.config.axis_rotated) {
$$.axes.x.call($$.xAxis); $$.axes.x.call($$.xAxis);
$$.axes.subx.call($$.subXAxis); $$.axes.subx.call($$.subXAxis);
@ -797,6 +802,7 @@
$$.axes.y.call($$.yAxis); $$.axes.y.call($$.yAxis);
$$.axes.y2.call($$.y2Axis); $$.axes.y2.call($$.y2Axis);
} }
}
$$.updateSizes(); $$.updateSizes();
$$.updateScales(); $$.updateScales();
$$.updateSvgSize(); $$.updateSvgSize();

10
c3.min.js vendored

File diff suppressed because one or more lines are too long

8
src/core.js

@ -454,6 +454,10 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
// update legend and transform each g // update legend and transform each g
if (withLegend && config.legend_show) { if (withLegend && config.legend_show) {
$$.updateLegend($$.mapToIds($$.data.targets), options, transitions); $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
} else if ((!config.axis_rotated && withY) || (config.axis_rotated && withUpdateXDomain)) {
// need to update dimension (e.g. axis.y.tick.values) because y tick values should change
// no need to update axis in it because they will be updated in redraw()
$$.updateDimension(true);
} }
// MEMO: needed for grids calculation // MEMO: needed for grids calculation
@ -783,8 +787,9 @@ c3_chart_internal_fn.updateSvgSize = function () {
}; };
c3_chart_internal_fn.updateDimension = function () { c3_chart_internal_fn.updateDimension = function (withoutAxis) {
var $$ = this; var $$ = this;
if (!withoutAxis) {
if ($$.config.axis_rotated) { if ($$.config.axis_rotated) {
$$.axes.x.call($$.xAxis); $$.axes.x.call($$.xAxis);
$$.axes.subx.call($$.subXAxis); $$.axes.subx.call($$.subXAxis);
@ -792,6 +797,7 @@ c3_chart_internal_fn.updateDimension = function () {
$$.axes.y.call($$.yAxis); $$.axes.y.call($$.yAxis);
$$.axes.y2.call($$.y2Axis); $$.axes.y2.call($$.y2Axis);
} }
}
$$.updateSizes(); $$.updateSizes();
$$.updateScales(); $$.updateScales();
$$.updateSvgSize(); $$.updateSvgSize();

Loading…
Cancel
Save