Search code examples
javascriptflotgraphic

Flot chart To show different year's data in order on X axis


I have a data array which consists of timestamp - value pairs.

Basically there are two sets of data; 2014 and 2015 values.

For;

2014.12 : There are 4 values

2015.1 : There are 4 values.

2015.2 : There are 4 values.

2015.3 : There are 4 values.

I want to show them in order, 2014 values first , and so on.

However I end up showing values without time order starting from 1 to 12 on x axis. Is there any way of setting the x axis in order based on my array data?

  Fiddle;

http://jsfiddle.net/shamaleyte/6gL1wzsL/4/


Solution

  • Use the time plugin & mode to show date/time & values pairs.

    xaxis: {
        mode: 'time'
    },
    

    See this updated fiddle and the chapter in the documentation.