Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6328563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:28:49+00:00 2026-05-24T17:28:49+00:00

I am trying to create a highchart line graph using data from a .csv

  • 0

I am trying to create a highchart line graph using data from a .csv file. But my webpage is just showing the titles of x and y axis, but no data. The code is as follows:

$(document).ready(function() {
    var c = [];
    var d = [];

$.get('data.csv', function(data) {                  
    alert("data in the file: " + data);
    var lines = data.split('\n');   
    $.each(lines, function(lineNo, line) {
        var items = line.split(',');
        c.push(items[0]);       
        d.push(parseInt(items[1])); 
    });
});

var options = {
        chart: {
            renderTo: 'chart',
            defaultSeriesType: 'line'
        },
        title: {
            text: 'Weight Monitor'
        },
        xAxis: {
            title: {
                text: 'Date Measured'
            },
            categories: c
        },
        yAxis: {
            title: {
                text: 'Weight (in Lbs)'
            }
        },
        series: [{
            data: d
        }]
};
var chart = new Highcharts.Chart(options);
    });

i tried to print the data read from file on screen just to check if the file was read properly and i got the proper data, but still my graph is not showing anything.

following is the data in my csv file:

    2011-08-01 00:00:00,155
    2011-08-02 00:00:00,156
    2011-08-03 00:00:00,157
    2011-08-03 00:00:00,160

where left value is date to be shown in x axis and right value is reading points for graph.

any help will be thankful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:28:50+00:00Added an answer on May 24, 2026 at 5:28 pm

    Your code works perfect.

    <script type="text/javascript">
    
        $(document).ready(function() {
    
            var c = [];
            var d = [];
    
            $.get('data.csv', function(data) {
                var lines = data.split('\n');
                $.each(lines, function(lineNo, line) {
                    var items = line.split(',');
                    c.push(items[0]);
                    d.push(parseInt(items[1]));
                });
            });
    
            var options = {
                    chart: {
                        renderTo: 'chart',
                        defaultSeriesType: 'line'
                    },
                    title: {
                        text: 'reading'
                    },
                    xAxis: {
                        title: {
                            text: 'Date Measurement'
                        },
                        categories: c
                    },
                    yAxis: {
                        title: {
                            text: 'reading'
                        }
                    },
                    series: [{
                        data: d
                    }]
            };
    
            var chart = new Highcharts.Chart(options);
    
        });
    
    
    </script>   
    

    Copy this whole code and save it as .html file in a directory and create the data.csv file in the same directory and make sure that there no empty lines, no spaces where they are not needed and no line-break at the end.

    And then open the .html file, the chart should show up with the right data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying create a data.frame from which to create a graph. I have
I'm trying create a new file with a Java Applet, but I don't know
I'm trying to create a visualized chart using Jquery Highcharts plug-in. But I'm unable
I am trying create alert dailog using glade,but its not working .am i doing
I'm trying create an immutable object and initialise it from xml config file in
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
Trying to create a user account in a test. But getting a Object reference
Trying to create several layers of folders at once C:\pie\applepie\recipies\ without using several different
Trying to create a list to return some JSON data to a view. Following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.