Skip to content

Commit 25e5225

Browse files
committed
VueUiGauge improved gradient
1 parent c7fac10 commit 25e5225

File tree

6 files changed

+37
-12
lines changed

6 files changed

+37
-12
lines changed

package-lock.json

Lines changed: 2 additions & 3 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": "2.0.86",
4+
"version": "2.0.87",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4823,7 +4823,7 @@ function selectBar(bar) {
48234823
</template>
48244824
</Box>
48254825

4826-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_gauge)">
4826+
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_gauge)">
48274827
<template #title>
48284828
<BaseIcon name="chartGauge"/>
48294829
VueUiGauge

src/components/vue-ui-gauge.vue

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ defineExpose({
402402
</radialGradient>
403403
</defs>
404404

405+
<defs>
406+
<filter :id="`blur_${uid}`" x="-50%" y="-50%" width="200%" height="200%">
407+
<feGaussianBlur in="SourceGraphic" :stdDeviation="100 / gaugeConfig.style.chart.layout.track.gradientIntensity"/>
408+
<feColorMatrix type="saturate" values="0" />
409+
</filter>
410+
</defs>
411+
405412
<!-- TITLE AS G -->
406413
<g v-if="gaugeConfig.style.chart.title.text && mutableConfig.inside && !isPrinting">
407414
<text
@@ -452,12 +459,19 @@ defineExpose({
452459
stroke-linecap="round"
453460
:stroke-width="(svg.width / 16) * gaugeConfig.style.chart.layout.track.size"
454461
/>
455-
462+
456463
<!-- GRADIENT -->
457-
<g v-if="gaugeConfig.style.chart.layout.track.useGradient">
458-
<circle :cx="svg.width / 2" :cy="svg.height * 0.69" r="225" :fill="`url(#gradient_${uid})`" stroke="none"/>
459-
<circle :cx="svg.width / 2" :cy="svg.height * 0.69 + 4" :r="188 * 1 / gaugeConfig.style.chart.layout.track.size" :fill="gaugeConfig.style.chart.backgroundColor" stroke="none"/>
460-
<rect :x="0" :y="svg.height * 0.69" :width="svg.width" :height="svg.height - svg.height * 0.69" :fill="gaugeConfig.style.chart.backgroundColor" stroke="none"/>
464+
<g v-if="gaugeConfig.style.chart.layout.track.useGradient">
465+
<path
466+
v-for="(arc, i) in makeDonut(mutableDataset, svg.width / 2, svg.height * 0.7, svg.width / 2.5, svg.width / 2.5)"
467+
:key="`arc_${i}`"
468+
:d="arc.path"
469+
fill="none"
470+
:stroke="'white'"
471+
stroke-linecap="round"
472+
:stroke-width="(svg.width / 64) * gaugeConfig.style.chart.layout.track.size"
473+
:filter="`url(#blur_${uid})`"
474+
/>
461475
</g>
462476

463477
<!-- STEP MARKERS -->
@@ -527,6 +541,18 @@ defineExpose({
527541
stroke-linecap="round"
528542
:stroke-width="gaugeConfig.style.chart.layout.pointer.strokeWidth * 0.7"
529543
/>
544+
<line
545+
data-cy="gauge-pointer"
546+
v-if="!isNaN(pointer.x2) && gaugeConfig.style.chart.layout.track.useGradient"
547+
:x1="pointer.x1"
548+
:y1="pointer.y1"
549+
:x2="pointer.x2"
550+
:y2="pointer.y2"
551+
:stroke="'white'"
552+
stroke-linecap="round"
553+
:stroke-width="gaugeConfig.style.chart.layout.pointer.strokeWidth * 0.3"
554+
:filter="`url(#blur_${uid})`"
555+
/>
530556
<circle
531557
data-cy="gauge-pointer-circle"
532558
:cx="svg.width / 2"

src/components/vue-ui-waffle.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ defineExpose({
594594
<!-- RECTS -->
595595
<defs>
596596
<filter :id="`blur_${uid}`" x="-50%" y="-50%" width="200%" height="200%">
597-
<feGaussianBlur in="SourceGraphic" :stdDeviation="5" :id="`blur_std_${uid}`" />
597+
<feGaussianBlur in="SourceGraphic" :stdDeviation="5" />
598598
<feColorMatrix type="saturate" values="0" />
599599
</filter>
600600
</defs>

src/default_configs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@
961961
"track": {
962962
"size": 1,
963963
"useGradient": true,
964-
"gradientIntensity": 40
964+
"gradientIntensity": 20
965965
},
966966
"markers": {
967967
"size": 1,

0 commit comments

Comments
 (0)