This repository was archived by the owner on Nov 25, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ < html >
3+
4+ < head >
5+ < title > Box Plot Chart</ title >
6+ < script src ="../node_modules/chart.js/dist/Chart.bundle.js "> </ script >
7+ < script src ="../build/Chart.BoxPlot.js " type ="text/javascript "> </ 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+ function randomValues ( count , min , max ) {
23+ const delta = max - min ;
24+ const r = [ ] ;
25+ for ( var i = 0 ; i < count ; ++ i ) {
26+ r . push ( Math . random ( ) * delta + min ) ;
27+ }
28+ return r ;
29+ }
30+ const boxplotData = {
31+ labels : [ 'A' , 'B' ] ,
32+ datasets : [ {
33+ label : 'Dataset 1' ,
34+ borderColor : 'red' ,
35+ borderWidth : 1 ,
36+ outlierRadius : 3 ,
37+ itemRadius : 3 ,
38+ outlierColor : '#999999' ,
39+ data : [
40+ randomValues ( 100 , 0 , 10 ) ,
41+ randomValues ( 100 , 0 , 10 )
42+ ] ,
43+ } ]
44+ } ;
45+
46+ window . onload = function ( ) {
47+ var ctx = document . getElementById ( "canvas" ) . getContext ( "2d" ) ;
48+ window . myBar = new Chart ( ctx , {
49+ type : 'boxplot' ,
50+ data : boxplotData ,
51+ options : {
52+ responsive : true ,
53+ legend : {
54+ position : 'top' ,
55+ } ,
56+ title : {
57+ display : true ,
58+ text : 'Chart.js Box Plot Chart'
59+ } ,
60+ scales : {
61+ xAxes : [ {
62+ // Specific to Bar Controller
63+ categoryPercentage : 0.9 ,
64+ barPercentage : 0.8
65+ } ]
66+ }
67+ }
68+ } ) ;
69+ } ;
70+ </ script >
71+ </ body >
72+
73+ </ html >
You can’t perform that action at this time.
0 commit comments