I am using line chart to get data from a database and plot the chart(time and some voltage values). However I am not able to display decimal values in the y axis. If the data for y axis does not contain decimal it is plotted properly, however if the value contains decimal the chart is not plotted at all. My code for the chart is as follows:
script type=”text/javascript”>
window.onload = function () {
// dataPoints
var dataPoints1 = [];
var dataPoints2 = [];
var chart = new CanvasJS.Chart(“chartContainer”,{
zoomEnabled: true,
title: {
text: “Temperature vs Time”
},
toolTip: {
shared: true
},
legend: {
verticalAlign: “top”,
horizontalAlign: “center”,
fontSize: 14,
fontWeight: “bold”,
fontFamily: “calibri”,
fontColor: “dimGrey”
},
axisX: {
title: “Time”
},
axisY:{
prefix: ”,
includeZero: false,
valueFormatString: “####.#”,
title: “Temperature”
},
data: [{
// dataSeries1
type: “line”,
xValueType: “dateTime”,
showInLegend: true,
name: “Channel 1”,
dataPoints: dataPoints1
},
{
// dataSeries2
type: “line”,
xValueType: “dateTime”,
showInLegend: true,
name: “Channel 2″ ,
dataPoints: dataPoints2
} ],
legend:{
cursor:”pointer”,
itemclick : function(e) {
if (typeof(e.dataSeries.visible) === “undefined” || e.dataSeries.visible) {
e.dataSeries.visible = false;
}
else {
e.dataSeries.visible = true;
}
chart.render();
}
}
});
My y axis values range from -3365.6 to +3365.6.