@@ -36,36 +36,60 @@ const isTooltip = ref(false);
3636const tooltipContent = ref (" " );
3737
3838onMounted (() => {
39- const xLabelMin = document .getElementById (" xLabelMin" );
40- if (xLabelMin) {
41- const bboxXMin = xLabelMin .getBBox ();
42- const xPosition = bboxXMin .height / 2 + svg .value .padding * 0.6 ;
43- const yPosition = svg .value .centerY ;
44- xLabelMin .setAttributeNS (null , " transform" , ` rotate(-90, ${ xPosition} , ${ yPosition} )` );
45- xLabelMin .setAttributeNS (null , " x" , xPosition);
46- xLabelMin .setAttributeNS (null , " y" , yPosition);
47- }
48-
49- const xLabelMax = document .getElementById (" xLabelMax" );
50- if (xLabelMax) {
51- const bboxXMax = xLabelMax .getBBox ();
52- const xPosition = bboxXMax .height / 2 + svg .value .right ;
53- const yPosition = svg .value .centerY ;
54- xLabelMax .setAttributeNS (null , " transform" , ` rotate(90, ${ xPosition} , ${ yPosition} )` );
55- xLabelMax .setAttributeNS (null , " x" , xPosition);
56- xLabelMax .setAttributeNS (null , " y" , yPosition);
57- }
5839
59- const xLabelMaxName = document .getElementById (" xLabelMaxName" );
60- if (xLabelMaxName) {
61- const bboxXMaxName = xLabelMaxName .getBBox ();
62- const xPosition = bboxXMaxName .height / 2 + svg .value .right + svg .value .padding * 0.3 ;
63- const yPosition = svg .value .centerY ;
64- xLabelMaxName .setAttributeNS (null , " transform" , ` rotate(90, ${ xPosition} , ${ yPosition} )` );
65- xLabelMaxName .setAttributeNS (null , " x" , xPosition);
66- xLabelMaxName .setAttributeNS (null , " y" , yPosition);
67- }
40+ if (quadrantConfig .value .style .chart .layout .labels .axisLabels .show ) {
41+ const xmlns = " http://www.w3.org/2000/svg" ;
42+ const chart = document .getElementById (` svg_${ uid .value } ` );
43+
44+ const xLabelMinVisible = document .createElementNS (xmlns, ' text' );
45+ const xLabelMaxVisible = document .createElementNS (xmlns, ' text' );
46+ const xLabelMaxNameVisible = document .createElementNS (xmlns, " text" );
47+ const xLabelMin = document .getElementById (" xLabelMin" );
48+ const xLabelMax = document .getElementById (" xLabelMax" );
49+ const xLabelMaxName = document .getElementById (" xLabelMaxName" );
50+
51+ if (xLabelMin) {
52+ const bboxXMin = xLabelMin .getBBox ();
53+ const xPosition = bboxXMin .height / 2 + svg .value .padding * 0.6 ;
54+ const yPosition = svg .value .centerY ;
55+ xLabelMinVisible .setAttributeNS (null , " transform" , ` rotate(-90, ${ xPosition} , ${ yPosition} )` );
56+ xLabelMinVisible .setAttributeNS (null , " x" , xPosition);
57+ xLabelMinVisible .setAttributeNS (null , " y" , yPosition);
58+ xLabelMinVisible .innerHTML = axisValues .value .x .min ;
59+ xLabelMinVisible .setAttribute (" text-anchor" , " middle" );
60+ xLabelMinVisible .setAttribute (" fontSize" , quadrantConfig .value .style .chart .layout .labels .axisLabels .fontSize )
61+ xLabelMinVisible .setAttributeNS (null , " fill" , quadrantConfig .value .style .chart .layout .labels .axisLabels .color .negative )
62+ chart .appendChild (xLabelMinVisible);
63+ }
64+
65+ if (xLabelMax) {
66+ const bboxXMax = xLabelMax .getBBox ();
67+ const xPosition = bboxXMax .height / 2 + svg .value .right ;
68+ const yPosition = svg .value .centerY ;
69+ xLabelMaxVisible .setAttributeNS (null , " transform" , ` rotate(90, ${ xPosition} , ${ yPosition} )` );
70+ xLabelMaxVisible .setAttributeNS (null , " x" , xPosition);
71+ xLabelMaxVisible .setAttributeNS (null , " y" , yPosition);
72+ xLabelMaxVisible .innerHTML = axisValues .value .x .max ;
73+ xLabelMaxVisible .setAttribute (" text-anchor" , " middle" );
74+ xLabelMaxVisible .setAttribute (" fontSize" , quadrantConfig .value .style .chart .layout .labels .axisLabels .fontSize )
75+ xLabelMaxVisible .setAttributeNS (null , " fill" , quadrantConfig .value .style .chart .layout .labels .axisLabels .color .positive )
76+ chart .appendChild (xLabelMaxVisible);
77+ }
6878
79+ if (xLabelMaxName && quadrantConfig .value .style .chart .layout .grid .xAxis .name ) {
80+ const bboxXMaxName = xLabelMaxName .getBBox ();
81+ const xPosition = bboxXMaxName .height / 2 + svg .value .right + svg .value .padding * 0.3 ;
82+ const yPosition = svg .value .centerY ;
83+ xLabelMaxNameVisible .setAttributeNS (null , " transform" , ` rotate(90, ${ xPosition} , ${ yPosition} )` );
84+ xLabelMaxNameVisible .setAttributeNS (null , " x" , xPosition);
85+ xLabelMaxNameVisible .setAttributeNS (null , " y" , yPosition);
86+ xLabelMaxNameVisible .innerHTML = quadrantConfig .value .style .chart .layout .grid .xAxis .name ;
87+ xLabelMaxNameVisible .setAttribute (" text-anchor" , " middle" );
88+ xLabelMaxNameVisible .setAttribute (" fontSize" , quadrantConfig .value .style .chart .layout .labels .axisLabels .fontSize )
89+ xLabelMaxNameVisible .setAttributeNS (null , " fill" , quadrantConfig .value .style .chart .layout .labels .axisLabels .color .positive )
90+ chart .appendChild (xLabelMaxNameVisible);
91+ }
92+ }
6993});
7094
7195const tooltipPosition = computed (() => {
@@ -491,7 +515,7 @@ defineExpose({
491515 </details >
492516
493517 <!-- CHART -->
494- <svg :viewBox =" `0 0 ${svg.width} ${svg.height}`" :style =" `max-width:100%;overflow:visible;background:${quadrantConfig.style.chart.backgroundColor};color:${quadrantConfig.style.chart.color}`" @click =" closeDetails" >
518+ <svg :viewBox =" `0 0 ${svg.width} ${svg.height}`" :style =" `max-width:100%;overflow:visible;background:${quadrantConfig.style.chart.backgroundColor};color:${quadrantConfig.style.chart.color}`" @click =" closeDetails" :id = " `svg_${uid}` " >
495519
496520 <!-- DEFS -->
497521 <defs >
@@ -667,7 +691,7 @@ defineExpose({
667691 id =" xLabelMin"
668692 text-anchor =" middle"
669693 :font-size =" quadrantConfig.style.chart.layout.labels.axisLabels.fontSize"
670- : fill =" quadrantConfig.style.chart.layout.labels.axisLabels.color.negative "
694+ fill =" transparent "
671695 >
672696 {{ axisValues.x.min }}
673697 </text >
@@ -677,15 +701,15 @@ defineExpose({
677701 id =" xLabelMax"
678702 text-anchor =" middle"
679703 :font-size =" quadrantConfig.style.chart.layout.labels.axisLabels.fontSize"
680- : fill =" quadrantConfig.style.chart.layout.labels.axisLabels.color.positive "
704+ fill =" transparent "
681705 >
682706 {{ axisValues.x.max }}
683707 </text >
684708 <text
685709 id =" xLabelMaxName"
686710 text-anchor =" middle"
687711 :font-size =" quadrantConfig.style.chart.layout.labels.axisLabels.fontSize"
688- : fill =" quadrantConfig.style.chart.layout.labels.axisLabels.color.positive "
712+ fill =" transparent "
689713 >
690714 {{ quadrantConfig.style.chart.layout.grid.xAxis.name }}
691715 </text >
0 commit comments