At the moment each team
is assigned a value e.g team1.txt == 1
So when i render the graph each team has a continuous line along the x-axis (timeline).
The y-axis has values 1 .. 3
, how could i change the y-axis' labels?
So that instead of seeing 1
as first metric on y-axis, I saw team1.txt
.. then next value on y-axis would be team2.txt
html
<div id="content">
<div class="demo-container">
<div id="placeholder" class="demo-placeholder">
</div>
</div>
<div id="chartLegend"></div>
</div>
javascript
text = '[{"name":"team1.txt","points":[[1389340501000,1],[1389370501000,1],[1389873602000,1],[1390046402000,1],[1390078402000,1]]},{"name":"team2.txt","points":[[1389370501000,2],[1389441601000,2],[1389528002000,2]]},{"name":"team3.txt","points":[[1389370501000,3],[1389441601000,3],[1389441601000,3]]}]';
var datasets = JSON.parse(text);
var data = [];
for (var i = 0; i < datasets.length; i++) {
data.push({label: datasets[i].name, data: datasets[i].points});
}
$.plot($("#placeholder"), data, {
xaxis: {
mode: "time",
min: (new Date(2014, 1, 1)).getTime(),
max: (new Date()).getTime()
},
series: {
stack: true,
lines: {
show: true
},
points: {
show: true
}
},
grid: {
hoverable: true,
clickable: true
},
legend: {
noColumns: 5,
container: $("#chartLegend")
}
});