File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
lib/components/data-vis/line-chart
wrappers/components/data-vis/line-chart Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 157
157
slatePurple: " #64587C" ,
158
158
});
159
159
160
- const lineColorMap = Object .fromEntries (
161
- lineChartData .lines .map ((line , index ) => [
162
- line .areaCode ,
163
- Object .values (colors)[index % Object .values (colors).length ],
164
- ]),
165
- );
160
+ const colorValues = Object .values (colors);
161
+
162
+ const lineColorMap = {};
163
+
164
+ Object .entries (tieredLineParams).forEach (([tier , tierParams ]) => {
165
+ const tierLines = lineChartData .lines .filter ((line ) => getLine (tier, line));
166
+ let colorIndex = 0 ;
167
+
168
+ tierLines .forEach ((line ) => {
169
+ const id = line .areaCode ;
170
+ if (! (id in lineColorMap)) {
171
+ lineColorMap[id] = colorValues[colorIndex % colorValues .length ];
172
+ colorIndex++ ;
173
+ }
174
+ });
175
+ });
166
176
167
177
let defaultLineParams = $derived ({
168
178
xFunction,
Original file line number Diff line number Diff line change 616
616
primary: {
617
617
halo: true ,
618
618
pathStrokeWidth: 5 ,
619
- pathStrokeColor: colors .darkgrey ,
620
619
interactiveLines: true ,
621
620
lineEnding: null ,
622
621
markers: true ,
623
622
interactiveMarkers: true ,
624
623
},
625
624
clicked: {
626
- pathStrokeColor: colors .ochre ,
625
+ pathStrokeColor: clickedTier === " secondary " ? colors .ashGrey : null ,
627
626
pathStrokeWidth: 7 ,
628
627
halo: true ,
629
628
interactiveLines: false ,
632
631
lineEnding: null ,
633
632
},
634
633
hover: {
635
- pathStrokeColor: colors .ochre ,
634
+ pathStrokeColor: hoveredTier === " secondary " ? colors .ashGrey : null ,
636
635
pathStrokeWidth: 6 ,
637
636
halo: true ,
638
637
interactiveLines: false ,
You can’t perform that action at this time.
0 commit comments