@@ -53,6 +53,8 @@ const safeDatasetCopy = ref(props.dataset.map((d, i ) => {
5353 }
5454}));
5555
56+ const isLoading = ref (true );
57+
5658onMounted (() => {
5759 if (objectIsEmpty (props .dataset )) {
5860 error ({
@@ -80,6 +82,7 @@ onMounted(() => {
8082 const chunkSet = props .dataset .map ((d , i ) => d .value / chunks);
8183 const total = props .dataset .map (d => d .value || 0 ).reduce ((a , b ) => a + b, 0 );
8284 let start = 0 ;
85+ isLoading .value = true ;
8386
8487 function animate () {
8588 start += (total / chunks);
@@ -93,6 +96,7 @@ onMounted(() => {
9396 });
9497 requestAnimationFrame (animate)
9598 } else {
99+ isLoading .value = false ;
96100 safeDatasetCopy .value = props .dataset .map ((d ,i ) => {
97101 return {
98102 ... d,
@@ -209,6 +213,7 @@ function selectDatapoint(datapoint, index) {
209213 :height =" svg.height"
210214 :width =" drawableDataset.map(ds => ds.width).reduce((a, b) => a + b, 0)"
211215 :fill =" stackConfig.style.bar.gradient.underlayerColor"
216+ :class =" {'animated': !isLoading}"
212217 />
213218 <rect
214219 v-for =" (rect, i) in drawableDataset" :key =" `stack_${i}`"
@@ -220,6 +225,7 @@ function selectDatapoint(datapoint, index) {
220225 :fill =" stackConfig.style.bar.gradient.show ? `url(#stack_gradient_${i}_${uid})` : rect.color"
221226 :stroke =" stackConfig.style.backgroundColor"
222227 stroke-linecap =" round"
228+ :class =" {'animated': !isLoading}"
223229 />
224230 </g >
225231 </svg >
@@ -247,6 +253,7 @@ function selectDatapoint(datapoint, index) {
247253 :style =" `font-size:${stackConfig.style.legend.fontSize}px;`"
248254 :class =" {'vue-ui-sparkstackbar-legend-item': true, 'vue-ui-sparkstackbar-legend-item-unselected': segregated.includes(i)}"
249255 @click =" segregate(i); selectDatapoint(rect, i)"
256+
250257 >
251258 <div style =" display :flex ;flex-direction :row ;align-items :center ;gap :4px ;justify-content :center " >
252259 <svg
@@ -297,7 +304,7 @@ function selectDatapoint(datapoint, index) {
297304.vue-ui-sparkstackbar-legend-item-unselected {
298305 opacity : 0.3 ;
299306}
300- rect {
307+ rect .animated {
301308 transition : all 0.3s ease-in-out !important ;
302309}
303310 </style >
0 commit comments