Skip to content

Commit b3d9388

Browse files
committed
Fix issue where wrong fields were using when grouping
1 parent 167a8b4 commit b3d9388

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/datasource.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class JsonDataSource extends DataSourceApi<JsonApiQuery, JsonApiDataSourc
179179

180180
const res = frames.map((frame) => ({
181181
...frame,
182-
fields: fields.map(
182+
fields: frame.fields.map(
183183
(field: Field): Field =>
184184
field.name === query.experimentalMetricField ? { ...field, config: { displayNameFromDS: frame.name } } : field
185185
),
@@ -223,17 +223,14 @@ export const groupBy = (frame: DataFrame, fieldName: string): DataFrame[] => {
223223
return [frame];
224224
}
225225

226-
const uniqueValues = new Set<string>(groupByField.values.toArray());
226+
const uniqueValues = new Set<string>(groupByField.values.toArray().map((value) => value.toString()));
227227

228228
const frames = [...uniqueValues].map((groupByValue) => {
229229
const fields: Field[] = frame.fields
230230
// Skip the field we're grouping on.
231-
.filter((field) => field.name !== groupByField.name)
231+
.filter((field) => field.name.toString() !== groupByField.name)
232232
.map((field) => ({
233233
...field,
234-
config: {
235-
// displayNameFromDS: groupByValue,
236-
},
237234
values: new ArrayVector(
238235
field.values.toArray().filter((_, idx) => {
239236
return groupByField.values.get(idx) === groupByValue;

0 commit comments

Comments
 (0)