How to plot only increments in AMCharts 5?

33 views Asked by At

How can I plot a column series with values as increments/change from the previous data? For ex. [1,3,8,11,20] to be plotted as [0,2,5,3,9].

I followed the steps mentioned in documentation about display fields based on calculated values and made the changes.

var yAxis = this.state.chart.yAxes.push(am5xy.ValueAxis.new(root, {
  calculateTotals: true,
  renderer: am5xy.AxisRendererY.new(root, {}),
  
}));

and

series = chart.series.push(am5xy.ColumnSeries.new(root, {
  name: "Series",
  xAxis: xAxis,
  yAxis: yAxis,
  valueYField:"field1",
  valueYShow: "valueYChangePrevious",
  valueXField: "date",
  tooltip: am5.Tooltip.new(root, {
    labelText: "{valueY}"
  })
}));

The chart works perfectly without valueYShow, but adding any values mentioned in the documentation is just giving a blank chart.

0

There are 0 answers