diff --git a/app/javascript/projects/analysis_panel.tsx b/app/javascript/projects/analysis_panel.tsx index 58206d0..778f16c 100644 --- a/app/javascript/projects/analysis_panel.tsx +++ b/app/javascript/projects/analysis_panel.tsx @@ -95,9 +95,10 @@ interface ChartLegendProps { chartData: ChartData | undefined sourceType: string props: TileGridProps | undefined + decimalPlaces: number } -const ChartLegend = ({ chartData, sourceType, props }: ChartLegendProps) => { +const ChartLegend = ({ chartData, sourceType, props, decimalPlaces }: ChartLegendProps) => { if (!chartData) { return null } @@ -127,7 +128,7 @@ const ChartLegend = ({ chartData, sourceType, props }: ChartLegendProps) => { () const [bins, setBins] = React.useState(10) const [colors, setColors] = React.useState(null) + const [decimalPlaces, setDecimalPlaces] = React.useState(2) let errorMsg: string = "" let showChart: boolean = false @@ -284,8 +286,9 @@ export const AnalysisPanel = ({ selectedArea, setSelectedArea, setShowAP, select chartType == "hist" && <> - + setBins(+e.target.value)} @@ -293,10 +296,25 @@ export const AnalysisPanel = ({ selectedArea, setSelectedArea, setShowAP, select /> } + { + data instanceof NumericTileGrid + && + <> + + setDecimalPlaces(+e.target.value)} + min={0} + /> + + }