@@ -217,7 +217,10 @@ export class AxisLayoutPanel {
217217 */
218218
219219 private calculateNumericInterval ( axis : Axis , rect : Rect ) : number {
220- if ( axis . majorTicks . interval !== null ) {
220+ const allowComponentRender : boolean = ( ( ! isNullOrUndefined ( axis . minimum ) && ! isNullOrUndefined ( axis . maximum ) && axis . minimum !== axis . maximum ) || ( isNullOrUndefined ( axis . minimum ) || isNullOrUndefined ( axis . maximum ) ) ) ;
221+ if ( ! allowComponentRender ) {
222+ return 0 ;
223+ } else if ( axis . majorTicks . interval !== null ) {
221224 return axis . majorTicks . interval ;
222225 }
223226 let totalAngle : number = axis . endAngle - axis . startAngle ;
@@ -271,41 +274,43 @@ export class AxisLayoutPanel {
271274 let roundValue : number ;
272275 const interval : number = axis . visibleRange . interval ;
273276 const max : number = axis . visibleRange . max ;
274- for ( let i : number = axis . visibleRange . min ; ( i <= max && interval ) ; i += interval ) {
275- roundValue = axis . roundingPlaces ? parseFloat ( i . toFixed ( axis . roundingPlaces ) ) : i ;
276- argsData = {
277- cancel : false , name : axisLabelRender , axis : axis ,
278- text : customLabelFormat ? style . format . replace ( new RegExp ( '{value}' , 'g' ) , format ( roundValue ) ) :
279- format ( roundValue ) ,
280- value : roundValue
281- } ;
282- if ( this . gauge . isBlazor ) {
283- const { axis, ...blazorArgsData } : IAxisLabelRenderEventArgs = argsData ;
284- argsData = blazorArgsData ;
285- }
286- // eslint-disable-next-line @typescript-eslint/no-explicit-any
287- const axisLabelRenderSuccess : any = ( argsData : IAxisLabelRenderEventArgs ) => {
288- if ( ! argsData . cancel ) {
289- axis . visibleLabels . push ( new VisibleLabels (
290- argsData . text , i
291- ) ) ;
292- if ( i === max && this . gauge . isBlazor && document . getElementById ( this . gauge . element . id + '_AxesCollection' ) ) {
293- const currentLast : number = axis . visibleLabels . length ? axis . visibleLabels [ axis . visibleLabels . length - 1 ] . value
294- : null ;
295- if ( currentLast === axis . visibleRange . max || axis . showLastLabel !== true ) {
296- this . getMaxLabelWidth ( this . gauge , axis ) ;
297- axis . nearSize = axis . nearSize + axis . maxLabelSize . height ;
298- axis . farSize = axis . farSize + axis . maxLabelSize . height ;
299- this . axisRenderer . drawAxisLabels (
300- axis , this . gauge . axes . length - 1 ,
301- ( document . getElementById ( this . gauge . element . id + '_Axis_Group_' + ( this . gauge . axes . length - 1 ) ) ) ,
302- this . gauge ) ;
277+ if ( ( isNullOrUndefined ( axis . minimum ) && isNullOrUndefined ( axis . maximum ) ) || axis . minimum !== axis . maximum ) {
278+ for ( let i : number = axis . visibleRange . min ; ( i <= max && interval ) ; i += interval ) {
279+ roundValue = axis . roundingPlaces ? parseFloat ( i . toFixed ( axis . roundingPlaces ) ) : i ;
280+ argsData = {
281+ cancel : false , name : axisLabelRender , axis : axis ,
282+ text : customLabelFormat ? style . format . replace ( new RegExp ( '{value}' , 'g' ) , format ( roundValue ) ) :
283+ format ( roundValue ) ,
284+ value : roundValue
285+ } ;
286+ if ( this . gauge . isBlazor ) {
287+ const { axis, ...blazorArgsData } : IAxisLabelRenderEventArgs = argsData ;
288+ argsData = blazorArgsData ;
289+ }
290+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
291+ const axisLabelRenderSuccess : any = ( argsData : IAxisLabelRenderEventArgs ) => {
292+ if ( ! argsData . cancel ) {
293+ axis . visibleLabels . push ( new VisibleLabels (
294+ argsData . text , i
295+ ) ) ;
296+ if ( i === max && this . gauge . isBlazor && document . getElementById ( this . gauge . element . id + '_AxesCollection' ) ) {
297+ const currentLast : number = axis . visibleLabels . length ? axis . visibleLabels [ axis . visibleLabels . length - 1 ] . value
298+ : null ;
299+ if ( currentLast === axis . visibleRange . max || axis . showLastLabel !== true ) {
300+ this . getMaxLabelWidth ( this . gauge , axis ) ;
301+ axis . nearSize = axis . nearSize + axis . maxLabelSize . height ;
302+ axis . farSize = axis . farSize + axis . maxLabelSize . height ;
303+ this . axisRenderer . drawAxisLabels (
304+ axis , this . gauge . axes . length - 1 ,
305+ ( document . getElementById ( this . gauge . element . id + '_Axis_Group_' + ( this . gauge . axes . length - 1 ) ) ) ,
306+ this . gauge ) ;
307+ }
303308 }
304309 }
305- }
306- } ;
307- axisLabelRenderSuccess . bind ( this ) ;
308- this . gauge . trigger ( axisLabelRender , argsData , axisLabelRenderSuccess ) ;
310+ } ;
311+ axisLabelRenderSuccess . bind ( this ) ;
312+ this . gauge . trigger ( axisLabelRender , argsData , axisLabelRenderSuccess ) ;
313+ }
309314 }
310315 const lastLabel : number = axis . visibleLabels . length ? axis . visibleLabels [ axis . visibleLabels . length - 1 ] . value : null ;
311316 const maxVal : number = axis . visibleRange . max ;
@@ -426,6 +431,7 @@ export class AxisLayoutPanel {
426431 element = gauge . renderer . createGroup ( {
427432 id : gauge . element . id + '_Axis_Group_' + index
428433 } ) ;
434+ this . gauge . allowComponentRender = ( ( ! isNullOrUndefined ( axis . minimum ) && ! isNullOrUndefined ( axis . maximum ) && axis . minimum !== axis . maximum ) || ( isNullOrUndefined ( axis . minimum ) || isNullOrUndefined ( axis . maximum ) ) ) ;
429435 renderer . checkAngles ( axis ) ;
430436 renderer . drawAxisOuterLine ( axis , index , element , gauge ) ;
431437 renderer . drawAxisRange ( axis , index , element ) ;
0 commit comments