Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit e1afb1a

Browse files
committed
add simple example
1 parent 74282b2 commit e1afb1a

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

samples/simple.html

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<title>Vertical Bar</title>
6+
<script src="../node_modules/chart.js/dist/Chart.bundle.js" type></script>
7+
<script src="../build/Plugin.Errorbars.js"></script>
8+
<style>
9+
canvas {
10+
-moz-user-select: none;
11+
-webkit-user-select: none;
12+
-ms-user-select: none;
13+
}
14+
</style>
15+
</head>
16+
17+
<body>
18+
<div id="container" style="width: 75%;">
19+
<canvas id="canvas"></canvas>
20+
</div>
21+
<script>
22+
var color = Chart.helpers.color;
23+
var barChartData = {
24+
labels: ['Value', 'Value 2', 'Value 3', 'Value 4'],
25+
datasets: [{
26+
label: 'Dataset 1',
27+
//backgroundColor: '#d95f02',
28+
borderColor: '#d95f02',
29+
borderWidth: 1,
30+
data: [
31+
50,
32+
100,
33+
130,
34+
0
35+
],
36+
errorBars: {
37+
'Value': {plus: 20, minus: -30},
38+
'Value 2': {plus: 20, minus: -30}
39+
}
40+
}]
41+
42+
};
43+
44+
window.onload = function () {
45+
var ctx = document.getElementById("canvas").getContext("2d");
46+
window.myBar = new Chart(ctx, {
47+
type: 'bar',
48+
data: barChartData,
49+
options: {
50+
responsive: true,
51+
legend: {
52+
position: 'top',
53+
},
54+
title: {
55+
display: true,
56+
text: 'Chart.js Error Bars Plugin'
57+
},
58+
plugins: {
59+
chartJsPluginErrorBars: {
60+
width: '60%',
61+
//color: 'darkgray'
62+
}
63+
}
64+
},
65+
});
66+
};
67+
</script>
68+
</body>
69+
70+
</html>

0 commit comments

Comments
 (0)