palantir / plottable

:bar_chart: A library of modular chart components built on D3
http://plottablejs.org/
MIT License
2.96k stars 224 forks source link

[Plots.Animator.RESET] When values update, animate from old values, not from baseline #2869

Open cmslewis opened 8 years ago

cmslewis commented 8 years ago

// Similar to https://github.com/palantir/plottable/issues/2859

Say I've rendered a Plottable.Plots.Bar plot using a dataset that I keep around.

var data = [{ x : 1, y : 1 }, { x : 2, y : 2 }, { x : 3, y : 3 }];
var dataset = new Plottable.Dataset(data);
plot = new Plottable.Plots.Bar()
  .addDataset(dataset)
  // other stuff ...
  .animated(true)
  .renderTo('#chart');

The bars animate in, and everything is wonderful. However, when I update some y-values in the dataset:

var newData = [{ x : 1, y : 1 }, { x : 2, y : 3 }, { x : 3, y : 4 }];
dataset.data(newData);

I observe that the chart clears, then the bars animate from the baseline to their new values.

Request: It'd be great if there were some option to animate bars/lines/whatever directly from the old values to the new values, rather than flushing everything and animating up from the baseline.

Priority: This is a ~P2 for me.

jtlan commented 8 years ago

Similar to https://github.com/palantir/plottable/issues/2512.