Thank you.. :)
You can access all properties of dataPoint/dataSeries including label. Upon any mouse event you get dataSeries and dataPoint inside the parameter e – which is passed to the event handler function. Once you have the handle to dataPoint, you can access all the properties inside dataPoint
ex: e.dataPoint.label
Checkout the documentation below
https://canvasjs.com/docs/charts/basics-of-creating-html5-chart/event-handling/
Thank you… We are glad that you liked the library… :)
Sorry, as of now its not possible to change decimal separator… But we have plans to implement the same in the upcoming version…
Naavin,
CanvasJS requires a minimum of IE9. Older versions are not supported.
Update : IE8- is supported in v1.3 and above.
Sunil Urs,
Team CanvasJS
Rampion,
The issue has been fixed. Please download the latest code from the download page.
Sunil Urs,
Team CanvasJS
Hi Rampion,
Thanks for reporting.. Will look into the issue and get back.
Sunil Urs,
Team CanvasJS
Naveen,
Here is how you can display MySQL data in CanvasJS,
1. Create a PHP service that returns data in JSON format.
2. HTML page that does AJAX request to the server and fetches the data. After getting the data, it renders a Chart.
Below is the sample code
1. PHP Service to return JSON Data
<?php
header('Content-Type: application/json');
$con = mysqli_connect("127.0.0.1","user","password","canvasjssampledb");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to DataBase: " . mysqli_connect_error();
}else
{
$data_points = array();
$result = mysqli_query($con, "SELECT * FROM sales");
while($row = mysqli_fetch_array($result))
{
$point = array("label" => $row['product'] , "y" => $row['total_sales']);
array_push($data_points, $point);
}
echo json_encode($data_points, JSON_NUMERIC_CHECK);
}
mysqli_close($con);
?>
2. HTML Page to Fetch Data and render Chart
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script src="jquery.js"></script>
<script src="canvasjs.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$.getJSON("data.php", function (result) {
var chart = new CanvasJS.Chart("chartContainer", {
data: [
{
dataPoints: result
}
]
});
chart.render();
});
});
</script>
</head>
<body>
<div id="chartContainer" style="width: 800px; height: 380px;"></div>
</body>
</html>
Hi Naveen,
Thanks for your interest in CanvasJS. We’ll get back to you with and example in some time…
Sunil Urs,
Team CanvasJS