Sets the Background color of Index Labels. The value of indexLabelBackgroundColor can be a “HTML Color Name” or “hex” code.
Default: nullvar chart = new CanvasJS.Chart("container", { . . data: [{ dataPoints: [ { x: 10, y: 10, indexLabel: "label1", indexLabelBackgroundColor: "lightblue" }, ], }, ] . . }); chart.render();
Also See:
2 Comments
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.