File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
lib/components/data-vis/line-chart
routes/playground/create-a-reactive-line-chart/local-lib Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 18
18
labelClicked = $bindable (),
19
19
labelHovered = $bindable (),
20
20
lineHovered = $bindable (),
21
+ lineClicked = $bindable (),
21
22
chartHeight,
22
23
colors,
23
24
showAllData,
60
61
);
61
62
return {
62
63
... merged,
63
- dataId: line .areaCode , // should I just use areaCode in the component itself?
64
- dataArray: line .data , // should I just rename data in the original object so it's not repeated?
64
+ dataId: line .areaCode ,
65
+ dataArray: line .data , // rename in the original to avoid this
65
66
};
66
67
}
67
68
< / script>
109
110
110
111
< g>
111
112
{#each tieredDataObject[tier] as line, i}
112
- {#if (! lineHovered && tier === " primary" ) || (lineHovered && tier === " hover" )}
113
+ {#if tier == " hover" }
114
+ {console .log (line .areaCode == lineClicked)}
115
+ {/ if }
116
+ {#if (! lineHovered && tier === " primary" ) || [lineClicked, lineHovered].includes (line .areaCode )}
113
117
{@render categoryLabelSnippet (
114
118
line,
115
119
labelsPlaced .find ((el ) => el .datum .areaCode === line .areaCode ).y ,
Original file line number Diff line number Diff line change 92
92
93
93
function handleClickOutside (event ) {
94
94
if (
95
- (labelClicked || lineClicked) &&
96
- ! event .target .closest (' [id^="label"]' )
95
+ lineClicked != event . target . parentElement . dataset . id ||
96
+ (labelClicked && ! event .target .closest (' [id^="label"]' ) )
97
97
) {
98
98
labelClicked = null ;
99
99
lineClicked = null ;
175
175
},
176
176
hover: {
177
177
pathStrokeColor: colors .ochre ,
178
- pathStrokeWidth: 5 ,
178
+ pathStrokeWidth: lineClicked ? 8 : 5 ,
179
179
halo: true ,
180
180
},
181
181
});
285
285
bind: labelClicked
286
286
bind: labelHovered
287
287
bind: lineHovered
288
+ bind: lineClicked
288
289
{chartHeight}
289
290
{colorPalette}
290
291
{defaultLineParams}
You can’t perform that action at this time.
0 commit comments