JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://rawgit.com/vpassapera/jqPlot/master/jquery.jqplot.min.js"></script>
<link rel="stylesheet" href="https://rawgit.com/vpassapera/jqPlot/master/jquery.jqplot.min.css">
<script src="https://rawgit.com/vpassapera/jqPlot/master/plugins/jqplot.barRenderer.min.js"></script>
<script src="https://rawgit.com/vpassapera/jqPlot/master/plugins/jqplot.categoryAxisRenderer.min.js"></script>
<script src="https://rawgit.com/vpassapera/jqPlot/master/plugins/jqplot.enhancedLegendRenderer.min.js"></script>
<script src="https://rawgit.com/vpassapera/jqPlot/master/plugins/jqplot.dateAxisRenderer.min.js"></script>
<div id="graph_stacked"></div>
CSS
#graph_stacked {
height: 400px;
width: 1000px;
border: 1px solid black;
}
JavaScript
var xLabel = 'AREAS';
var yLabel = 'NUMBERS';
var yInterval = '';
var yInterval = '';
// Series for bar charts
var S1 = [20, 60, 70, 100];
var S2 = [70, 50, 30, 20];
var S3 = [10, 50, 30, 20];
// Series for line graphs
var S4 = [46, 38, 48, 47];
var S5 = [33, 23, 38, 11];
var ticks = ['NA', 'APAC', 'EU', 'LATAM'];
var yInterval = 120;
var count = 120;
// Ensure to add all the bar chart and line graph series
$.jqplot('graph_stacked', [S1, S2, S3, S4, S5], {
series: [{
label: 'Total Number of Distributors',
renderer: $.jqplot.BarRenderer
}, {
label: 'Number of Distributors with at Least One Registered User',
renderer: $.jqplot.BarRenderer
}, {
label: 'Number of Active Distributors',
renderer: $.jqplot.BarRenderer
}, {
label: 'CMH Coverage %',
renderer: $.jqplot.LineRenderer
}, {
label: 'Distributor Utilization Rate',
renderer: $.jqplot.LineRenderer
}],
// Add additional colours for the line graphs
seriesColors: ['#5882FA', '#DF7401', '#A4A4A4', '#ff00ff', '#00ffff'],
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
pointLabels: {
show: true
},
rendererOptions: {
barWidth: 25,
barDirection: 'vertical',
barPadding: 0,
fillToZero: true,
shadowOffset: 0,
shadowDepth: 0
}
},
axes: {
xaxis: {
label: xLabel,
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks
},
yaxis: {
label: yLabel
}
},
// Display the legend
legend: {
show: true,
placement: 'outsideGrid'
}
});