JSRUN 用代码说话

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

编辑教程

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

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


polar.tooltip.textStyle

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


polar.tooltip.textStyle.color

Color [ 默认值: '#fff' ]

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


polar.tooltip.textStyle.fontStyle

string [ 默认值: 'normal' ]

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

可选:

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

polar.tooltip.textStyle.fontWeight

string [ 默认值: normal ]

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

可选:

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

polar.tooltip.textStyle.fontFamily

string [ 默认值: 'sans-serif' ]

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

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


polar.tooltip.textStyle.fontSize

number [ 默认值: 14 ]

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


polar.tooltip.textStyle.lineHeight

number 提示框浮层文本的行高。

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

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

polar.tooltip.textStyle.width

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

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

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

width 也可以是百分比字符串,如 '100%'。表示的是所在文本块的 contentWidth(即不包含文本块的 padding)的百分之多少。

之所以以 contentWidth 做基数,因为每个文本片段只能基于 content box 布局。

如果以 outerWidth 做基数,则百分比的计算在实用中不具有意义,可能会超出。

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


polar.tooltip.textStyle.height

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

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

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

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


polar.tooltip.textStyle.textBorderColor

string [ 默认值: 'transparent' ]

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


polar.tooltip.textStyle.textBorderWidth

number [ 默认值: 0 ]

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


polar.tooltip.textStyle.textShadowColor

string [ 默认值: 'transparent' ]

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


polar.tooltip.textStyle.textShadowBlur

number [ 默认值: 0 ]

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


polar.tooltip.textStyle.textShadowOffsetX

number [ 默认值: 0 ]

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


polar.tooltip.textStyle.textShadowOffsetY

number [ 默认值: 0 ]

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

JSRUN闪电教程系统是国内最先开创的教程维护系统, 所有工程师都可以参与共同维护的闪电教程,让知识的积累变得统一完整、自成体系。 大家可以一起参与进共编,让零散的知识点帮助更多的人。
X
支付宝
9.99
无法付款,请点击这里
金额: 0
备注:
转账时请填写正确的金额和备注信息,到账由人工处理,可能需要较长时间
如有疑问请联系QQ:565830900
正在生成二维码, 此过程可能需要15秒钟