Search code examples
amchartsamcharts5

Amcharts5 grouping strategy


I'm using Amcharts 5 with angular, XYChart with LineSeries with DateAxis on x axis. i have activated data grouping by setting groupData: true. The default amcharts5 grouping strategy is "Last" , this means it take the last data for grouping. I want to change this to "High" to take the max value of data when grouping.

How I can do it please ?

I have tryed to use groupDataCallback call back instead , but not working as expected. when i zooming at the max level the point still grouped , causing the points apearing and desapearing each time add point to graph

thank you


Solution

  • You can use LineSeries setting valueYGrouped to set which aggregate value to use. In your case, it's "high", e.g.:

    var series = chart.series.push(
      am5xy.LineSeries.new(root, {
        valueXField: "date",
        valueYField: "value",
        valueYGrouped: "high"
      })
    );
    

    All possible values are "open", "close", "low", "high", "average", "sum", "extreme".

    For more information about this, visit official DateAxis tutorial.