You must be logged in to post your query.
Home › Forums › Chart Support › Chart legendText for MySQL data
Tagged: indexlabel, legend, mysql
Good morning,
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']); array_push($data_points, $point);
Can I repeat “company” in legendText somehow? I tried a few things that didn’t work.
Thanks!
Yes, you can customize legend to show any text you want. Use legendText property of dataPoint/dataSeries for the same.
https://canvasjs.com/docs/charts/basics-of-creating-html5-chart/legend/
You must be logged in to reply to this topic. Login/Register