0

I have a dataset with the date indicated in the style of »2020/01/01«. Now, my Fiddle displays the corresponding data correctly considering the time/year (the right part climbs very steeply):

enter image description here

Pretty much the same code in the original PHP version however does not display it the correct way:

enter image description here

The code is really almost the same:

$.get('graph_global_ch4_concentration_800000.csv', function(data)
{
    var chart = new Highcharts.Chart(
    {
        chart: 
        {
            renderTo: "div_graph_ch4",
            type: "spline"
        },
        xAxis: 
        {
            tickWidth: 0,
            tickInterval: 100000
            },
        data: 
        {
            csv: data  
        },
    });

});

Why is it that the fiddle does it the right way, and my PHP file not?

Thanks for any hints!

luftikus143
  • 1,285
  • 3
  • 27
  • 52
  • 1. Notice that you got a Highcharts error #15 in the console - https://jsfiddle.net/BlackLabel/07eqcx2g/ 2. Are you sure that data in the fiddle and your csv data are the same? - you can check how your data looks like in this way: https://jsfiddle.net/BlackLabel/wtbj7k5m/ – Sebastian Wędzel Mar 03 '20 at 13:02
  • Really the same data (I added above the link to [the original version](https://graphs-test.unepgrid.ch/graph_global_ch4_concentration_800000_test.php). But interestingly, the console log shows there {0,1,2,3...} for the x-values, while in the fiddle it shows {-800000,-797556,...} as it should be. Still don't see what is wrong there. – luftikus143 Mar 04 '20 at 07:36
  • Actually, your data is different - the x value type is different - in jsFiddle it is an array of numbers, but the data module after download your data parses it to an array of strings. When x value is a string data module changes the xAxis type to categories, something like this happens: https://jsfiddle.net/BlackLabel/g9wcde73/ – Sebastian Wędzel Mar 04 '20 at 10:02
  • Ah... Thanks a lot! Do you have any tip how I can »convince« Highcharts to parse it as an array then? I looked into [this](https://stackoverflow.com/questions/37350245/highcharts-csv-data-loading-and-parse-into-separate-array-and-json) and [this](https://www.highcharts.com/docs/working-with-data/custom-preprocessing#1), but it didn't work out. – luftikus143 Mar 05 '20 at 09:25
  • Are you able to reproduce your case with some sample CSV data? It could be a really simple - just a few rows. I think that it should be possible to parse the data using the `complete` callback - https://api.highcharts.com/highcharts/data.complete – Sebastian Wędzel Mar 05 '20 at 10:48

0 Answers0