Home Forums Chart Support Decimals in y axis

Decimals in y axis

Viewing 3 posts - 1 through 3 (of 3 total)
  • #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”
    },
    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.

    #6759

    pthakkar,

    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

    #6764

    Hi Sunil

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

    Thanks

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

You must be logged in to reply to this topic.