diff --git a/app/components/Chart/PatternSlot.vue b/app/components/Chart/PatternSlot.vue new file mode 100644 index 0000000000..ed0ae0a1fe --- /dev/null +++ b/app/components/Chart/PatternSlot.vue @@ -0,0 +1,32 @@ + + + diff --git a/app/components/Compare/FacetBarChart.vue b/app/components/Compare/FacetBarChart.vue index 1e28d23db2..4b0322fd32 100644 --- a/app/components/Compare/FacetBarChart.vue +++ b/app/components/Compare/FacetBarChart.vue @@ -3,7 +3,9 @@ import { ref, computed } from 'vue' import { VueUiHorizontalBar } from 'vue-data-ui/vue-ui-horizontal-bar' import type { VueUiHorizontalBarConfig, VueUiHorizontalBarDatasetItem } from 'vue-data-ui' import { getFrameworkColor, isListedFramework } from '~/utils/frameworks' +import { createChartPatternSlotMarkup } from '~/utils/charts' import { drawSmallNpmxLogoAndTaglineWatermark } from '~/composables/useChartWatermark' + import { loadFile, insertLineBreaks, @@ -213,13 +215,40 @@ const config = computed(() => { backdropFilter: false, backgroundColor: 'transparent', customFormat: ({ datapoint }) => { - const name = datapoint?.name?.replace(/\n/g, '
') + const name = datapoint?.name?.replace(/\n/g, '
') ?? '' + const safeSeriesIndex = (datapoint?.absoluteIndex as number) ?? 0 + const patternId = `tooltip-pattern-${safeSeriesIndex}` + const usePattern = safeSeriesIndex !== 0 + + const patternMarkup = usePattern + ? createChartPatternSlotMarkup({ + id: patternId, + seed: safeSeriesIndex, + foregroundColor: colors.value.bg!, + fallbackColor: 'transparent', + maxSize: 24, + minSize: 16, + }) + : '' + + const markerMarkup = usePattern + ? ` + + + ` + : ` + + ` + return `
- - +
@@ -230,7 +259,7 @@ const config = computed(() => {
- ` + ` }, }, }, @@ -243,8 +272,19 @@ const config = computed(() => {
+ + + + + +