/home/mip/mip/public/template/AdminLTE/plugins/RGraph/demos/bar-combined-line.html
<!DOCTYPE html >
<html>
<head>
<link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
<script src="../libraries/RGraph.common.core.js" ></script>
<script src="../libraries/RGraph.bar.js" ></script>
<script src="../libraries/RGraph.line.js" ></script>
<title>A combined bar/line chart</title>
<meta name="robots" content="noindex,nofollow" />
<meta name="description" content="A combined Bar and Line chart" />
</head>
<body>
<h1>A combined bar/line chart</h1>
<p>
</p>
<canvas id="cvs" width="1000" height="350">[No canvas support]</canvas>
<script>
window.onload = function ()
{
/**
* Create the data and colors
*/
var barData = [];
var lineData = [];
var colors = [];
for (var i=0; i<60; ++i) {
if (i < 30) {
barData[i] = RGraph.random(-100, 0);
colors[i] = '#318CBD';
} else {
barData[i] = RGraph.random(0, 100);
colors[i] = '#BD3929';
}
lineData[i] = (((i/60) * 200) - 100) * RGraph.random(0, 10);
}
var bar = new RGraph.Bar({
id: 'cvs',
data: barData,
options: {
shadowBlur: 1,
shadowOffsetx: 1,
shadowOffsety: 1,
hmargin: 1,
gutterLeft: 35,
colors: colors,
colorsSequential: true,
xaxispos: 'center',
backgroundGridVlines: false,
backgroundGridBorder: false,
noyaxis: true,
ymax: 100,
gutterBottom: 50,
strokestyle: 'rgba(0,0,0,0)',
xlabelsOffset: 8,
labels: [
'1987', '\n1988','1989','\n1990','1991',
'\n1992', '1993','\n1994','1995','\n1996',
'1997', '\n1998','1999','\n2000','2001',
'\n2002','2003','\n2004','2005','\n2006',
'2007','\n2008','2009','\n2010','2011',
'\n2012','2013','\n2014','2015','\n2016'
],
textAccessible: true
}
})
/**
* Now add the line chart
*/
var line = new RGraph.Line({
id: 'cvs',
data: lineData,
options: {
colors: ['#FFD600'],
xaxispos: 'center',
linewidth: 2,
shadowOffsetx: 0,
shadowOffsety: 0,
shadowBlur: 5,
tickmarks: false,
gutterLeft: 35
}
})
/**
* Create the combined class
*/
combo = new RGraph.CombinedChart([bar, line]);
combo.draw();
};
</script>
<p></p>
This goes in the documents header:
<pre class="code">
<script src="RGraph.common.core.js"></script>
<script src="RGraph.line.js"></script>
<script src="RGraph.bar.js"></script>
</pre>
Put this where you want the chart to show up:
<pre class="code">
<canvas id="cvs" width="600" height="250">
[No canvas support]
</canvas>
</pre>
This is the code that generates the chart:
<pre class="code">
<script>
window.onload = function ()
{
<span>/**
* Create the data and colors
*/</span>
var barData = [];
var lineData = [];
var colors = [];
for (var i=0; i<60; ++i) {
if (i < 30) {
barData[i] = RGraph.random(-100, 0);
colors[i] = '#318CBD';
} else {
barData[i] = RGraph.random(0, 100);
colors[i] = '#BD3929';
}
lineData[i] = (((i/60) * 200) - 100) * RGraph.random(0, 10);
}
var bar = new RGraph.Bar({
id: 'cvs',
data: barData,
options: {
shadowBlur: 1,
shadowOffsetx: 1,
shadowOffsety: 1,
hmargin: 1,
gutterLeft: 35,
colors: colors,
colorsSequential: true,
xaxispos: 'center',
backgroundGridVlines: false,
backgroundGridBorder: false,
noyaxis: true,
ymax: 100,
gutterBottom: 50,
strokestyle: 'rgba(0,0,0,0)',
textAngle: 30,
xlabelsOffset: 8,
labels: [
'1987', '\n1988','1989','\n1990','1991',
'\n1992', '1993','\n1994','1995','\n1996',
'1997', '\n1998','1999','\n2000','2001',
'\n2002','2003','\n2004','2005','\n2006',
'2007','\n2008','2009','\n2010','2011',
'\n2012','2013','\n2014','2015','\n2016'
],
textAccessible: true
}
})
<span>/**
* Now add the line chart
*/</span>
var line = new RGraph.Line({
id: 'cvs',
data: lineData,
options: {
colors: ['#FFD600'],
xaxispos: 'center',
linewidth: 2,
shadowOffsetx: 0,
shadowOffsety: 0,
shadowBlur: 5,
tickmarks: false,
gutterLeft: 35
}
})
<span>/**
* Create the combined class
*/</span>
combo = new RGraph.CombinedChart([bar, line]);
combo.draw();
};
</script>
</pre>
<p>
<a href="https://www.facebook.com/sharer/sharer.php?u=http://www.rgraph.net" target="_blank" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=http://www.rgraph.net', null, 'top=50,left=50,width=600,height=368'); return false"><img src="../images/facebook-large.png" width="200" height="43" alt="Share on Facebook" border="0" title="Visit the RGraph Facebook page" /></a>
<a href="https://twitter.com/_rgraph" target="_blank" onclick="window.open('https://twitter.com/_rgraph', null, 'top=50,left=50,width=700,height=400'); return false"><img src="../images/twitter-large.png" width="200" height="43" alt="Share on Twitter" border="0" title="Mention RGraph on Twitter" /></a>
</p>
<p>
<a href="./">« Back</a>
</p>
</body>
</html>