JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://people.iola.dk/olau/flot/jquery.flot.js"></script>
<script src="http://www.benjaminbuffet.com/public/js/jquery.flot.orderBars.js"></script>
<script src="http://www.pureexample.com/js/flot/jquery.flot.stack.min.js"></script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<div id="placeholder" style="width:800px;height:400px;"></div>
</body>
</html>
JavaScript
function GenerateSeries(added)
{
var data = [];
var start = 100 + added;
var end = 500 + added;
for (i = 1; i <= 20; i++)
{
var d = Math.floor(Math.random() * (end - start + 1) + start);
data.push([i, d]);
start++;
end++;
}
return data;
}
function DrawChart()
{
var dataa = GenerateSeries(100);
var datab = GenerateSeries(100);
var datac = GenerateSeries(100);
var ds = new Array();
var data = [ // all series
{ label:"Q1",
data:[ // first series (Q1)
[0,100], // pens Q1 N America
[0.4,120], // pencils Q1 N America
[1,130], // pens Q1 Europe
[1.4,140], // pencils Q1 Europe
[2,150], // pens Q1 Asia
[2.4,200], // pencils Q1 Asia
]},
{ label:"Q2",
data:[ // second series (Q2)
[0,100],
[0.4,200],
[1,200],
[1.4,200],
[2,200],
[2.4,200],
]},
{ label:"Q3",
data:[ // third series (Q3)
[0,100],
[0.4,200],
[1,200],
[1.4,200],
[2,200],
[2.4,200],
]},
{ label:"Q4",
data:[ // fourth series (Q4)
[0,100],
[0.4,200],
[1,200],
[1.4,200],
[2,200],
[2.4,200],
]}
]
console.dir(data)
var options = {
series: {
stack: true
},
xaxis: {
ticks: [
[0.2,"pens"],[0.6,"pencils"],
[1.2,"pens"],[1.6,"pencils"],
[2.2,"pens"],[2.6,"pencils"]
]
},
grid: {
backgroundColor: { colors: ["#FFF", "#FFF"] },
},
bars:{
show: true,
barWidth: .4
}
};
...