Search code examples
anychart

How to combine Anychart Stockchart with non-equidistant data points?


I'm trying to use anychart stockcharts to concurrently draw stock ticks + custom events.

These custom events happen at irregular time-intervals (i.e.: they are non-equidistant). The problem is that Stockcharts automatically spaces these events out evenly along the x-axis, instead of correctly showing the irregular timed nature.

Note that I did manage to get a simple linechart working with the irregular timings, but not a StockChart.

How do I set a StockChart to correctly display non-equidistant data-points, or is this simply not possible with stockcharts?


Solution

  • One needs to change x scale type to 'scatter':

    var chart = anychart.stock();

    // change x scale to to scatter chart.xScale('scatter');

    Here is a sample https://playground.anychart.com/1YPiOtqh