Home Forums StockChart Support StockChart Price Displays

StockChart Price Displays

Viewing 6 posts - 1 through 6 (of 6 total)
  • #59980

    Is it possible to show the OHLC values dynamically in the legend, rather than attached to the crosshairs as you hover over the chart?

    #59984

    Adam Evans,

    Updating legendText on hovering over the datapoint should work fine as per your requirements. Please find the code-snippet below.

    mouseover: onMouseover(e){	
        e.dataSeries.legendText = (e.dataSeries.dataPoints[e.dataPointIndex].x + ": " + e.dataSeries.dataPoints[e.dataPointIndex].y).toString();
        e.chart.render();
    }

    Please take a look at this JSFiddle for an example of the same.


    Vishwas R
    Team CanvasJS

    #60013

    Wonderful. Thanks for the quick response! Have a great day.

    #60543

    Is there an alternative to mouseOver so that the OHLC data updates in the legendText when I simply move along the X axis? I don’t to be able to view the data without having to hover over the OHLC bars directly. The price data should update when I move along each day. I tried mouseMove, but that did not work. Thank you.

    #60556

    Adam Evans,

    To achieve this, you can make use of the updated event to track the current x and y-values, and display those values dynamically in the legend. By utilizing shared tooltip, the values from different chart series can be synchronized and displayed consistently in the legend. Please take a look at this JSFiddle for an example of the same.

    Dynamically Show X & Y Values in Legend


    Vishwas R
    Team CanvasJS

    #60558

    This works. Thank you!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.