Skip to content

Commit

Permalink
feat: #116 Addes period and Orgunit dimensions applied
Browse files Browse the repository at this point in the history
  • Loading branch information
redet-G committed Nov 21, 2024
1 parent 0eeb57c commit 62831c9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Components/SingleValueChart.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import Typography from "@mui/material/Typography";
import Legend from "./Legend";
import { MapContainer } from "react-leaflet";

const SingleValueChart = ({ chartData, componentRef, chartInfo }) => {
try {
Expand All @@ -10,6 +9,10 @@ const SingleValueChart = ({ chartData, componentRef, chartInfo }) => {
let textColor = "black";
let color = "primary";

const metadata = chartData?.metaData;
let orgunit = metadata?.dimensions?.ou?.map((ou) => metadata.items[ou]);
let period = metadata?.dimensions?.pe?.map((p) => metadata.items[p]);

if (chartInfo.legend?.strategy != "BY_DATA_ITEM") {
color = chartInfo?.legend?.set?.legends.find(
(leg) => value >= leg.startValue && value < leg.endValue
Expand Down Expand Up @@ -98,7 +101,10 @@ const SingleValueChart = ({ chartData, componentRef, chartInfo }) => {
}}
>
{text}
<Typography>{title}</Typography>
<Typography>
{title} - {period.map((p) => p.name).join(", ")} -{" "}
{orgunit.map((ou) => ou.name).join(", ")}
</Typography>
</div>
);
} catch (error) {
Expand Down

0 comments on commit 62831c9

Please sign in to comment.