123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <!doctype html>
- <html>
- <head>
- <title>Line Styles</title>
- <script src="../../../dist/Chart.bundle.js"></script>
- <script src="../../utils.js"></script>
- <style>
- canvas{
- -moz-user-select: none;
- -webkit-user-select: none;
- -ms-user-select: none;
- }
- </style>
- </head>
- <body>
- <div style="width:75%;">
- <canvas id="canvas"></canvas>
- </div>
- <script>
- var config = {
- type: 'line',
- data: {
- labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
- datasets: [{
- label: 'Unfilled',
- fill: false,
- backgroundColor: window.chartColors.blue,
- borderColor: window.chartColors.blue,
- data: [
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor()
- ],
- }, {
- label: 'Dashed',
- fill: false,
- backgroundColor: window.chartColors.green,
- borderColor: window.chartColors.green,
- borderDash: [5, 5],
- data: [
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor()
- ],
- }, {
- label: 'Filled',
- backgroundColor: window.chartColors.red,
- borderColor: window.chartColors.red,
- data: [
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor(),
- randomScalingFactor()
- ],
- fill: true,
- }]
- },
- options: {
- responsive: true,
- title: {
- display: true,
- text: 'Chart.js Line Chart'
- },
- tooltips: {
- mode: 'index',
- intersect: false,
- },
- hover: {
- mode: 'nearest',
- intersect: true
- },
- scales: {
- xAxes: [{
- display: true,
- scaleLabel: {
- display: true,
- labelString: 'Month'
- }
- }],
- yAxes: [{
- display: true,
- scaleLabel: {
- display: true,
- labelString: 'Value'
- }
- }]
- }
- }
- };
- window.onload = function() {
- var ctx = document.getElementById('canvas').getContext('2d');
- window.myLine = new Chart(ctx, config);
- };
- </script>
- </body>
- </html>
|