Reputation: 756
I got a graph showing bugs and passes of test suits I run, now they got a unix timestamp and a int containing the number of passes/bugs made I want to show a trend during a months period passes vs bugs. the data set looks like this:
var datasets = {
"Pass": {
label: "Pass",
data: [[1382099410000, 4], [1382185810000, 0], [1382272210000, 7], [1382358610000, 2], [1382445010000, 4]]
},
"Bug": {
label: "Bug",
data: [[1382099410000, 0], [1382185810000, 1], [1382272210000, 5], [1382358610000, 0], [1382445010000, 0]]
}
};
they ate used in this example http://jsfiddle.net/2dHVY/5/ I only cover 5 days but the timestamps are shown all wrong, the dates are suposed to be 18/10 - 22/10 but the grapsh dont show the 18:th and it shows duplicates eaven tho they got the exact same timestamp for the same day.
Upvotes: 1
Views: 165
Reputation: 108512
Flot is using it's own internal algorithm to place ticks along the xaxis. It places them at N distance apart based on the width of the chart. You, however, want the times to be treated like categories (I have one data point for each day). Your "duplicates" are a point at the start of a day and another at the end of a day.
You have two options. Hardcode your ticks where you want them:
xaxis: {
mode: "time",
color:"#299a0b",
tickColor: "#fff",
timeformat: "%y/%m/%d",
ticks: [1382099410000,1382185810000,1382272210000,1382358610000,1382445010000]
}
Or switch to a category xaxis.
Upvotes: 2