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

2018-09-13 14:01 更新

与其他的一些 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 偏移。

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号