Skip to content

Commit e88218f

Browse files
authored
Fix heatmap first color being unused (#22158)
Backport #22157. vue3-calendar-heatmap has the behaviour that the first and second colors are mapped to values null and 0, meaning the second color was not used as intended for values > 0. I think this is a behaviour change from previous vue2 version that was missed during the upgrade. This change makes first and second values the same, so the heatmap can now use one additional color for meaningful values.
1 parent 4297ace commit e88218f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: web_src/js/components/ActivityHeatmap.vue

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default {
2828
},
2929
data: () => ({
3030
colorRange: [
31+
'var(--color-secondary-alpha-70)',
3132
'var(--color-secondary-alpha-70)',
3233
'var(--color-primary-light-4)',
3334
'var(--color-primary-light-2)',
@@ -50,6 +51,12 @@ export default {
5051
return s;
5152
}
5253
},
54+
mounted() {
55+
// work around issue with first legend color being rendered twice and legend cut off
56+
const legend = document.querySelector('.vch__external-legend-wrapper');
57+
legend.setAttribute('viewBox', '12 0 80 10');
58+
legend.style.marginRight = '-12px';
59+
},
5360
methods: {
5461
handleDayClick(e) {
5562
// Reset filter if same date is clicked

0 commit comments

Comments
 (0)