11<script setup>
22import { ref , computed , onMounted } from " vue" ;
3- import { calcMarkerOffsetX , calcMarkerOffsetY , calcNutArrowPath , makeDonut , palette , convertColorToHex , opacity , makeXls , createUid } from ' ../lib' ;
3+ import { convertColorToHex , createUid } from ' ../lib' ;
44import pdf from " ../pdf" ;
55import img from " ../img" ;
66import mainConfig from " ../default_configs.json" ;
77import Title from " ../atoms/Title.vue" ;
88import { useNestedProp } from " ../useNestedProp" ;
99import UserOptions from " ../atoms/UserOptions.vue" ;
10- import DataTable from " ../atoms/DataTable.vue" ;
11- import Tooltip from " ../atoms/Tooltip.vue" ;
12- import Legend from " ../atoms/Legend.vue" ;
1310
1411const props = defineProps ({
1512 config: {
@@ -32,11 +29,7 @@ const defaultConfig = ref(mainConfig.vue_ui_3d_bar);
3229
3330const isPrinting = ref (false );
3431const isImaging = ref (false );
35- const bar3dChart = ref (null );
3632const details = ref (null );
37- const isTooltip = ref (false );
38- const tooltipContent = ref (" " );
39- const selectedSerie = ref (null );
4033
4134const barConfig = computed (() => {
4235 return useNestedProp ({
@@ -62,7 +55,11 @@ const box = computed(() => {
6255 right: ` M${ svg .value .width / 2 } ,${ svg .value .top } ${ svg .value .width - svg .value .right } , ${ svg .value .top + svg .value .perspective } ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } ${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom } ` ,
6356 left: ` M${ svg .value .width / 2 } ,${ svg .value .top } ${ svg .value .left } ,${ svg .value .top + svg .value .perspective } ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } ${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom } ` ,
6457 side: ` M${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom } ${ svg .value .width / 2 } ,${ svg .value .top + (svg .value .perspective * 2 )} ` ,
65- topSides: ` M${ svg .value .left } ,${ svg .value .top + svg .value .perspective } ${ svg .value .width / 2 } ,${ svg .value .top + (svg .value .perspective * 2 )} ${ svg .value .width - svg .value .right } ,${ svg .value .top + svg .value .perspective } `
58+ topSides: ` M${ svg .value .left } ,${ svg .value .top + svg .value .perspective } ${ svg .value .width / 2 } ,${ svg .value .top + (svg .value .perspective * 2 )} ${ svg .value .width - svg .value .right } ,${ svg .value .top + svg .value .perspective } ` ,
59+ tubeTop: ` M${ svg .value .left } ,${ svg .value .top + svg .value .perspective } C ${ svg .value .left } ,${ svg .value .top - (svg .value .perspective / 3 )} ${ svg .value .width - svg .value .right } ,${ svg .value .top - (svg .value .perspective / 3 )} ${ svg .value .width - svg .value .right } ,${ svg .value .top + svg .value .perspective } C ${ svg .value .width - svg .value .right } ,${ svg .value .top + (svg .value .perspective * 2.3 )} ${ svg .value .left } ,${ svg .value .top + (svg .value .perspective * 2.3 )} ${ svg .value .left } ,${ svg .value .top + svg .value .perspective } ` ,
60+ tubeLeft: ` M${ svg .value .left } ,${ svg .value .top + svg .value .perspective } ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } ` ,
61+ tubeRight: ` M${ svg .value .width - svg .value .right } ,${ svg .value .top + svg .value .perspective } ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } ` ,
62+ tubeBottom: ` M${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } C ${ svg .value .width - svg .value .right } ,${ svg .value .height } ${ svg .value .left } ,${ svg .value .height } ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } `
6663 }
6764});
6865
@@ -94,7 +91,18 @@ const fill = computed(() => {
9491 return {
9592 right: ` M${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom } ${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom - height * proportion} ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - svg .value .perspective - height * proportion} ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } Z` ,
9693 left: ` M${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom } ${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom - height * proportion} ${ svg .value .left } , ${ svg .value .height - svg .value .bottom - svg .value .perspective - height * proportion} ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } Z` ,
97- top: ` M${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom - height * proportion} ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - svg .value .perspective - height * proportion} ${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom - (svg .value .perspective * 2 ) - (height * proportion)} ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - svg .value .perspective - height * proportion} Z`
94+ top: ` M${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom - height * proportion} ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - svg .value .perspective - height * proportion} ${ svg .value .width / 2 } ,${ svg .value .height - svg .value .bottom - (svg .value .perspective * 2 ) - (height * proportion)} ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - svg .value .perspective - height * proportion} Z` ,
95+ tubeTop: ` M${ svg .value .left } ,${ svg .value .height - svg .value .bottom - height * proportion - svg .value .perspective } C ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - height * proportion - (svg .value .perspective * 2.5 )} ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - height * proportion - (svg .value .perspective * 2.5 )} ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - height * proportion - svg .value .perspective } C ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - height * proportion + svg .value .perspective / 2 } ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - height * proportion + svg .value .perspective / 2 } ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - height * proportion - svg .value .perspective } ` ,
96+ tubeBody: ` M
97+ ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - height * proportion - svg .value .perspective }
98+ C ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - height * proportion + svg .value .perspective / 2 }
99+ ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - height * proportion + svg .value .perspective / 2 }
100+ ${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .bottom - height * proportion - svg .value .perspective }
101+ L${ svg .value .width - svg .value .right } ,${ svg .value .height - svg .value .perspective * 1.5 }
102+ C
103+ ${ svg .value .width - svg .value .right } ,${ svg .value .height }
104+ ${ svg .value .left } ,${ svg .value .height }
105+ ${ svg .value .left } ,${ svg .value .height - svg .value .bottom - svg .value .perspective } Z`
98106 }
99107})
100108
@@ -201,6 +209,11 @@ defineExpose({
201209 <stop offset =" 0%" :stop-color =" `${convertColorToHex(barConfig.style.chart.backgroundColor)}00`" />
202210 <stop offset =" 100%" :stop-color =" `${barConfig.style.chart.bar.color}33`" />
203211 </radialGradient >
212+ <linearGradient :id =" `gradient_tube_body${uid}`" x1 =" 0%" y1 =" 0%" x2 =" 100%" y2 =" 0%" >
213+ <stop offset =" 0%" :stop-color =" `${barConfig.style.chart.bar.color}`" />
214+ <stop offset =" 75%" :stop-color =" `${convertColorToHex(barConfig.style.chart.backgroundColor)}00`" />
215+ <stop offset =" 100%" :stop-color =" `${barConfig.style.chart.bar.color}66`" />
216+ </linearGradient >
204217 </defs >
205218
206219 <text
@@ -214,17 +227,31 @@ defineExpose({
214227 >
215228 {{Number((isNaN(activeValue) ? 0 : activeValue).toFixed(barConfig.style.chart.dataLabel.rounding)).toLocaleString() }} %
216229 </text >
217-
218- <!-- BOX SKELETON -->
219- <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.right" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
220- <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.left" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
221- <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.side" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
222- <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.topSides" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
223-
224- <!-- FILL BOX -->
225- <path :d =" fill.right" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_right${uid})`" />
226- <path :d =" fill.left" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_left${uid})`" />
227- <path :d =" fill.top" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_top${uid})`" />
230+
231+
232+ <g v-if =" !barConfig.style.shape || barConfig.style.shape === 'bar'" >
233+ <!-- BOX SKELETON -->
234+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.right" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
235+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.left" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
236+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.side" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
237+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.topSides" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
238+
239+ <!-- FILL BOX -->
240+ <path :d =" fill.right" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_right${uid})`" />
241+ <path :d =" fill.left" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_left${uid})`" />
242+ <path :d =" fill.top" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_top${uid})`" />
243+ </g >
244+
245+ <g v-if =" barConfig.style.shape === 'tube'" >
246+ <!-- TUBE SKELETON -->
247+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.tubeTop" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
248+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.tubeLeft" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
249+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.tubeRight" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
250+ <path :stroke-dasharray =" barConfig.style.chart.box.strokeDasharray" :d =" box.tubeBottom" :stroke =" barConfig.style.chart.box.stroke" :stroke-width =" barConfig.style.chart.box.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" fill =" none" />
251+ <!-- FILL TUBE -->
252+ <path :d =" fill.tubeTop" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_top${uid})`" />
253+ <path :d =" fill.tubeBody" :stroke =" barConfig.style.chart.bar.stroke" :stroke-width =" barConfig.style.chart.bar.strokeWidth" stroke-linejoin =" round" stroke-linecap =" round" :fill =" `url(#gradient_tube_body${uid})`" />
254+ </g >
228255
229256 <slot name =" svg" :svg =" svg" />
230257 </svg >
0 commit comments