TimeSeries: Fix fill below for dataframes with name (#35453)

Use original dataframes for matching config.
This commit is contained in:
Oscar Kilhed
2021-06-11 13:49:26 +02:00
committed by GitHub
parent aa8e09d383
commit 38734366d1
9 changed files with 39 additions and 17 deletions

View File

@@ -34,7 +34,7 @@ export const BarChart: React.FC<BarChartProps> = (props) => {
return <PlotLegend data={props.frames} config={config} maxHeight="35%" maxWidth="60%" {...props.legend} />;
};
const prepConfig = (alignedFrame: DataFrame, getTimeRange: () => TimeRange) => {
const prepConfig = (alignedFrame: DataFrame, allFrames: DataFrame[], getTimeRange: () => TimeRange) => {
const { timeZone, orientation, barWidth, showValue, groupWidth, stacking, legend, tooltip, text } = props;
return preparePlotConfigBuilder({
@@ -51,6 +51,7 @@ export const BarChart: React.FC<BarChartProps> = (props) => {
legend,
tooltip,
text,
allFrames: props.frames,
});
};

View File

@@ -105,6 +105,7 @@ describe('BarChart utils', () => {
timeZone: DefaultTimeZone,
getTimeRange: getDefaultTimeRange,
eventBus: new EventBusSrv(),
allFrames: [frame],
}).getConfig();
expect(result).toMatchSnapshot();
});
@@ -119,6 +120,7 @@ describe('BarChart utils', () => {
timeZone: DefaultTimeZone,
getTimeRange: getDefaultTimeRange,
eventBus: new EventBusSrv(),
allFrames: [frame],
}).getConfig()
).toMatchSnapshot();
});
@@ -133,6 +135,7 @@ describe('BarChart utils', () => {
timeZone: DefaultTimeZone,
getTimeRange: getDefaultTimeRange,
eventBus: new EventBusSrv(),
allFrames: [frame],
}).getConfig()
).toMatchSnapshot();
});

View File

@@ -35,7 +35,7 @@ export class TimelineChart extends React.Component<TimelineProps> {
static contextType = PanelContextRoot;
panelContext: PanelContext = {} as PanelContext;
prepConfig = (alignedFrame: DataFrame, getTimeRange: () => TimeRange) => {
prepConfig = (alignedFrame: DataFrame, allFrames: DataFrame[], getTimeRange: () => TimeRange) => {
this.panelContext = this.context as PanelContext;
const { eventBus } = this.panelContext;
@@ -43,6 +43,7 @@ export class TimelineChart extends React.Component<TimelineProps> {
frame: alignedFrame,
getTimeRange,
eventBus,
allFrames: this.props.frames,
...this.props,
// When there is only one row, use the full space