22import { computed , inject , useTemplateRef } from ' vue'
33import { oob_squish_any , emitEvent , dropNull } from ' #base/js/utils'
44import CoreText from ' ../element/CoreText.vue'
5+ import CoreMarkdown from ' ../element/CoreMarkdown.vue'
56const { coord , ticks , title , coord2pos , pos2coord , layout , theme , action , position , activeTransform , transition } = defineProps ({
67 coord: String ,
78 ticks: { type: Array , default : () => [] }, title: String ,
@@ -40,7 +41,8 @@ const axisTitle = computed(() => {
4041 dockX, dockY,
4142 fontSize: theme .title_size ,
4243 text: title,
43- ' fill' : theme .title_color ,
44+ fill: theme .title_color ,
45+ ' font-family' : " sans-serif" ,
4446 ... theme .title_style ,
4547 }
4648})
@@ -82,7 +84,7 @@ const tickTexts = computed(() => {
8284 let tsl = pos * (activeTransform .scaleH - 1 ) + activeTransform .translateH
8385 let position = pos + layout .l
8486 if (position + tsl < 0 || position + tsl > width .value ) continue
85- let offset = (isTop ? - 1 : 1 ) * ((tick .length ?? theme .tick_length ) + 3 )
87+ let offset = (isTop ? - 1 : 1 ) * ((tick .length ?? theme .tick_length ))
8688 let anchorX, anchorY, dockX, dockY
8789 if (theme .tick_anchor_x != null || theme .tick_anchor_y != null ) {
8890 anchorX = theme .tick_anchor_x ?? 0.5
@@ -105,7 +107,9 @@ const tickTexts = computed(() => {
105107 text: tick .label ,
106108 title: tick .title ?? tick .label ,
107109 fontSize: tick .size ?? theme .label_size ,
108- ' fill' : tick .color ?? theme .label_color
110+ fill: tick .color ?? theme .label_color ,
111+ ' font-family' : " sans-serif" ,
112+ ... theme .label_style ,
109113 },
110114 })
111115 }
@@ -305,7 +309,8 @@ const axisVOn = {
305309 < line ref= " i" : x1= " 0" : x2= " width" : y1= " 0" : y2= " 0" v- bind= " axisLine" / >
306310 < line v- for = " tick in tickLines" v- bind= " tick" / >
307311 < g v- for = " tick in tickTexts" v- bind= " tick.wrapper" >
308- < CoreText v- bind= " tick.text" / >
312+ < CoreMarkdown v- bind= " tick.text" v- if = " theme.label_type == 'markdown'" / >
313+ < CoreText v- bind= " tick.text" v- else / >
309314 < / g>
310315 < g class = " vvplot-interactive" fill= " transparent" >
311316 < rect : width= " width" : height= " 10" : y= " -5" v- on= " axisVOn"
@@ -317,6 +322,9 @@ const axisVOn = {
317322 < rect : width= " 20" : height= " 10" : y= " -5" : x= " width - 20" style= " cursor:ew-resize;"
318323 @pointerdown= " axisRescaleRightPointerdown" / >
319324 < / g>
320- < CoreText v- bind= " axisTitle" v- if = " axisTitle.text" / >
325+ < template v- if = " axisTitle.text" >
326+ < CoreMarkdown v- bind= " axisTitle" v- if = " theme.title_type == 'markdown'" / >
327+ < CoreText v- bind= " axisTitle" v- else / >
328+ < / template>
321329 < / g>
322330< / template>
0 commit comments