设置polar坐标轴指示器的label文字样式

2018-09-13 10:40 更新

您可以通过控制文本标签中文字的颜色,文字的字体风格、字体的粗细、文字块属性、文字的描边属性、文字的阴影属性来设置 polar 坐标轴指示器的文本标签。具体的方法参考如下:

polar.tooltip.axisPointer.label.textStyle   |   boolean

设置 polar 坐标轴指示器label标签的文本样式

polar.tooltip.axisPointer.label.textStyle.color   |   Color

[ default: '#fff' ]

polar 文本标签中文字的颜色。

polar.tooltip.axisPointer.label.textStyle.fontStyle   |   string

[ default: 'normal' ]

polar 文本标签的文字字体的风格

可选:

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

polar.tooltip.axisPointer.label.textStyle.fontWeight   |   string

[ default: normal ]

设置文字字体的粗细

可选:

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

polar.tooltip.axisPointer.label.textStyle.fontFamily   |   string

[ default: 'sans-serif' ]

设置文字的字体系列

默认值为:'sans-serif',还可以是:'serif' , 'monospace', 'Arial', 'Courier New', 'Microsoft YaHei', ...

polar.tooltip.axisPointer.label.textStyle.fontSize   |   number

[ default: 12 ]

设置文字的字体大小

polar.tooltip.axisPointer.label.textStyle.lineHeight   |   number

设置文字的行高。

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

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

polar.tooltip.axisPointer.label.textStyle.width   |   number, string

设置文字块的宽度。

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

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

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

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

polar.tooltip.axisPointer.label.textStyle.height   |   number, string

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

注意:文字块的 width 和 height 指定的是内容高宽,不包含 padding;如果不定义 rich 属性,则不能指定 width 和 height。

polar.tooltip.axisPointer.label.textStyle.textBorderColor   |   string

[ default: 'transparent' ]

设置文字本身的描边颜色。

polar.tooltip.axisPointer.label.textStyle.textBorderWidth   |   number

[ default: 0 ]

设置文字本身的描边宽度。

polar.tooltip.axisPointer.label.textStyle.textShadowColor   |   string

[ default: 'transparent' ]

设置文字本身的阴影颜色。

polar.tooltip.axisPointer.label.textStyle.textShadowBlur   |   number

[ default: 0 ]

设置文字本身的阴影长度。

polar.tooltip.axisPointer.label.textStyle.textShadowOffsetX   |   number

[ default: 0 ]

设置文字本身的阴影 X 偏移。

polar.tooltip.axisPointer.label.textStyle.textShadowOffsetY   |   number

[ default: 0 ]

设置文字本身的阴影 Y 偏移。

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

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号