JSFiddle - React, Tailwind, and code Playground
by shamaleyte
HTML
<script src="http://www.flotcharts.org/flot/jquery.flot.js"></script>
<script src="https://rawgit.com/Xinjo/AreaMarkings/master/jquery.flot.areamarkings.js"></script>
<script src="http://www.flotcharts.org/flot/jquery.flot.time.js"></script>
<!-- basic time series flot chart -->
<h>Create a custom green range</h>
<div style="height: 400px; width: 600px;" id="placeholder"></div>
JavaScript
var d = [
[1418582640000, 2.45],
[1418582640000, 5.71],
[1418582640000, 2.50],
[1418582640000, 12.63],
[1418582640000, 3.14],
[1421261040000, 7.45],
[1421261040000, 5.71],
[1421261040000, 7.50],
[1421261040000, 7.63],
[1421261040000, 3.14],
[1423939440000, 7.45],
[1423939440000, 5.71],
[1423939440000, 7.50],
[1423939440000, 7.63],
[1423939440000, 3.14],
[1426358640000, 7.45],
[1426358640000, 5.71],
[1426358640000, 7.50],
[1426358640000, 7.63],
[1426358640000, 3.14]
];
$.plot("#placeholder", [d], {
series: {
lines: {
show: true
},
points: {
show: true
}
},
grid: {
hoverable: true,
clickable: true,
markings: [{
yaxis: {
from: 0,
to: 12
},
color: "#F2CDEA"
}, {
yaxis: {
from: 4,
to: 7
},
color: "#D7EEE1"
}]
},
xaxis: {
mode: "time",
minTickSize: [2, "month"],
/*timeformat: "%y/%m/%d",
minTickSize: [1, "month"],
min: theVeryFirstPoint,
max: theVeryLastPoint*/
},
yaxis: {
min: 0,
max: 12
}
});