Home forums Using CanvasJS Decimals in y axis

This topic contains 2 replies, has 2 voices, and was last updated by  pthakkar 2 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #6758


    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”
    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
    } ],
    itemclick : function(e) {
    if (typeof(e.dataSeries.visible) === “undefined” || e.dataSeries.visible) {
    e.dataSeries.visible = false;
    else {
    e.dataSeries.visible = true;

    My y axis values range from -3365.6 to +3365.6.


    Sunil Urs


    Sure, I can help you with that. Can you please create a jsfiddle so that I can see what is going wrong. Above code does not contain dataPoints & its hard to make a guess without being able to reproduce the problem.

    Sunil Urs



    Hi Sunil

    I was able to make it work. The data was being fetched from sql and needed to be parsed. So it worked.


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.