I’m trying to create flot line chart with two series on one chart and with threshold option.
I know how to enable threshold when i have only 1 serie (like here http://people.iola.dk/olau/flot/examples/thresholding.html ).
Problem is that i cannot do that with more than one serie. My code :
var options = {
grid: {
hoverable: true,
borderWidth: 1,
},
yaxis: {
min: 0,
max: 100
},
xaxis: {
mode: "time",
timeformat: "%y-%m-%d",
},
colors: ["rgb(44,55,66)","rgb(90,2,100)"]
};
$.plot($('#chart' + i),[lang,reg], options);
lang and reg are my series. I tried to put threshold option inside options
like threshold: { below: 90, color: "rgb(200, 20, 30)" }.. but it didn’t work, moreover i would like to set more that one color in thresholds so it will be multiple series with multiple colors-levels.
Do you know how to solve that? Thank you.
What you need to do is change your series from arrays to objects.
Right now, you have your data like this:
What you need is:
You can see an example of how it looks here: http://jsfiddle.net/ryleyb/WXrJX/