111 lines
3.5 KiB
HTML
111 lines
3.5 KiB
HTML
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>Line Styles</title>
|
|
<script src="../../../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>
|