Javascript examples for Chart.js:Chart Configuration
multiple series with same scale
<html lang="en"> <head> <title>Stacked Bar Chart with Unstacked Line Combo on Same Scale</title> </head> <body translate="no"> <div style="width: 75%"> <canvas id="canvas"></canvas> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script> <script> window.chartColors = {//w w w. j av a 2s .c om red: 'rgb(255, 99, 132)', orange: 'rgb(255, 159, 64)', yellow: 'rgb(255, 205, 86)', green: 'rgb(75, 192, 192)', blue: 'rgb(54, 162, 235)', purple: 'rgb(153, 102, 255)', grey: 'rgb(231,233,237)' }; var ctx = document.getElementById("canvas").getContext("2d"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [{ type: 'line', label: 'Dataset 1', borderColor: window.chartColors.blue, borderWidth: 2, fill: false, data: [5, 3, 4, 10, 8, 9, 2] }, { type: 'bar', label: 'Dataset 2', backgroundColor: window.chartColors.red, stack: 'Stack 0', data: [2, 4, 1, 3, 7, 3, 6], borderColor: 'white', borderWidth: 2 }, { type: 'bar', label: 'Dataset 3', backgroundColor: window.chartColors.green, stack: 'Stack 0', data: [7, 2, 4, 5, 6, 4, 2] }] }, options: { responsive: true, title: { display: true, text: 'Chart.js Stacked Bar and Unstacked Line Combo Chart' }, tooltips: { mode: 'index', intersect: true }, scales: { xAxes: [{ stacked: true, }] } } }); //# sourceURL=pen.js </script> </body> </html>