Skip to content

Commit ff722a0

Browse files
committed
VueUiXy improved zoom
1 parent 1b56813 commit ff722a0

File tree

5 files changed

+48
-12
lines changed

5 files changed

+48
-12
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.79",
4+
"version": "1.9.80",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3885,6 +3885,7 @@ const moodRadarConfig = ref({
38853885
<BaseIcon name="circleCheck" stroke="#42d392" />
38863886
<BaseIcon name="circleExclamation" stroke="#42d392" />
38873887
<BaseIcon name="circleQuestion" stroke="#42d392" />
3888+
<BaseIcon name="refresh" stroke="#42d392" />
38883889

38893890
</div>
38903891
</template>

src/atoms/BaseIcon.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ const icons = computed(() => {
9494
circleCheck: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 10 A 1 1 0 0 0 19 10 A 1 1 0 0 0 1 10 M 5 10 L 9 14 M 15 7 L 9 14" />`,
9595
circleExclamation: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 10 A 1 1 0 0 0 19 10 A 1 1 0 0 0 1 10 M 10 5 L 10 10 M 10 13 A 1 1 0 0 0 10 15 A 1 1 0 0 0 10 13" />`,
9696
circleQuestion: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 10 A 1 1 0 0 0 19 10 A 1 1 0 0 0 1 10 M 10 5 C 14 5 14 10 10 10 M 10 13 A 1 1 0 0 0 10 15 A 1 1 0 0 0 10 13 M 7 7 C 7 6 8 5 10 5" />`,
97+
refresh: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 2 10 A 1 1 0 0 0 17 10 C 17 5 12 2 7 4 L 10 1 M 7 4 L 10 7" />`,
98+
9799
98100
}
99101
})

src/components/vue-ui-xy.vue

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@
592592
</svg>
593593

594594
<!-- SLICER -->
595-
<div v-if="chartConfig.chart.zoom.show" class="vue-ui-xy-range-slider-wrapper" data-html2canvas-ignore>
595+
<div v-if="chartConfig.chart.zoom.show" class="vue-ui-xy-range-slider-wrapper" data-html2canvas-ignore style="position:relative">
596596
<div class="vue-ui-xy-range-slider-label-left">
597597
{{ chartConfig.chart.grid.labels.xAxisLabels.values[slicer.start] }}
598598
</div>
@@ -605,6 +605,11 @@
605605
<div class="vue-ui-xy-range-slider-label-right">
606606
{{ chartConfig.chart.grid.labels.xAxisLabels.values[slicer.end-1] }}
607607
</div>
608+
<div v-if="slicer.start > 0 || slicer.end < maxX" style="position:absolute;right:0">
609+
<button tabindex="0" role="button" class="vue-ui-xy-refresh-button" @click="refreshSlicer">
610+
<BaseIcon name="refresh" :stroke="chartConfig.chart.color"/>
611+
</button>
612+
</div>
608613
</div>
609614

610615
<!-- LEGEND AS OUTSIDE DIV -->
@@ -693,6 +698,7 @@ import Title from '../atoms/Title.vue';
693698
import Tooltip from "../atoms/Tooltip.vue";
694699
import UserOptions from "../atoms/UserOptions.vue";
695700
import Shape from "../atoms/Shape.vue";
701+
import BaseIcon from '../atoms/BaseIcon.vue';
696702
697703
const uid = createUid();
698704
@@ -713,12 +719,13 @@ export default {
713719
}
714720
},
715721
components: {
716-
DataTable,
717-
Shape,
718-
Title,
719-
Tooltip,
720-
UserOptions,
721-
},
722+
DataTable,
723+
Shape,
724+
Title,
725+
Tooltip,
726+
UserOptions,
727+
BaseIcon
728+
},
722729
data(){
723730
const uniqueId = uid;
724731
const maxX = Math.max(...this.dataset.map(datapoint => datapoint.series.length));
@@ -1233,6 +1240,14 @@ export default {
12331240
createStar,
12341241
createPolygonPath,
12351242
/////////////////////////////// CANVAS /////////////////////////////////
1243+
refreshSlicer() {
1244+
this.slicer = {
1245+
start: 0,
1246+
end: Math.max(...this.dataset.map(datapoint => datapoint.series.length))
1247+
}
1248+
const sliderTrack = document.getElementById(`vue-ui-slider-track_${this.uniqueId}`);
1249+
sliderTrack.style.background = `linear-gradient(to right, #dadae5 0% , #858585 100% , #858585 0%, #dadae5 100%)`;
1250+
},
12361251
createCanvasArea(plots) {
12371252
const start = { x: plots[0].x, y: this.zero };
12381253
const end = { x: plots.at(-1).x, y: this.zero };
@@ -1918,7 +1933,7 @@ export default {
19181933
}
19191934
</script>
19201935
1921-
<style scoped>
1936+
<style scoped lang="scss">
19221937
.vue-ui-xy *{
19231938
transition: unset;
19241939
}
@@ -1989,6 +2004,7 @@ path, line, rect {
19892004
19902005
.vue-ui-xy-range-slider-wrapper {
19912006
width: 100%;
2007+
margin: 0 auto;
19922008
display: flex;
19932009
flex-direction: row;
19942010
gap: 6px;
@@ -1997,11 +2013,12 @@ path, line, rect {
19972013
.vue-ui-xy-range-slider {
19982014
position: relative;
19992015
width: 100%;
2016+
margin: 0 auto;
20002017
height: 12px;
20012018
}
20022019
.vue-ui-xy-range-slider-label-right,
20032020
.vue-ui-xy-range-slider-label-left {
2004-
width: 100px;
2021+
width: 100%;
20052022
}
20062023
20072024
.vue-ui-xy-range-slider-label-right {
@@ -2098,4 +2115,20 @@ canvas {
20982115
.vue-data-ui-wrapper-fullscreen {
20992116
overflow: scroll;
21002117
}
2118+
2119+
.vue-ui-xy-refresh-button {
2120+
outline: none;
2121+
border: none;
2122+
background: transparent;
2123+
height: 36px;
2124+
width: 36px;
2125+
display: flex;
2126+
align-items:center;
2127+
justify-content:center;
2128+
border-radius: 50%;
2129+
cursor: pointer;
2130+
&:focus {
2131+
outline: 1px solid #CCCCCC
2132+
}
2133+
}
21012134
</style>

0 commit comments

Comments
 (0)