Skip to content

Commit 584154a

Browse files
committed
VueUiXy show any xLabel on hover when showOnlyFirstAndLast is true
1 parent 3105d45 commit 584154a

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-data-ui",
33
"private": false,
4-
"version": "1.9.87",
4+
"version": "1.9.88",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3907,7 +3907,7 @@ const moodRadarConfig = ref({
39073907
</template>
39083908
</Box>
39093909

3910-
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_table_sparkline)">
3910+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_table_sparkline)">
39113911
<template #title>
39123912
<BaseIcon name="chartTable"/>
39133913
VueUiTableSparkline
@@ -4280,7 +4280,7 @@ const moodRadarConfig = ref({
42804280
</template>
42814281
</Box>
42824282

4283-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_xy)">
4283+
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_xy)">
42844284
<template #title>
42854285
<BaseIcon name="chartLine" />
42864286
VueUiXy

src/components/vue-ui-xy.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@
558558
<g v-for="(label, i) in timeLabels" :key="`time_label_${i}`">
559559
<text
560560
:data-cy="`xy-time-label-${i}`"
561-
v-if="(label && !chartConfig.chart.grid.labels.xAxisLabels.showOnlyFirstAndLast) || (label && chartConfig.chart.grid.labels.xAxisLabels.showOnlyFirstAndLast && (i === 0 || i === timeLabels.length -1))"
561+
v-if="(label && !chartConfig.chart.grid.labels.xAxisLabels.showOnlyFirstAndLast) || (label && chartConfig.chart.grid.labels.xAxisLabels.showOnlyFirstAndLast && (i === 0 || i === timeLabels.length -1)) || (label && chartConfig.chart.grid.labels.xAxisLabels.showOnlyFirstAndLast && selectedSerieIndex === i)"
562562
text-anchor="middle"
563563
:y="drawingArea.bottom + chartConfig.chart.grid.labels.xAxisLabels.fontSize * 1.3"
564564
:x="drawingArea.left + (drawingArea.width / maxSeries) * i + (drawingArea.width / maxSeries / 2)"

tests/lib.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
createStar,
2020
degreesToRadians,
2121
hslToRgb,
22+
interpolateColorHex,
2223
isSafeValue,
2324
isValidUserValue,
2425
makeDonut,
@@ -667,4 +668,20 @@ describe('niceNum', () => {
667668
expect(niceNum(1118, false)).toBe(2000)
668669
expect(niceNum(1118, 1)).toBe(1000)
669670
})
671+
})
672+
673+
describe('interpolateColorHex', () => {
674+
test('returns a color between two hex colors at a given range', () => {
675+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 0)).toBe('#0000ff')
676+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 10)).toBe('#1a00e6')
677+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 20)).toBe('#3300cc')
678+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 30)).toBe('#4d00b3')
679+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 40)).toBe('#660099')
680+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 50)).toBe('#800080')
681+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 60)).toBe('#990066')
682+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 70)).toBe('#b3004d')
683+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 80)).toBe('#cc0033')
684+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 90)).toBe('#e6001a')
685+
expect(interpolateColorHex("#0000FF", "#FF0000", 0, 100, 100)).toBe('#ff0000')
686+
})
670687
})

0 commit comments

Comments
 (0)