Skip to content

Commit

Permalink
feat: #116 displays orgunit and period applied for gauge chart
Browse files Browse the repository at this point in the history
  • Loading branch information
redet-G committed Nov 21, 2024
1 parent 62831c9 commit ff3f85e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Components/DashboardItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,12 @@ function DashboardItem(props) {
if (chartType == "gauge" && chartData.rows[0] && chartData.rows[0][1]) {
const dataItem =
chartData.metaData.items[chartData.metaData.dimensions.dx]?.name;
const period =
chartData.metaData.items[chartData.metaData.dimensions.pe]?.name;
const orgunit =
chartData.metaData.items[chartData.metaData.dimensions.ou]?.name;
const period = chartData?.metaData?.dimensions?.pe?.map(
(pe) => chartData.metaData.items[pe]?.name
);
const orgunit = chartData?.metaData?.dimensions?.ou?.map(
(ou) => chartData.metaData.items[ou]?.name
);

const value = parseFloat(chartData.rows[0][1]);
const percent = value / 100;
Expand All @@ -885,7 +887,7 @@ function DashboardItem(props) {
<>
<GaugeChart
percent={percent}
nrOfLevels={30}
nrOfLevels={10}
needleBaseColor={needleColor}
needleColor={needleColor}
textColor="#000"
Expand All @@ -895,7 +897,7 @@ function DashboardItem(props) {
baseline={chartInfo.baseLineValue}
/>
<span align="center">
{dataItem} - {orgunit} - {period}
{dataItem} - {orgunit?.join(" , ")} - {period?.join(" , ")}
</span>
</>
);
Expand Down

0 comments on commit ff3f85e

Please sign in to comment.