Expanding the graph and overriding the draw function would be one (complicated) way to do this.
A simple way would be to duplicate the chart canvas with all the other elements (grids, scale labels ...), style the line in different ways (thicker and grayer). Then position this duplicate canvas below and to the bottom and to the right of the original canvas.
CSS
.shadowParent { position: relative; } .shadowParent canvas.firstShadow { position: absolute; left: 10px; top: 30px; z-index: -1; }
HTML
<div class="shadowParent"> <canvas id="myChartShadow" class="firstShadow" width="600"></canvas> <canvas id="myChart" width="600"></canvas> </div>
Script
... var ctxShadow = document.getElementById("myChartShadow").getContext("2d"); var dataShadow = JSON.parse(JSON.stringify(data)); dataShadow.datasets[0].strokeColor = "rgba(220,220,220,0.2)" new Chart(ctxShadow).Line(dataShadow, { datasetStrokeWidth: 10, datasetFill: false, pointDot: false, showTooltips: false, });
If your shadow is not blurry enough, you can add another layer
CSS
.shadowParent canvas.secondShadow { position: absolute; left: 10px; top: 30px; z-index: -1; }
HTML
<div class="shadowParent"> <canvas id="myChartShadow2" class="secondShadow" width="600"></canvas> ...
Script
var ctxShadow2 = document.getElementById("myChartShadow2").getContext("2d"); var dataShadow2 = JSON.parse(JSON.stringify(data)); dataShadow2.datasets[0].strokeColor = "rgba(220,220,220,0.1)" new Chart(ctxShadow2).Line(dataShadow2, { datasetStrokeWidth: 20, datasetFill: false, pointDot: false, showTooltips: false, scaleFontColor: "rgba(0,0,0,0)", scaleLineColor: "rgba(0,0,0,0)", scaleShowGridLines: false, datasetFill: false, });
Please note that the scale aligns with the first shadow (this gives it more 3D-feel), but you can move it to the first level if the scale is important (this looks more like a rough look of the graph)
Fiddle - http://jsfiddle.net/fjyj1021/
