@@ -89,6 +89,13 @@ export class IgxChartIntegrationDirective {
8989 @Input ( )
9090 public defaultLabelMemberPath : string = undefined ;
9191
92+ /**
93+ * When set to `true`, the directive automatically hides the Y-axis if the
94+ * selected numeric member paths do not contain finite numeric values in the
95+ * current data view.
96+ *
97+ * @default false
98+ */
9299 @Input ( )
93100 public autoHideYAxisWhenNoData = false ;
94101
@@ -285,17 +292,17 @@ export class IgxChartIntegrationDirective {
285292 const customComponentOptions : IChartComponentOptions = this . customChartComponentOptions . get ( type ) || { } ;
286293 const customChartOptions = customComponentOptions . chartOptions || { } ;
287294 const customSeriesModel = customComponentOptions . seriesModel || { } ;
288- const valueMemberPathsWithData = this . _valueMemberPaths . filter ( memberPath => this . hasSeriesData ( memberPath ) ) ;
289- const valueMemberPathsForSeries = this . autoHideYAxisWhenNoData ? valueMemberPathsWithData : this . _valueMemberPaths ;
295+ const pathsWithData = this . _valueMemberPaths . filter ( memberPath => this . hasSeriesData ( memberPath ) ) ;
296+ const seriesPaths = this . autoHideYAxisWhenNoData ? pathsWithData : this . _valueMemberPaths ;
290297 chartComponentOptions . chartOptions = { ...this . dataChartOptions , ...customChartOptions } ;
291298 if ( type . indexOf ( 'Scatter' ) !== - 1 ) {
292299 this . addScatterChartDataOptions ( type , chartComponentOptions ) ;
293300 } else {
294301 chartComponentOptions . seriesModel = { ...this . dataChartSeriesOptionsModel , ...customSeriesModel } ;
295- const hideYAxis = this . autoHideYAxisWhenNoData && valueMemberPathsWithData . length === 0 ;
302+ const hideYAxis = this . autoHideYAxisWhenNoData && pathsWithData . length === 0 ;
296303 this . setAxisLabelOption ( type , chartComponentOptions , hideYAxis ) ;
297304 const options : IOptions [ ] = [ ] ;
298- valueMemberPathsForSeries . forEach ( valueMemberPath => {
305+ seriesPaths . forEach ( valueMemberPath => {
299306 const dataOptions = {
300307 title : valueMemberPath ,
301308 valueMemberPath
@@ -352,6 +359,13 @@ export class IgxChartIntegrationDirective {
352359 return dataRecord ;
353360 }
354361
362+ /**
363+ * Checks whether the current data set contains at least one finite numeric
364+ * value for the provided member path.
365+ *
366+ * @param memberPath The numeric member path to inspect.
367+ * @returns `true` when at least one finite number exists for the path.
368+ */
355369 private hasSeriesData ( memberPath : string ) : boolean {
356370 return this . _chartData . some ( record => Number . isFinite ( record [ memberPath ] ) ) ;
357371 }
0 commit comments