Skip to content

Commit

Permalink
Merge pull request #814 from CodeForAfrica/feat/linechart_hurumap_pac…
Browse files Browse the repository at this point in the history
…kage

@hurumap/LineChart
  • Loading branch information
m453h committed Aug 2, 2024
2 parents 182983e + 6275a3f commit fe3bd0f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 596 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Scope } from "@hurumap/core";

import LineChartScope from "./LineChartScope";
import MultiLineChartScope from "./MultiLineChartScope";
import StackedChartScope from "./StackedChartScope";
import TreemapChartScope from "./TreemapChartScope";
Expand All @@ -10,7 +9,7 @@ import VerticalStackedChartScope from "./VerticalStackedChartScope";
import { hurumapArgs } from "@/climatemappedafrica/config";
import theme from "@/climatemappedafrica/theme";

const { BarChartScope, DonutChartScope } = Scope;
const { BarChartScope, LineChartScope, DonutChartScope } = Scope;

export default function configureScope(
indicator,
Expand All @@ -30,6 +29,7 @@ export default function configureScope(

let vegaSpec;
const chartType = configuration?.chart_type?.toLowerCase();

/**
* @deprecated Use scopeOptions for implementing new charts
* This will be completely removed once all charts scopes
Expand All @@ -47,6 +47,7 @@ export default function configureScope(
isCompare,
isMobile,
];

const scopeOptions = {
primaryData: indicator?.data,
metadata: indicator?.metadata,
Expand All @@ -60,12 +61,13 @@ export default function configureScope(
theme,
args: hurumapArgs,
};

switch (chartType) {
case "line":
if (configuration?.stacked_field) {
vegaSpec = MultiLineChartScope(..._scopeOptions);
} else {
vegaSpec = LineChartScope(..._scopeOptions);
vegaSpec = LineChartScope(scopeOptions);
}
break;
case "donut":
Expand Down
Loading

0 comments on commit fe3bd0f

Please sign in to comment.