0

I have a graph which displays a line over many days, months and years. I'd like to have on the xAxis only every xth year displayed. In Safari, it displays it correctly; in Firefox (41.0), it displays 1970 all the way through. Here is a fiddle.

The data look like this:

    Date,Value
    1-Jan-1993,
    2-Jan-1993,
    3-Jan-1993,
    4-Jan-1993,
    5-Jan-1993,-4.30161566849

The xAxis definition like this:

    xAxis: 
    {
        tickWidth: 0,
        type: 'datetime',
        labels: 
        {
           format: '{value:%Y}'
        }
    }

Here is a screenshot of what Firefox spits out:

enter image description here

Thanks for any suggestions!

luftikus143
  • 1,285
  • 3
  • 27
  • 52
  • It's probably problem with parsing your dates into timestamps - could you show code responsible for that part? Very unlikely it's a problem with Highcharts config. – Paweł Fus Oct 27 '15 at 10:32
  • I feel its not problem with highcharts, its something about the date format not supported while parsing in safari. See this http://stackoverflow.com/questions/4310953/invalid-date-in-safari – Nishith Kant Chaturvedi Oct 27 '15 at 10:50
  • So most likely , you have to manipulate your csv to replace "-" with "/" , or read it in a javascript variable and replcace using (new Date('2011-04-12'.replace(/-/g, "/"))) – Nishith Kant Chaturvedi Oct 27 '15 at 10:52
  • Thanks a lot! [Here is the fiddle](http://fiddle.jshell.net/cpnzhveu/4/) which shows the data and the conversion. I tried to replace the "-" with "/", but that doesn't work either. – luftikus143 Oct 27 '15 at 11:01
  • Still struggling with this. Any help would be very much appreciated! – luftikus143 Oct 28 '15 at 08:14

1 Answers1

1

Firefox cannot parse your date strings in their current format they all return the default datetime of 1 Jan 1970, replacing all the - seperators with spaces allows Firefox, Chrome and IE to parse the dates correctly as seen here http://fiddle.jshell.net/z2uosh1a/

Simon West
  • 3,708
  • 1
  • 26
  • 28
  • Wow, thanks a lot! Is there any way to know these things? I mean, a page which displays which data formats should be coded/displayed in which way? Or just a trial-and-error thing? – luftikus143 Oct 30 '15 at 06:20
  • [This MDN article](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse) lists some implementations of firefox's Date.parse() function however it does boil down to a little trial and error inside the browser console. – Simon West Nov 02 '15 at 09:04