Flot library setting up y axis to min 0 and max 24

2019-04-04 05:51发布

问题:

How can i set up my y axis to be in the range of 0 to 24

Here is the code i have.

  j$.plot(j$("#placeholder"),[d1],{
        xaxis: 
        { mode: "time", 
            min: (new Date("2010/11/01")).getTime(),
            max: (new Date("2011/02/01")).getTime()
            }
 },
  {yaxis: { min:0, max:24 } };
  };

xaxis seemed to work but when i added y axis it doesnt work.

Apart from this d1 holds the string which is sent from salesforce

for example d1 holds

[1294041600000,14.00],[1294041600000,14.50],[1294041600000,15.00],[1293955200000,12.00]

I am not able to view the graph, currently i am having the y axis showing only the range -1 to 1, i am assuming this could be the reason why i am not seeing the line.

thanks

Prady

回答1:

The y axis problem was solved. Here is the code

j$.plot(j$("#placeholder"), [d1], {
    xaxis: 
    {
      mode: "time", 
      min: (new Date("2010/11/01")).getTime(),
      max: (new Date("2011/02/01")).getTime()
    },

    yaxis:
    {
        min:0, max: 24,  tickSize: 5 
    }
});