codecamp

极坐标系tooltip文本样式的设置

与其他的一些 ECharts 图表组件文本样式的设置相似,我们在设置极坐标系的 tooltip 文本样式的时候,需要设置的样式也是文本中文字的颜色、文字字体的风格、文字字体的大小、文字块、文字阴影等等。下面是详细的设置过程:

polar.tooltip.textStyle   |   Object

设置极坐标系提示框浮层的文本样式。

polar.tooltip.textStyle.color   |   Color

[ default: '#fff' ]

提示框浮层文本文字的颜色。

polar.tooltip.textStyle.fontStyle   |   string

[ default: 'normal' ]

提示框浮层文本文字字体的风格

可选:

  • 'normal'
  • 'italic'
  • 'oblique'

polar.tooltip.textStyle.fontWeight   |   string

[ default: normal ]

提示框浮层文本文字字体的粗细

可选:

  • 'normal'
  • 'bold'
  • 'bolder'
  • 'lighter'
  • 100 | 200 | 300 | 400...

polar.tooltip.textStyle.fontFamily   |   string

[ default: 'sans-serif' ]

提示框浮层文本文字的字体系列

还可以是 'serif' , 'monospace', 'Arial', 'Courier New', 'Microsoft YaHei', ...

polar.tooltip.textStyle.fontSize   |   number

[ default: 14 ]

提示框浮层文本文字的字体大小

polar.tooltip.textStyle.lineHeight   |   number

提示框浮层文本的行高。

rich 中如果没有设置 lineHeight,则会取父层级的 lineHeight。例如:

{
    lineHeight: 56,
    rich: {
        a: {
            // 没有设置 `lineHeight`,则 `lineHeight` 为 56
        }
    }
}

polar.tooltip.textStyle.width   |   number, string

提示框浮层文本文字块的宽度。

一般不用指定,不指定则自动是文字的宽度。在想做表格项或者使用图片(参见 backgroundColor)时,可能会使用它。

注意,文字块的 width 和 height 指定的是内容高宽,不包含 padding。

width 也可以是百分比字符串,如 '100%'。表示的是所在文本块的 contentWidth(即不包含文本块的 padding)的百分之多少。之所以以 contentWidth 做基数,因为每个文本片段只能基于 content box 布局。如果以 outerWidth 做基数,则百分比的计算在实用中不具有意义,可能会超出。

注意,如果不定义 rich 属性,则不能指定 width 和 height。

polar.tooltip.textStyle.height   |   number, string

提示框浮层文本文字块的高度。

一般不用指定,不指定则自动是文字的高度。在使用图片(参见 backgroundColor)时,可能会使用它。

注意,文字块的 width 和 height 指定的是内容高宽,不包含 padding。

注意,如果不定义 rich 属性,则不能指定 width 和 height。

polar.tooltip.textStyle.textBorderColor   |   string

[ default: 'transparent' ]

提示框浮层文本文字本身的描边颜色。

polar.tooltip.textStyle.textBorderWidth   |   number

[ default: 0 ]

提示框浮层文本文字本身的描边宽度。

polar.tooltip.textStyle.textShadowColor   |   string

[ default: 'transparent' ]

提示框浮层文本文字本身的阴影颜色。

polar.tooltip.textStyle.textShadowBlur   |   number

[ default: 0 ]

提示框浮层文本文字本身的阴影长度。

polar.tooltip.textStyle.textShadowOffsetX   |   number

[ default: 0 ]

提示框浮层文本文字本身的阴影 X 偏移。

polar.tooltip.textStyle.textShadowOffsetY   |   number

[ default: 0 ]

提示框浮层文本文字本身的阴影 Y 偏移。

polar提示框浮层的边框与内边距
ECharts径向轴的属性设置
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

ECharts配置项.setOption

ECharts图例组件配置项

ECharts图例组件配置 文本样式

ECharts xAxis配置 直角坐标系x轴

ECharts xAxis配置 x坐标轴名称的文本样式

ECharts xAxis配置 设置x坐标轴轴线

ECharts xAxis配置 x坐标轴刻度设置

ECharts xAxis配置 x坐标轴刻度标签设置

xAxis配置x坐标轴分隔线

xAxis配置坐标轴分隔区域设置

xAxis配置类目数据

ECharts xAxis配置 类目标签的文本样式

ECharts极坐标系的径向轴

如何使用dataZoom组件

ECharts工具栏组件(toolbox)

ECharts工具栏的feature属性

ECharts导出图片的操作

ECharts的数据视图工具

ECharts数据区域缩放工具

ECharts动态类型切换工具

ECharts区域选择组件(brush)

ECharts系列列表:平行坐标系

ECharts系列:主题河流图

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }