300300 </g >
301301
302302 <!-- X LABELS BAR -->
303- <g v-if =" chartConfig.bar.labels.show && mutableConfig.dataLabels.show" >
303+ <g v-if =" ( chartConfig.bar.labels.show || chartConfig.bar.serieName.show) && mutableConfig.dataLabels.show" >
304304 <g v-for =" (serie, i) in barSet" :key =" `xLabel_bar_${i}`" :class =" `xLabel_bar_${i}`" >
305305 <g v-for =" (plot, j) in serie.plots" :key =" `xLabel_bar_${i}_${j}`" >
306306 <text
307307 :data-cy =" `xy-bar-label-x-${i}-${j}`"
308- v-if =" !Object.hasOwn(serie, 'dataLabels') || serie.dataLabels === true"
308+ v-if =" ( !Object.hasOwn(serie, 'dataLabels') || serie.dataLabels === true) && chartConfig.bar.labels.show "
309309 :x =" plot.x + calcRectWidth() * 1.1"
310310 :y =" plot.y + (plot.value > 0 ? chartConfig.bar.labels.offsetY : - chartConfig.bar.labels.offsetY * 3)"
311311 text-anchor =" middle"
314314 >
315315 {{ canShowValue(plot.value) ? dataLabel({p:chartConfig.chart.labels.prefix, v: plot.value, s: chartConfig.chart.labels.suffix, r: chartConfig.bar.labels.rounding}) : '' }}
316316 </text >
317+ <text
318+ v-if =" chartConfig.bar.serieName.show"
319+ :x =" plot.x + calcRectWidth() * 1.1"
320+ :y =" plot.y + (plot.value > 0 ? chartConfig.bar.serieName.offsetY : - chartConfig.bar.serieName.offsetY * 3)"
321+ text-anchor =" middle"
322+ :font-size =" chartConfig.chart.labels.fontSize"
323+ :fill =" chartConfig.bar.serieName.useSerieColor ? serie.color : chartConfig.bar.serieName.color"
324+ :font-weight =" chartConfig.bar.serieName.bold ? 'bold' : 'normal'"
325+ >
326+ {{ chartConfig.bar.serieName.useAbbreviation ? abbreviate({ source: serie.name, length: chartConfig.bar.serieName.abbreviationSize}) : serie.name }}
327+ </text >
317328 </g >
318329 </g >
319330 </g >
593604 </svg >
594605
595606 <!-- SLICER -->
596- <div v-if =" chartConfig.chart.zoom.show" class =" vue-ui-xy-range-slider-wrapper" data-html2canvas-ignore style =" position :relative " >
607+ <div v-if =" chartConfig.chart.zoom.show && maxX > 6 " class =" vue-ui-xy-range-slider-wrapper" data-html2canvas-ignore style =" position :relative " >
597608 <div class =" vue-ui-xy-range-slider-label-left" data-cy-zoom-legend >
598609 {{ chartConfig.chart.grid.labels.xAxisLabels.values[slicer.start] }}
599610 </div >
600611 <div class =" vue-ui-xy-range-slider" >
601- <div class =" vue-ui-xy-slider-track" :id =" `vue-ui-slider-track_${uniqueId }`" ></div >
602- <input data-cy =" xy-range-start" :id =" `start_${uniqueId }`" type =" range" :style =" `border:none !important;accent-color:${chartConfig.chart.zoom.color}`" :min =" 0" :max =" maxX" v-model =" slicer.start" >
603- <input :id =" `end_${uniqueId }`" type =" range" :style =" `border:none !important;accent-color:${chartConfig.chart.zoom.color}`" :min =" 0" :max =" maxX" v-model =" slicer.end" >
612+ <div class =" vue-ui-xy-slider-track" :id =" `vue-ui-slider-track_${sliderId }`" ></div >
613+ <input data-cy =" xy-range-start" :id =" `start_${sliderId }`" type =" range" :style =" `border:none !important;accent-color:${chartConfig.chart.zoom.color}`" :min =" 0" :max =" maxX" v-model =" slicer.start" >
614+ <input :id =" `end_${sliderId }`" type =" range" :style =" `border:none !important;accent-color:${chartConfig.chart.zoom.color}`" :min =" 0" :max =" maxX" v-model =" slicer.end" >
604615
605616 </div >
606617 <div class =" vue-ui-xy-range-slider-label-right" data-cy-zoom-legend >
@@ -683,6 +694,7 @@ import pdf from '../pdf';
683694import img from " ../img" ;
684695import { useMouse } from ' ../useMouse' ;
685696import {
697+ abbreviate ,
686698 adaptColorToBackground ,
687699 calcLinearProgression ,
688700 calculateNiceScale ,
@@ -712,7 +724,7 @@ import Shape from "../atoms/Shape.vue";
712724import BaseIcon from ' ../atoms/BaseIcon.vue' ;
713725import TableSparkline from " ./vue-ui-table-sparkline.vue" ;
714726
715- const uid = createUid ();
727+ const sliderId = createUid ();
716728
717729export default {
718730 name: " vue-ui-xy" ,
@@ -740,7 +752,6 @@ export default {
740752 TableSparkline
741753},
742754 data (){
743- const uniqueId = uid;
744755 const maxX = Math .max (... this .dataset .map (datapoint => datapoint .series .length ));
745756 const slicer = {
746757 start: 0 ,
@@ -783,13 +794,14 @@ export default {
783794 selectedSerieIndex: null ,
784795 selectedRowIndex: null ,
785796 segregatedSeries: [],
786- uniqueId,
797+ uniqueId: createUid () ,
787798 step: 0 ,
788799 slicer,
789800 __to__: null ,
790801 maxX,
791802 showSparklineTable: true ,
792- segregateStep: 0
803+ segregateStep: 0 ,
804+ sliderId
793805 }
794806 },
795807 computed: {
@@ -837,6 +849,7 @@ export default {
837849 series: datapoint .series .map (d => {
838850 return this .isSafeValue (d) ? d : null
839851 }).slice (this .slicer .start , this .slicer .end ),
852+ color: this .convertColorToHex (datapoint .color ? datapoint .color : this .palette [i]),
840853 id: ` uniqueId_${ i} `
841854 }
842855 });
@@ -847,7 +860,6 @@ export default {
847860 ... datapoint,
848861 series: datapoint .series .map (plot => plot + this .relativeZero ),
849862 absoluteValues: datapoint .series ,
850- color: this .convertColorToHex (datapoint .color ? datapoint .color : this .palette [i]),
851863 }
852864 }).filter (s => ! this .segregatedSeries .includes (s .id ));
853865 },
@@ -893,7 +905,6 @@ export default {
893905 ... datapoint,
894906 series: datapoint .series .map (plot => plot + this .relativeZero ),
895907 absoluteValues: datapoint .series ,
896- color: this .convertColorToHex (datapoint .color ? datapoint .color : this .palette [i]),
897908 }
898909 })
899910 },
@@ -907,7 +918,7 @@ export default {
907918 y: this .drawingArea .bottom - (this .drawingArea .height * this .ratioToMax (plot)),
908919 value: datapoint .absoluteValues [j],
909920 }
910- })
921+ }),
911922 }
912923 })
913924 },
@@ -1225,11 +1236,11 @@ export default {
12251236
12261237 if (this .chartConfig .chart .zoom .show ) {
12271238 const vm = this ;
1228- const sliderOne = document .getElementById (` start_${ this .uniqueId } ` );
1229- const sliderTwo = document .getElementById (` end_${ this .uniqueId } ` );
1239+ const sliderOne = document .getElementById (` start_${ this .sliderId } ` );
1240+ const sliderTwo = document .getElementById (` end_${ this .sliderId } ` );
12301241
12311242 let minGap = 0 ;
1232- const sliderTrack = document .getElementById (` vue-ui-slider-track_${ this .uniqueId } ` );
1243+ const sliderTrack = document .getElementById (` vue-ui-slider-track_${ this .sliderId } ` );
12331244
12341245 sliderOne .addEventListener (" input" , slideOne);
12351246 sliderTwo .addEventListener (" input" , slideTwo);
@@ -1287,6 +1298,7 @@ export default {
12871298 }
12881299 },
12891300 methods: {
1301+ abbreviate,
12901302 calculateNiceScale,
12911303 checkNaN,
12921304 createSmoothPath,
@@ -1328,7 +1340,7 @@ export default {
13281340 start: 0 ,
13291341 end: Math .max (... this .dataset .map (datapoint => datapoint .series .length ))
13301342 }
1331- const sliderTrack = document .getElementById (` vue-ui-slider-track_${ this .uniqueId } ` );
1343+ const sliderTrack = document .getElementById (` vue-ui-slider-track_${ this .sliderId } ` );
13321344 sliderTrack .style .background = ` linear-gradient(to right, #dadae5 0% , #858585 100% , #858585 0%, #dadae5 100%)` ;
13331345 },
13341346 createCanvasArea (plots ) {
0 commit comments