@@ -120,6 +120,20 @@ const pointer = computed(() => {
120120 }
121121});
122122
123+ const pointyPointerPath = computed (() => {
124+ const centerX = svg .value .width / 2 ;
125+ const centerY = svg .value .height * 0.69 ;
126+ const angle = Math .PI * ((activeRating .value + 0 - min .value ) / (max .value - min .value )) + Math .PI ;
127+ const tipX = centerX + (svg .value .width / 3.2 * gaugeConfig .value .style .chart .layout .pointer .size ) * Math .cos (angle);
128+ const tipY = centerY + (svg .value .width / 3.2 * gaugeConfig .value .style .chart .layout .pointer .size ) * Math .sin (angle);
129+ const baseLength = gaugeConfig .value .style .chart .layout .pointer .circle .radius ;
130+ const baseX1 = centerX + baseLength * Math .cos (angle + (Math .PI / 2 ));
131+ const baseY1 = centerY + baseLength * Math .sin (angle + (Math .PI / 2 ));
132+ const baseX2 = centerX + baseLength * Math .cos (angle - (Math .PI / 2 ));
133+ const baseY2 = centerY + baseLength * Math .sin (angle - (Math .PI / 2 ));
134+ return ` M ${ tipX} ,${ tipY} ${ baseX1} ,${ baseY1} ${ baseX2} ,${ baseY2} Z` ;
135+ })
136+
123137const ratingColor = computed (() => {
124138 for (let i = 0 ; i < mutableDataset .value .series .length ; i += 1 ) {
125139 const { color , from , to } = mutableDataset .value .series [i];
@@ -523,40 +537,51 @@ defineExpose({
523537 </text >
524538
525539 <!-- GAUGE POINTER -->
526- <line
527- data-cy =" gauge-pointer-border"
528- v-if =" !isNaN(pointer.x2)"
529- :x1 =" pointer.x1"
530- :y1 =" pointer.y1"
531- :x2 =" pointer.x2"
532- :y2 =" pointer.y2"
533- :stroke =" gaugeConfig.style.chart.layout.pointer.stroke"
534- :stroke-width =" gaugeConfig.style.chart.layout.pointer.strokeWidth"
535- stroke-linecap =" round"
536- />
537- <line
538- data-cy =" gauge-pointer"
539- v-if =" !isNaN(pointer.x2)"
540- :x1 =" pointer.x1"
541- :y1 =" pointer.y1"
542- :x2 =" pointer.x2"
543- :y2 =" pointer.y2"
544- :stroke =" gaugeConfig.style.chart.layout.pointer.useRatingColor ? ratingColor : gaugeConfig.style.chart.layout.pointer.color"
545- stroke-linecap =" round"
546- :stroke-width =" gaugeConfig.style.chart.layout.pointer.strokeWidth * 0.7"
547- />
548- <line
549- data-cy =" gauge-pointer"
550- v-if =" !isNaN(pointer.x2) && gaugeConfig.style.chart.layout.track.useGradient"
551- :x1 =" pointer.x1"
552- :y1 =" pointer.y1"
553- :x2 =" pointer.x2"
554- :y2 =" pointer.y2"
555- :stroke =" 'white'"
556- stroke-linecap =" round"
557- :stroke-width =" gaugeConfig.style.chart.layout.pointer.strokeWidth * 0.3"
558- :filter =" `url(#blur_${uid})`"
559- />
540+ <g v-if =" gaugeConfig.style.chart.layout.pointer.type === 'rounded'" >
541+ <line
542+ data-cy =" gauge-pointer-border"
543+ v-if =" !isNaN(pointer.x2)"
544+ :x1 =" pointer.x1"
545+ :y1 =" pointer.y1"
546+ :x2 =" pointer.x2"
547+ :y2 =" pointer.y2"
548+ :stroke =" gaugeConfig.style.chart.layout.pointer.stroke"
549+ :stroke-width =" gaugeConfig.style.chart.layout.pointer.strokeWidth"
550+ stroke-linecap =" round"
551+ />
552+ <line
553+ data-cy =" gauge-pointer"
554+ v-if =" !isNaN(pointer.x2)"
555+ :x1 =" pointer.x1"
556+ :y1 =" pointer.y1"
557+ :x2 =" pointer.x2"
558+ :y2 =" pointer.y2"
559+ :stroke =" gaugeConfig.style.chart.layout.pointer.useRatingColor ? ratingColor : gaugeConfig.style.chart.layout.pointer.color"
560+ stroke-linecap =" round"
561+ :stroke-width =" gaugeConfig.style.chart.layout.pointer.strokeWidth * 0.7"
562+ />
563+ <line
564+ data-cy =" gauge-pointer"
565+ v-if =" !isNaN(pointer.x2) && gaugeConfig.style.chart.layout.track.useGradient"
566+ :x1 =" pointer.x1"
567+ :y1 =" pointer.y1"
568+ :x2 =" pointer.x2"
569+ :y2 =" pointer.y2"
570+ :stroke =" 'white'"
571+ stroke-linecap =" round"
572+ :stroke-width =" gaugeConfig.style.chart.layout.pointer.strokeWidth * 0.3"
573+ :filter =" `url(#blur_${uid})`"
574+ />
575+ </g >
576+ <g v-else >
577+ <path
578+ :d =" pointyPointerPath"
579+ :fill =" gaugeConfig.style.chart.layout.pointer.useRatingColor ? ratingColor : gaugeConfig.style.chart.layout.pointer.color"
580+ :stroke =" gaugeConfig.style.chart.layout.pointer.stroke"
581+ :stroke-width =" gaugeConfig.style.chart.layout.pointer.circle.strokeWidth"
582+ stroke-linejoin =" round"
583+ />
584+ </g >
560585 <circle
561586 data-cy =" gauge-pointer-circle"
562587 :cx =" svg.width / 2"
0 commit comments