|
1 | 1 | <script setup>
|
2 | 2 | import { ref, computed, onMounted, nextTick, watch } from "vue";
|
3 |
| -import { palette, createUid, giftWrap, shiftHue, opacity, convertColorToHex, createCsvContent, downloadCsv } from "../lib"; |
| 3 | +import { palette, createUid, giftWrap, shiftHue, opacity, convertColorToHex, createCsvContent, downloadCsv, adaptColorToBackground } from "../lib"; |
4 | 4 | import pdf from "../pdf.js";
|
5 | 5 | import img from "../img.js";
|
6 | 6 | import mainConfig from "../default_configs.json";
|
@@ -818,36 +818,52 @@ defineExpose({
|
818 | 818 | </g>
|
819 | 819 |
|
820 | 820 | <!-- PLOTS -->
|
821 |
| - <g v-for="category in drawableDataset"> |
822 |
| - <Shape |
823 |
| - v-for="plot in category.series" |
824 |
| - :color="category.color" |
825 |
| - :isSelected="hoveredPlotId && plot.uid === hoveredPlotId" |
826 |
| - :plot="plot" |
827 |
| - :radius="quadrantConfig.style.chart.layout.plots.radius" |
828 |
| - :shape="category.shape" |
829 |
| - :stroke="quadrantConfig.style.chart.layout.plots.outline ? quadrantConfig.style.chart.layout.plots.outlineColor : 'none'" |
830 |
| - :strokeWidth="quadrantConfig.style.chart.layout.plots.outlineWidth" |
831 |
| - @mouseover="hoverPlot(category, plot)" |
832 |
| - @mouseleave="isTooltip = false; hoveredPlotId = null; hoveredPlot = null" |
833 |
| - @click="selectPlot(category, plot)" |
834 |
| - /> |
835 |
| - </g> |
836 |
| - |
837 |
| - <g v-if="mutableConfig.plotLabels.show"> |
| 821 | + <template v-if="!quadrantConfig.style.chart.layout.labels.plotLabels.showAsTag"> |
838 | 822 | <g v-for="category in drawableDataset">
|
839 |
| - <text |
840 |
| - v-for="plot in category.series" |
841 |
| - :x="plot.x" |
842 |
| - :y="plot.y + quadrantConfig.style.chart.layout.labels.plotLabels.offsetY + quadrantConfig.style.chart.layout.plots.radius" |
843 |
| - text-anchor="middle" |
844 |
| - :font-size="quadrantConfig.style.chart.layout.labels.plotLabels.fontSize" |
845 |
| - :fill="quadrantConfig.style.chart.layout.labels.plotLabels.color" |
846 |
| - > |
847 |
| - {{ plot.name }} |
848 |
| - </text> |
| 823 | + <Shape |
| 824 | + v-for="plot in category.series" |
| 825 | + :color="category.color" |
| 826 | + :isSelected="hoveredPlotId && plot.uid === hoveredPlotId" |
| 827 | + :plot="plot" |
| 828 | + :radius="quadrantConfig.style.chart.layout.plots.radius" |
| 829 | + :shape="category.shape" |
| 830 | + :stroke="quadrantConfig.style.chart.layout.plots.outline ? quadrantConfig.style.chart.layout.plots.outlineColor : 'none'" |
| 831 | + :strokeWidth="quadrantConfig.style.chart.layout.plots.outlineWidth" |
| 832 | + @mouseover="hoverPlot(category, plot)" |
| 833 | + @mouseleave="isTooltip = false; hoveredPlotId = null; hoveredPlot = null" |
| 834 | + @click="selectPlot(category, plot)" |
| 835 | + /> |
849 | 836 | </g>
|
850 |
| - </g> |
| 837 | + |
| 838 | + <g v-if="mutableConfig.plotLabels.show"> |
| 839 | + <g v-for="category in drawableDataset"> |
| 840 | + <text |
| 841 | + v-for="plot in category.series" |
| 842 | + :x="plot.x" |
| 843 | + :y="plot.y + quadrantConfig.style.chart.layout.labels.plotLabels.offsetY + quadrantConfig.style.chart.layout.plots.radius" |
| 844 | + text-anchor="middle" |
| 845 | + :font-size="quadrantConfig.style.chart.layout.labels.plotLabels.fontSize" |
| 846 | + :fill="quadrantConfig.style.chart.layout.labels.plotLabels.color" |
| 847 | + > |
| 848 | + {{ plot.name }} |
| 849 | + </text> |
| 850 | + </g> |
| 851 | + </g> |
| 852 | + </template> |
| 853 | + |
| 854 | + <template v-else> |
| 855 | + <g v-if="mutableConfig.plotLabels.show"> |
| 856 | + <template v-for="category in drawableDataset"> |
| 857 | + <foreignObject v-for="plot in category.series" style="overflow: visible;" height="10" width="100" :x="plot.x - 50" :y="plot.y - (quadrantConfig.style.chart.layout.labels.plotLabels.fontSize)" @mouseover="hoverPlot(category, plot)" |
| 858 | + @mouseleave="isTooltip = false; hoveredPlotId = null; hoveredPlot = null" |
| 859 | + @click="selectPlot(category, plot)"> |
| 860 | + <div :style="`color:${adaptColorToBackground(category.color)};margin: 0 auto; font-size:${quadrantConfig.style.chart.layout.labels.plotLabels.fontSize}px; text-align:center;background:${category.color}; padding: 2px 4px; border-radius: 12px; height: ${quadrantConfig.style.chart.layout.labels.plotLabels.fontSize*1.5}px`"> |
| 861 | + {{ plot.name }} |
| 862 | + </div> |
| 863 | + </foreignObject> |
| 864 | + </template> |
| 865 | + </g> |
| 866 | + </template> |
851 | 867 |
|
852 | 868 | <!-- LEGEND AS G -->
|
853 | 869 | <foreignObject
|
|
0 commit comments