Multiple Charts (Candlestick and column) aligned one below other in single page - CanvasJS JavaScript Charts
Multiple Charts (Candlestick and column) aligned one below other in single page - CanvasJS JavaScript Charts
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chart1Container" style="height: 360px; width: 100%;"></div>
<div id="chart2Container" style="height: 260px; width: 100%;"></div>
JavaScript
var chart1 = new CanvasJS.Chart("chart1Container",
{
axisX:{
tickLength: 0,
labelFormatter:function ( e ) {
return " ";
},
},
axisY2:{
includeZero: false,
labelFontSize: 14,
gridThickness:0
},
data: [
{
type: "candlestick",
axisYType: "secondary",
dataPoints: [
{x: new Date(2012,01,01),y:[5198, 5629, 5159, 5385]},
{x: new Date(2012,02,01),y:[5366, 5499, 5135, 5295]},
{x: new Date(2012,03,01),y:[5296, 5378, 5154, 5248]},
{x: new Date(2012,04,01),y:[5254, 5279, 4788, 4924]},
{x: new Date(2012,05,01),y:[4910, 5286, 4770, 5278]},
{x: new Date(2012,06,01),y:[5283, 5348, 5032, 5229]},
{x: new Date(2012,07,01),y:[5220, 5448, 5164, 5258]},
{x: new Date(2012,08,01),y:[5276, 5735, 5215, 5703]},
{x: new Date(2012,09,01),y:[5704, 5815, 4888, 5619]},
{x: new Date(2012,10,01),y:[5609, 5885, 5548, 5879]},
{x: new Date(2012,11,01),y:[5878, 5965, 5823, 5905]}
]
}
]
});
chart1.render();
var chart2 = new CanvasJS.Chart("chart2Container",
{
axisX:{
labelFontSize: 14,
},
axisY2:{
labelFontSize: 14,
gridThickness:0,
maximum: 2800
},
data: [
{
type: "column",
axisYType: "secondary",
dataPoints: [
{ x: new Date(2012, 01, 1), y: 2450 },
{ x: new Date(2012, 02, 1), y: 2414 },
{ x: new Date(2012, 03, 1), y: 2520 },
{ x: new Date(2012, 04, 1), y: 2460 },
{ x: new Date(2012, 05, 1), y: 1850 },
{ x: new Date(2012, 06, 1), y: 2500 },
{ x: new Date(2012, 07, 1), y: 2480 },
{ x: new Date(2012, 08, 1), y: 1580 },
{ x: new Date(2012, 09, 1), y: 2410 },
{ x: new Date(2012, 10, 1), y: 1500 },
{ x: new Date(2012,...