Home Forums Chart Support How to change empty bar with text on chart ?

How to change empty bar with text on chart ?

Viewing 2 posts - 1 through 2 (of 2 total)
  • #38820

    How to change empty bar with text on chart ?

    https://i.stack.imgur.com/i2J9Y.png

    #38828

    @harisul_ishbah,

    You can add custom strings like “EMPTY” on all the datapoints where y-values are 0 using indexLabel property on the datapoint level as shown in the code-snippet below,

    for(var i = 0; i < chart.options.data[0].dataPoints.length; i++) {
      	if(chart.options.data[0].dataPoints[i].y === 0) {
        	 chart.options.data[0].dataPoints[i].indexLabel = "EMPTY"
    }

    Kindly take a look at this JSFiddle for an example on your requirement.

    chart with index labels on data points where y values are 0


    Adithya Menon
    Team CanvasJS

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

You must be logged in to reply to this topic.