GraphNG: flip logic so we can explicitly say the field types to keep (#33140)

This commit is contained in:
Ryan McKinley 2021-04-19 17:45:10 -07:00 committed by GitHub
parent 534614063a
commit 5f54f2dc00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -96,7 +96,7 @@ class UnthemedGraphNG extends React.Component<GraphNGProps, GraphNGState> {
return {
...state,
data: preparePlotData(frame, [FieldType.string]),
data: preparePlotData(frame, [FieldType.number]),
alignedDataFrame: frame,
seriesToDataFrameFieldIndexMap: frame.fields.map((f) => f.state!.origin!),
dimFields,

View File

@ -35,7 +35,7 @@ export function buildPlotConfig(props: PlotProps, plugins: Record<string, PlotPl
/** @internal */
export function preparePlotData(frame: DataFrame, ignoreFieldTypes?: FieldType[]): AlignedData {
export function preparePlotData(frame: DataFrame, keepFieldTypes?: FieldType[]): AlignedData {
const result: any[] = [];
const stackingGroups: Map<string, number[]> = new Map();
let seriesIndex = 0;
@ -57,7 +57,7 @@ export function preparePlotData(frame: DataFrame, ignoreFieldTypes?: FieldType[]
seriesIndex++;
continue;
}
if (ignoreFieldTypes && ignoreFieldTypes.indexOf(f.type) > -1) {
if (keepFieldTypes && keepFieldTypes.indexOf(f.type) < 0) {
continue;
}
collectStackingGroups(f, stackingGroups, seriesIndex);