📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
(add) comments for ui/chart
kruzhambus70d0a88af1d6
diff --git a/src/ui/Chart.tsx b/src/ui/Chart.tsxindex 6914fbc84..a887dfa4a 100644--- a/src/ui/Chart.tsx+++ b/src/ui/Chart.tsx@@ -3,14 +3,18 @@ import bb from 'billboard.js'import 'billboard.js/dist/theme/datalab.css'import 'billboard.js/dist/billboard.css'+// Define the prop types for the componentinterface IChart {+ // (string): The ID of the chart container.current: string,+ // (object): The chart options.options: any,}const Chart = ({ current, options }: IChart): JSX.Element => {let chartInstance: any = {}+ // Destroy the chart instanceconst destroy = () => {if (chartInstance !== null) {try {@@ -23,6 +27,7 @@ const Chart = ({ current, options }: IChart): JSX.Element => {}}+ // Render the chartconst renderChart = () => {if (current !== null) {chartInstance = bb.generate({@@ -32,6 +37,7 @@ const Chart = ({ current, options }: IChart): JSX.Element => {}}+ // Render the chart on mountuseEffect(() => {renderChart()return destroy