开发者

flot graph not displaying

I have a flot jquery graph but the lines are not displaying. It just displays the graph with x and yaxis but not data lines.

{!formatteddata1} gets a string with the series values from salesforce

The alert gives these values

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

Below is the code to generate the graph.

j$('#loadgraph').click(function() {
    var d1=[];
    d1='{!formatteddata1}';
    alert(d1);


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 
            }

 });
 });


Hey mate, The d1 shouldn't be a String, you're declaring it as an array but you're pushing the value with single quotes changing it to string. Change this:

var d1=[];
d1='{!formatteddata1}';

to this:

var d1=[{!formatteddata1}];

Cheers

G.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜