From 88bf4ae9536381cc30f2975864f9203a46651c06 Mon Sep 17 00:00:00 2001 From: Sanjeev Lakhwani Date: Thu, 29 Aug 2024 12:14:32 -0400 Subject: [PATCH 1/2] feat(charts): Added a chartclick event to BaseBarChart --- src/Components/Charts/BaseBarChart.tsx | 3 ++- src/types/chartTypes.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Components/Charts/BaseBarChart.tsx b/src/Components/Charts/BaseBarChart.tsx index f0d8bfa..efcf423 100644 --- a/src/Components/Charts/BaseBarChart.tsx +++ b/src/Components/Charts/BaseBarChart.tsx @@ -44,6 +44,7 @@ const BaseBarChart: React.FC = ({ units, title, onClick, + onChartClick, chartFill, otherFill, ...params @@ -78,7 +79,7 @@ const BaseBarChart: React.FC = ({
{title}
- + { From a68834f155c450529fe7e62ba13076d846b854b7 Mon Sep 17 00:00:00 2001 From: Sanjeev Lakhwani Date: Thu, 29 Aug 2024 12:27:33 -0400 Subject: [PATCH 2/2] test(charts): Added clickHandler logging to test barchart + histogram --- test/js/TestBarChart.tsx | 12 ++++++++++++ test/js/TestHistogram.tsx | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/test/js/TestBarChart.tsx b/test/js/TestBarChart.tsx index ea09578..d6291ab 100644 --- a/test/js/TestBarChart.tsx +++ b/test/js/TestBarChart.tsx @@ -26,6 +26,12 @@ const TestBarChart: React.FC = () => { height={sizeStateFixed.height} width={sizeStateFixed.width} colorTheme="new" + onClick={(f) => { + console.log('onClick', f); + }} + onChartClick={(f) => { + console.log('onChartClick', f); + }} /> @@ -40,6 +46,12 @@ const TestBarChart: React.FC = () => { units="management units" height={sizeStateResponsive.height} colorTheme="new" + onClick={(f) => { + console.log('onClick', f); + }} + onChartClick={(f) => { + console.log('onChartClick', f); + }} /> diff --git a/test/js/TestHistogram.tsx b/test/js/TestHistogram.tsx index 886c877..7d53088 100644 --- a/test/js/TestHistogram.tsx +++ b/test/js/TestHistogram.tsx @@ -25,6 +25,12 @@ const TestBarChart: React.FC = () => { units="management units" height={sizeStateFixed.height} width={sizeStateFixed.width} + onClick={(f) => { + console.log('onClick', f); + }} + onChartClick={(f) => { + console.log('onChartClick', f); + }} /> @@ -43,6 +49,12 @@ const TestBarChart: React.FC = () => { ]} units="management units" height={sizeStateResponsive.height} + onClick={(f) => { + console.log('onClick', f); + }} + onChartClick={(f) => { + console.log('onChartClick', f); + }} />