Home Forums Chart Support Date format problem

Date format problem

Viewing 6 posts - 1 through 6 (of 6 total)
  • #30624

    Hello I have problem with date format on the chart:

    I am fetching csv file where data look like that



    async function getData(){

    var response =await fetch(‘data.csv’);
    var data = await response.text();
    var table = data.split(‘\n’).slice(1);
    table.forEach(row =>{
    var columns = row.split(‘,’);
    var date = new Date(columns[0]);
    var xValue = date;
    var yValue = columns[1];

    x: xValue,
    y: yValue


    And creating chart:

    var chart;
    chart = new CanvasJS.Chart(“chartContainer”,
    title: {
    text: “Chart with Date Selector”
    data: [
    type: “line”,
    dataPoints: xlabels

    What is a problem?



    After looking into your code, it seems you have parsed dataPoints into a variable called dataPoints. But you are assigning a different variable within chart option/data.

    Passing the variable dataPoints within chart options/data should work fine in your case.

    If you are still facing the issue kindly create a sample project reproducing the issue and share it with us along with the sample CSV over Google-Drive or Onedrive so that we can run your code locally, understand your scenario better and help you out.

    Indranil Deo
    Team CanvasJS


    Still same problem :(

    https://we.tl/t-bk3lKJedhG – project is here

    Please help me :(



    Parsing the y-value to float using parseFloat() and rendering the chart inside getData() should work fine in your case. Please take a look at this updated sample project.

    Indranil Deo
    Team CanvasJS


    Thank you It really worked, also problem was that I have been using safari. Thank you very much!!!!



    Glad that you figured it out :)

    Indranil Deo
    Team CanvasJS

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

You must be logged in to reply to this topic.