Reputation: 999
Struggling a bit here, because if I've understood the docs correctly (though I'll admit is probably not the case!), this should be working.
I'm using a Coldfusion CFC to grab data and return it in JSon format. Data is returned as 2 numeric values, i.e 6 & 1, 3 & 2 and so on. The 'x-axis' value is a day, i.e day 1, day 2 etc.
Currently, the x-axis is displaying it as 2.5, 5, 7.5 etc. I need this to change so its displayed as it's returned - i.e 1,2,3 etc.
This is the JS I have right now, which executes without error, but doesn't display the chart as intended...
$(function() {
$.getJSON("/com/stats.cfc?method=getPageViews&returnformat=json", {}, function(data) {
$.plot($("#chart"), [ data ],
{
lines:{show:true},
points:{show:true},
tickSize:1,
tickDecimals:0
})
})
});
Pointers much appreciated!
Upvotes: 1
Views: 1480
Reputation: 999
Purely by luck, I've figured out the correct syntax. For the benefit of anyone search for this, here's the updated working code;
$(function() {
$.getJSON("/com/stats.cfc?method=getPageViews&returnformat=json", {}, function(data) {
$.plot($("#chart"), [ data ],
{
lines:{show:true},
points:{show:true},
xaxis:
{
tickSize:1,
tickDecimals:0
}
})
})
});
Upvotes: 4