Stacked Bar Chart with Index Labels placed inside - CanvasJS
HTML5 Stacked Bar Chart with Index Labels placed inside
HTML
<script src="http://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
<p class="description">Built using <a href="http://canvasjs.com" title="CanvasJS HTML5 Charts" target="_blank">CanvasJS HTML5 Charts</a>
</p>
CSS
.description{
margin-top: 50px;
text-align:left;
font-family: calibri;
font-size: 16px;
color: gray;
}
a:link, a:visited, a:active{color: #4F81BC;}
JavaScript
var chart = new CanvasJS.Chart("chartContainer",
{
data: [
{
indexLabel: "{y}",
indexLabelFontColor:"white",
indexLabelPlacement:"inside",
type: "stackedBar",
dataPoints: [
{ x: 10, y: 2 },
{ x: 20, y: 3},
{ x: 30, y: 4 },
{ x: 40, y: 2 },
{ x: 50, y: 6 },
{ x: 60, y: 3 },
{ x: 70, y: 2 },
{ x: 80, y: 4 },
{ x: 90, y: 3}
]
},
{
indexLabel: "{y}",
indexLabelFontColor:"white",
indexLabelPlacement:"inside",
type: "stackedBar",
dataPoints: [
{ x: 10, y: 2 },
{ x: 20, y: 3},
{ x: 30, y: 4 },
{ x: 40, y: 2 },
{ x: 50, y: 6 },
{ x: 60, y: 3 },
{ x: 70, y: 2 },
{ x: 80, y: 4 },
{ x: 90, y: 3}
]
}
]
});
chart.render();