@@ -37,8 +37,9 @@ import { useConfig } from "../useConfig";
3737import PackageVersion from " ../atoms/PackageVersion.vue" ;
3838import PenAndPaper from " ../atoms/PenAndPaper.vue" ;
3939import { useUserOptionState } from " ../useUserOptionState" ;
40+ import Shape from " ../atoms/Shape.vue" ;
4041
41- const { vue_ui_waffle: DEFAULT_CONFIG } = useConfig ()
42+ const { vue_ui_waffle: DEFAULT_CONFIG } = useConfig ();
4243
4344const props = defineProps ({
4445 config: {
@@ -57,12 +58,6 @@ const props = defineProps({
5758
5859const slots = useSlots ();
5960
60- onMounted (() => {
61- if (slots[' chart-background' ]) {
62- console .warn (' VueUiWaffle does not support the #chart-background slot.' )
63- }
64- });
65-
6661const isDataset = computed (() => {
6762 return !! props .dataset && props .dataset .length
6863});
@@ -554,7 +549,7 @@ function useTooltip(index) {
554549 let html = " " ;
555550
556551 html += ` <div data-cy="waffle-tooltip-name" style="width:100%;text-align:center;border-bottom:1px solid ${ FINAL_CONFIG .value .style .chart .tooltip .borderColor } ;padding-bottom:6px;margin-bottom:3px;">${ selected .name } </div>` ;
557- html += ` <div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12 " height="14" width="14"><rect data-cy="waffle-tooltip-marker" x="0" y="0" height="12 " width="12 " stroke="none" rx="1" fill="${ selected .color } " /></svg>` ;
552+ html += ` <div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 60 60 " height="14" width="14"><rect data-cy="waffle-tooltip-marker" x="0" y="0" height="60 " width="60 " stroke="none" rx="1" fill="${ selected .color } " />${ slots . pattern ? ` <rect x="0" y="0" height="60" width="60" stroke="none" rx="1" stroke="none" fill="url(#pattern_ ${ uid . value } _ ${ selected . absoluteIndex } )"/> ` : ' ' } </svg>` ;
558553 if (FINAL_CONFIG .value .style .chart .tooltip .showValue ) {
559554 html += ` <b data-cy="waffle-tooltip-value">${ applyDataLabel (
560555 FINAL_CONFIG .value .style .chart .layout .labels .dataLabels .formatter ,
@@ -866,6 +861,13 @@ defineExpose({
866861 />
867862
868863 <template v-else-if =" rects .length && ! FINAL_CONFIG .useCustomCells " >
864+
865+ <g v-if =" $slots.pattern" >
866+ <defs v-for =" ds in datasetCopyReference" >
867+ <slot name =" pattern" v-bind =" {seriesIndex: ds.absoluteIndex, patternId: `pattern_${uid}_${ds.absoluteIndex}`}" />
868+ </defs >
869+ </g >
870+
869871 <rect
870872 v-for =" (position, i) in positions"
871873 :data-cy =" `waffle-rect-underlayer-${i}`"
@@ -891,6 +893,20 @@ defineExpose({
891893 :stroke-width =" FINAL_CONFIG.style.chart.layout.rect.strokeWidth"
892894 :filter =" getBlurFilter(rects[i].serieIndex)"
893895 />
896+ <g v-if =" $slots.pattern" >
897+ <rect
898+ v-for =" (position, i) in positions"
899+ :rx =" FINAL_CONFIG.style.chart.layout.rect.rounded ? FINAL_CONFIG.style.chart.layout.rect.rounding : 0"
900+ :x =" position.x + FINAL_CONFIG.style.chart.layout.grid.spaceBetween / 2"
901+ :y =" position.y + FINAL_CONFIG.style.chart.layout.grid.spaceBetween / 2"
902+ :height =" rectDimensionY <= 0 ? 0.0001 : rectDimensionY"
903+ :width =" rectDimension <= 0 ? 0.0001 : rectDimension"
904+ :fill =" `url(#pattern_${uid}_${rects[i].absoluteIndex})`"
905+ stroke =" none"
906+ :filter =" getBlurFilter(rects[i].serieIndex)"
907+ />
908+
909+ </g >
894910 </template >
895911
896912 <!-- DATA LABELS -->
@@ -980,6 +996,16 @@ defineExpose({
980996 :config =" legendConfig"
981997 @clickMarker =" ({legend}) => segregate(legend.uid)"
982998 >
999+ <template #legend-pattern =" { legend , index } " v-if =" $slots .pattern " >
1000+ <Shape
1001+ :shape =" legend.shape"
1002+ :radius =" 30"
1003+ stroke =" none"
1004+ :plot =" { x: 30, y: 30}"
1005+ :fill =" `url(#pattern_${uid}_${index})`"
1006+ />
1007+ </template >
1008+
9831009 <template #item =" { legend } " >
9841010 <div @click =" legend.segregate()" :style =" `opacity:${segregated.includes(legend.uid) ? 0.5 : 1}`" >
9851011 {{ legend.name }}: {{ applyDataLabel(
0 commit comments