@@ -11,7 +11,7 @@ import { ChartExtraContext } from "./chart-extra-context";
1111// It can be used by other components to assert if the chart is in no-data state (by checking if container is present).
1212export interface ReactiveNodataState {
1313 visible : boolean ;
14- style ? : React . CSSProperties ;
14+ style : React . CSSProperties ;
1515 noMatch : boolean ;
1616}
1717
@@ -32,12 +32,17 @@ export class ChartExtraNodata extends AsyncStore<ReactiveNodataState> {
3232 const visibleSeries = findAllVisibleSeries ( this . chart ) ;
3333 // The no-data is not shown when there is at least one series or point (for pie series) non-empty and visible.
3434 if ( visibleSeries . length > 0 ) {
35- this . set ( ( ) => ( { visible : false , noMatch : false } ) ) ;
35+ this . set ( ( ) => ( { visible : false , style : { } , noMatch : false } ) ) ;
3636 } else {
37- this . set ( ( ) => ( { visible : true , noMatch : allSeriesWithData . length > 0 } ) ) ;
37+ this . set ( ( ) => ( { visible : true , style : this . getContainerStyle ( ) , noMatch : allSeriesWithData . length > 0 } ) ) ;
3838 }
3939 } ;
4040
41+ private getContainerStyle ( ) : React . CSSProperties {
42+ const blockOffset = this . chart . chartHeight - this . chart . plotHeight ;
43+ return { insetBlockEnd : `${ blockOffset } px` } ;
44+ }
45+
4146 private get chart ( ) {
4247 return this . context . chart ( ) ;
4348 }
@@ -57,4 +62,4 @@ function findAllVisibleSeries(chart: Highcharts.Chart) {
5762 return allSeriesWithData . filter (
5863 ( s ) => s . visible && ( s . type !== "pie" || s . data . some ( ( d ) => d . y !== null && d . visible ) ) ,
5964 ) ;
60- }
65+ }
0 commit comments