Home › forums › Using CanvasJS › Chart legendText for MySQL data
Tagged: indexlabel, legend, mysql
This topic contains 1 reply, has 2 voices, and was last updated by Sunil Urs 5 years, 1 month ago.
I was wondering since I can’t use an indexLabel as well as a Y label on a Pie chart, could I use an indexLabel with a Legend?
My problem is that while I’m making great strides with CanvasJS and loving every moment of it, I’m not so great with Javascrip or especially JSON. I’m using the code that was mentioned in a previous post for using MySQL data for charting points through JSON encoding.
How can I add legendText to the data points that consists of the “label” attribute in the datapoints?
This is my code from the previous thread.
$point = array("label" => $row['company'] , "y" => $row['ordercount']);
Can I repeat “company” in legendText somehow? I tried a few things that didn’t work.
Yes, you can customize legend to show any text you want. Use legendText property of dataPoint/dataSeries for the same.
You must be logged in to reply to this topic.