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

  • Home
  • SEARCH
  • 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 9253217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:09:44+00:00 2026-06-18T11:09:44+00:00

I would like to display a chart from a CSV data with two different

  • 0

I would like to display a chart from a CSV data with two different axis.

I succeed to do this, but with some limitations.

Here is a sample of my CSV file, but the number of columns can vary and also the column labels:

"date","Tch","HyR","CO2"
2012/12/23-10:41,22.2,43,2379.52
2012/12/23-10:42,22.2,44,2319.36
2012/12/23-10:43,22.2,44,2319.36

I can display it using this code:

<div id="div_g" style="width:900px; height:400px; border: 1px solid black"></div> 
<script type="text/javascript" src="http://www.dygraphs.com/dygraph-combined.js"></script>

<script> 

        var g = new Dygraph(
        document.getElementById("div_g"),
        "enregistrement-subset0.csv",
        {
            labels:["date","Tch","HyR","CO2"], //the line I'd like to remove
            colors:["red", "blue", "green"],
            "CO2": { axis: {
                yAxisLabelFormatter: function (v) { return v.toPrecision(2); },
                yValueFormatter: function (v) { return v.toPrecision(2); }
            }},
            axes: {
                y: {
                    valueFormatter: function(y) {
                        return y.toPrecision(3);
                    },
                    axisLabelFormatter: function(y) {
                        return y;
                    }
                }
            },
        });
</script>

I tried to remove the “labels:” line, but doing this, the second axis disappears.

The jsFiddle for this is here http://jsfiddle.net/lauhub/jY2m6/

Also, keeping this line makes warning being generated while displaying the chart.

I also would like to dynamically load labels from the CSV file, since the number of columns and names can vary.

Is it possible to do this programmatically with dygraphs ? How ?

Thanks

  • 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-06-18T11:09:46+00:00Added an answer on June 18, 2026 at 11:09 am

    Here is an answer posted by Konigsberg from Dygraphs google group:
    The simple answer is that your CSV doesn’t think column 0 is labeled [date], it thinks it’s labeled [“date”] (with the quotes.)

    Remove the quotes around the CSV and you’ll be fine:

    date,Tch,HyR,CO2
    2012/12/23-10:41,22.2,43,2379.52
    

    See http://jsfiddle.net/KUdsY/2 for this in action.

    Also, I recommend using the new way to specify axes and series using the procedure specified in http://blog.dygraphs.com/2012/12/the-new-and-better-way-to-specify.html, which makes your solution look like http://jsfiddle.net/KUdsY/4/.

    And I post the code below (copied from the last link):

    var csv = 'date,Tch,HyR,CO2\n' +
        '2012/12/23-10:41,22.2,43,2379.52\n' +
        '2012/12/23-10:42,22.2,44,2319.36\n' +
        '2012/12/23-10:43,22.2,44,2319.36\n';
    var g = new Dygraph(
    document.getElementById("graph"),
    csv, {
      //  labels: ["date", "Tch", "HyR", "CO2"], //the line I'd like to remove
        colors: ["red", "blue", "green"],
        series : {
            "CO2": {
                axis : 'y2'
            }
        },
        axes: {
            y: {
                valueFormatter: function (y) {
                    return y.toPrecision(3);
                },
                axisLabelFormatter: function (y) {
                    return y;
                }
            },
            y2: {
                yAxisLabelFormatter: function (v) {
                    return v.toPrecision(2);
                },
                yValueFormatter: function (v) {
                    return v.toPrecision(2);
                }
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to display other we pages in my mobile webapp, but some
I would like to display the image of two real valued analytic functions f,g
I would like to put data from table into highcharts piechart. The table will
I would like to display in a MFC application, frames that I capture from
On my website I would like to compare two companies with an image-chart/-graph. Each
I'm working on a Web app to display some analytics data from a MYSQL
I'm using HighCharts, and I would like to remove the tooltip from the chart.
I want to display all session data but have some control over it. the
I would like to display a gallery of photos and how many times each
I would like to display a loading bar before the entire page is loaded.

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.