Search code examples
csvhighchartsline

Highcharts: How to show only one data »category« from CSV as a line


My CSV file has three columns:

Date,      Values1,  Values2
1880.0417, -183.0,   24.2 
1880.1250, -171.1,   24.2 
1880.2083, -164.3,   24.2 

of which I want to display only the second one (Values1) as a line (chart).

I could prepare a CSV via Excel with only that and the date column. But due to ongoing work with the file, it would be much easier to get that CSV parsed while ignoring the second value.

Is that possible? I tried it with using the »series« parameter - but in vain.

Thanks a lot for any hints!


Solution

  • You can use seriesMapping property:

    data: {
        ...,
        seriesMapping: [{
            x: 0,
            y: 1
        }, {}]
    }
    

    Live demo: https://jsfiddle.net/BlackLabel/tyLahrow/

    API Reference: https://api.highcharts.com/gantt/data.seriesMapping