File tree Expand file tree Collapse file tree 2 files changed +25
-10
lines changed
src/lib/components/data-vis Expand file tree Collapse file tree 2 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 116
116
promoteProperty = " LSOA21CD" ,
117
117
clickedArea = $bindable ([]),
118
118
areaToColorLookup,
119
+ hoveredArea = $bindable (),
119
120
}: {
120
121
data? : object [];
121
122
countries? : string [];
196
197
promoteProperty? : string ;
197
198
clickedArea? : [];
198
199
areaToColorLookup? : object ;
200
+ hoveredArea? : string ;
199
201
} = $props ();
200
202
201
203
// ISO-3166/ONS-style prefixes for area codes
406
408
geoSource === " file" ? joinData (filteredGeoJsonData , dataWithColor ) : null ,
407
409
);
408
410
409
- let hoveredArea = $state ();
410
411
let hoveredAreaArray = $derived (hoveredArea ? [hoveredArea ] : []);
411
412
let hoveredAreaData = $state ();
412
413
let currentMousePosition = $state ();
413
414
414
- $inspect (clickedArea , hoveredAreaArray );
415
-
416
415
function convertToLngLatBounds(coords : LngLatBoundsLike ): LngLatBoundsLike {
417
416
const bounds = new LngLatBounds (coords [0 ], coords [0 ]);
418
417
489
488
map ?.setMaxBounds (undefined );
490
489
}
491
490
});
492
- $inspect ( clickedArea );
491
+
493
492
let paintObject = $derived (
494
493
clickedArea ?.length > 0
495
494
? {
Original file line number Diff line number Diff line change 15
15
16
16
const range = Array .from ({ length: 10 }, (_ , i ) => i);
17
17
18
+ $inspect (value, " what is it" );
19
+
18
20
// the 'chart' is the bar and the marker - its height is a prop and its width is binded to clientWidth
19
21
20
22
// the 'marker' is the circle
67
69
fill ={colorScale [number ]}
68
70
></rect ></g
69
71
>{/each }
70
- <g
71
- transform ="translate( {xFunction (value ) + markerRadius }, {chartHeight /
72
- 2 })"
73
- ><circle r ={markerRadius } cx =" 0" cy =" 0" fill =" #CA357C" stroke =" white"
74
- ></circle ></g
75
- >
72
+ {console .log (value , typeof value )}
73
+ {#if typeof value === " number" }
74
+ <g
75
+ transform ="translate( {xFunction (value ) + markerRadius }, {chartHeight /
76
+ 2 })"
77
+ >
78
+ <circle r ={markerRadius } cx =" 0" cy =" 0" fill =" #CA357C" stroke =" white"
79
+ ></circle ></g
80
+ >
81
+ {:else }
82
+ {#each value as rowValue , i }
83
+ <g
84
+ transform ="translate( {xFunction (rowValue ) +
85
+ markerRadius }, {chartHeight / 2 })"
86
+ >
87
+ <circle r ={markerRadius } cx =" 0" cy =" 0" fill =" #CA357C" stroke =" white"
88
+ ></circle >
89
+ </g >
90
+ {/each }
91
+ {/if }
76
92
</svg >
77
93
</div >
78
94
You can’t perform that action at this time.
0 commit comments