Skip to content

Commit

Permalink
feat: Enable geoDimensions in pie chart segment initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Sep 30, 2022
1 parent cda9909 commit 4f14969
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/charts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ export const getInitialConfig = ({
},
};
case "pie":
const segmentComponent =
getCategoricalDimensions(dimensions)[0] ||
getGeoDimensions(dimensions)[0];

return {
version: CHART_CONFIG_VERSION,
chartType,
Expand All @@ -232,12 +236,12 @@ export const getInitialConfig = ({
fields: {
y: { componentIri: measures[0].iri },
segment: {
componentIri: getCategoricalDimensions(dimensions)[0].iri,
componentIri: segmentComponent.iri,
palette: DEFAULT_PALETTE,
sorting: { sortingType: "byMeasure", sortingOrder: "asc" },
colorMapping: mapValueIrisToColor({
palette: DEFAULT_PALETTE,
dimensionValues: getCategoricalDimensions(dimensions)[0]?.values,
dimensionValues: segmentComponent.values,
}),
},
},
Expand Down

0 comments on commit 4f14969

Please sign in to comment.