1+ <!--<div class="{tmpl_var name='tablelayout'}">-->
2+ < div >
3+ < div > < h3 > {tmpl_var name="label_chart_title"}</ h3 > </ div >
4+ < div style ="padding-bottom:10px; "> < canvas height ="30 " id ="loadchart " style ="background-color: white; "> </ canvas > </ div >
5+ < div style ="padding-bottom:10px; "> < canvas height ="30 " id ="memchart " style ="background-color: white; "> </ canvas > </ div >
6+ < div style ="padding-bottom:10px; "> < canvas height ="30 " id ="rxchart " style ="background-color: white; "> </ canvas > </ div >
7+ < div style ="padding-bottom:10px; "> < canvas height ="30 " id ="txchart " style ="background-color: white; "> </ canvas > </ div >
8+ </ div >
9+
10+ < script >
11+ createChart ( 'loadchart' , '{tmpl_var name="loadchart_label"}' , [ { tmpl_var name = 'label' } ] , [ { tmpl_var name = 'loadchart_data' } ] ) ;
12+ createChart ( 'memchart' , '{tmpl_var name="memchart_label"}' , [ { tmpl_var name = 'label' } ] , [ { tmpl_var name = 'memchart_data' } ] ) ;
13+ createChart ( 'rxchart' , '{tmpl_var name="rxchart_label"}' , [ { tmpl_var name = 'label' } ] , [ { tmpl_var name = 'rxchart_data' } ] ) ;
14+ createChart ( 'txchart' , '{tmpl_var name="txchart_label"}' , [ { tmpl_var name = 'label' } ] , [ { tmpl_var name = 'txchart_data' } ] ) ;
15+
16+ function createChart ( chartname , label , labels , data ) {
17+ var ctx = document . getElementById ( chartname ) . getContext ( '2d' ) ;
18+ var chart = new Chart ( ctx , {
19+ type : 'line' , // Type of chart
20+ data : {
21+ labels : labels , // Empty array to remove labels
22+ datasets : [ {
23+ label : label , // Name of the dataset
24+ data : data , // Data points
25+ borderWidth : 1 ,
26+ tension : 0.4 , // Tension for cubic interpolation
27+ cubicInterpolationMode : 'default' , // Can be 'default' or 'monotone'
28+ borderColor : 'rgb(75, 192, 192)' , // Color of the line
29+ backgroundColor : 'rgba(75, 192, 192, 0.2)' , // Color for filling the area below the line
30+ fill : true // Enable fill below the line
31+ } ]
32+ } ,
33+ options : {
34+ scales : {
35+ x : {
36+ display : false , // Hide the x-axis
37+ } ,
38+ y : {
39+ beginAtZero : true // Start y-axis at zero
40+ }
41+ } ,
42+ plugins : {
43+ legend : {
44+ labels : {
45+ generateLabels : function ( chart ) {
46+ const data = chart . data ;
47+ return data . datasets . map ( function ( dataset , i ) {
48+ return {
49+ text : dataset . label ,
50+ fillStyle : 'white' , // Set to empty string to hide the colored box
51+ hidden : ! chart . isDatasetVisible ( i ) ,
52+ lineCap : dataset . borderCapStyle ,
53+ lineDash : dataset . borderDash ,
54+ lineDashOffset : dataset . borderDashOffset ,
55+ lineJoin : dataset . borderJoinStyle ,
56+ lineWidth : dataset . borderWidth ,
57+ strokeStyle : 'white' ,
58+ pointStyle : 'white' , // Set to empty string to hide the point style
59+ datasetIndex : i
60+ } ;
61+ } ) ;
62+ }
63+ }
64+ }
65+ }
66+ }
67+ } ) ;
68+ }
69+ </ script >
0 commit comments