Skip to content

Commit cfd916b

Browse files
committed
add heatmap radius picker
1 parent 903ee34 commit cfd916b

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/components/model/JunctionRadiusPicker.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,28 @@ type JunctionRadiusPickerProps = {
66
onChange: (value: number) => void;
77
min?: number;
88
max?: number;
9+
step? : number;
10+
text :string;
911
};
1012

1113
export const JunctionRadiusPicker: React.FC<JunctionRadiusPickerProps> = ({
1214
value,
1315
onChange,
1416
min = 20,
1517
max = 150,
18+
step = 10,
19+
text
1620
}) => {
1721
return (
1822
<Form.Group className="d-flex align-items-center gap-2 mb-0">
1923
<Form.Label className="fw-semibold mb-0">
20-
Junction radius (meters):
24+
{text}
2125
</Form.Label>
2226

2327
<Form.Range
2428
min={min}
2529
max={max}
26-
step={10}
30+
step={step}
2731
value={value}
2832
onChange={e => onChange(Number(e.target.value))}
2933
/>

src/components/model/ModelTabs.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const ModelTabs: React.FC<IProps> = () => {
3939

4040
const [activeTab, setActiveTab] = React.useState<'table' | 'map'>('table');
4141
const [junctionRadius, setJunctionRadius] = React.useState(50);
42+
const [heatmapRadius, setHeatmapRadius] = React.useState(100);
4243
const [severityMode, setSeverityMode] =
4344
React.useState<ModelSeverityMode>(1);
4445
const [filterType, setFilterType] =
@@ -48,8 +49,8 @@ const ModelTabs: React.FC<IProps> = () => {
4849

4950
// density
5051
const denstiyPoints = React.useMemo(
51-
() => calculateKernelDensity(dataAllInjuries, 100),
52-
[dataAllInjuries]
52+
() => calculateKernelDensity(dataAllInjuries, heatmapRadius),
53+
[dataAllInjuries, heatmapRadius]
5354
);
5455
const clusterTableDensity = React.useMemo(
5556
() => buildDensityClustersTable(denstiyPoints,filterType, maxClusters),
@@ -82,6 +83,15 @@ const ModelTabs: React.FC<IProps> = () => {
8283
<JunctionRadiusPicker
8384
value={junctionRadius}
8485
onChange={setJunctionRadius}
86+
text = "Junction radius"
87+
/>
88+
<JunctionRadiusPicker
89+
value={heatmapRadius}
90+
onChange={setHeatmapRadius}
91+
text = {"heatmap radius"}
92+
min = {100}
93+
max = {200}
94+
step = {50}
8595
/>
8696

8797
<SeverityModePicker

0 commit comments

Comments
 (0)