@@ -118,12 +118,46 @@ define([
118118 this . _chart . update ( 1000 ) ;
119119 this . _chart . bindEvents ( ) ; // tooltips otherwise won't work
120120 } else {
121- logger . debug ( "stacked:" + this . isStacked ) ;
121+ logger . debug ( "stacked:" + this . isStacked ) ;
122122 this . _chart = new this . _chartJS ( this . _ctx , {
123123 type : "line" ,
124124 data : data ,
125125 options : {
126-
126+ title : {
127+ display : ( this . chartTitle !== "" ) ? true : false ,
128+ text : ( this . chartTitle !== "" ) ? this . chartTitle : "" ,
129+ fontFamily : this . _font ,
130+ fontSize : this . titleSize
131+ } ,
132+ scales : {
133+ yAxes : [ {
134+ //If stacked is set to true, the Y-axis needs to be stacked for it to work
135+ stacked : this . isStacked ,
136+ scaleLabel : {
137+ display : ( this . yLabel !== "" ) ? true : false ,
138+ labelString : ( this . yLabel !== "" ) ? this . yLabel : "" ,
139+ fontFamily : this . _font
140+ } ,
141+ ticks : { fontFamily : this . _font ,
142+ callback : lang . hitch ( this , function ( value ) {
143+ var round = parseInt ( this . roundY ) ;
144+ if ( ! isNaN ( round ) && round >= 0 ) {
145+ return Number ( value ) . toFixed ( round ) ;
146+ }
147+ return value ;
148+ } ) }
149+ } ] ,
150+ xAxes : [ {
151+ scaleLabel : {
152+ display : ( this . xLabel !== "" ) ? true : false ,
153+ labelString : ( this . xLabel !== "" ) ? this . xLabel : "" ,
154+ fontFamily : this . _font
155+ } ,
156+ type : "category" ,
157+ id : "x-axis-0" ,
158+ ticks : { fontFamily : this . _font , }
159+ } ]
160+ } ,
127161 responsive : this . responsive ,
128162 responsiveAnimationDuration : ( this . responsiveAnimationDuration > 0 ? this . responsiveAnimationDuration : 0 ) ,
129163 tooltips : {
@@ -193,28 +227,6 @@ define([
193227 // Custom tooltip?
194228 customTooltips : false , //lang.hitch(this, this.customTooltip)
195229
196- scales : {
197- xAxes : [ {
198- type : "category" ,
199- id : "x-axis-0"
200- } ] ,
201- yAxes : [ {
202- //If stacked is set to true, the Y-axis needs to be stacked for it to work
203- stacked : this . isStacked ,
204- ticks :{
205- callback : lang . hitch ( this , function ( value ) {
206- var round = parseInt ( this . roundY ) ;
207- if ( ! isNaN ( round ) && round >= 0 ) {
208- return Number ( value ) . toFixed ( round ) ;
209- }
210- return value ;
211- } )
212- } ,
213- type : "linear" ,
214- id : "y-axis-0"
215- } ] ,
216- }
217-
218230 }
219231 } ) ;
220232
0 commit comments