indexLabelBackgroundColor: String

Sets the Background color of Index Labels. The value of indexLabelBackgroundColor can be a “HTML Color Name” or “hex” code.


Default: null
Example: “red”, “#FAC003” ..

Notes
  • Supported in all Chart Types.


var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 data: [{
  dataPoints: [
   { x: 10, y: 10,  indexLabel: "label1", indexLabelBackgroundColor: "lightblue" },

   ],
  },

 ]
 .
 .
});
chart.render();


Try it Yourself by Editing the Code below.



If you have any questions, please feel free to ask in our forums.Ask Question

Comments 2

  1. Adding this property in my code throws this error:

    Uncaught TypeError: this.ctx.roundRect is not a functionG.render @ jquery.canvasjs.min.js:273
    w.renderIndexLabels @ jquery.canvasjs.min.js:133
    w.render @ jquery.canvasjs.min.js:88A
    a.Chart.render @ jquery.canvasjs.min.js:412

    It happens in both jquery and non-jquery version of canvasjs 1.7. All other indexLabel properties work, except this one. The errors is thrown at both dataPoint and dataSeries level. Can someone please assist?

    • I guess i was able to resolve this myself. I debugged the non-minified source code and added this at line #2493 –

      “extendCtx(indexLabelCanvasCtx);”

      what this does is basically, add the “roundRect” function to the canvas context. And the background color started working for me.

If you have any questions, please feel free to ask in our forums. Ask Question