echarts中柱形图 markPointlabel自定义文字
在Echarts中,可以通过在series中的markPoint属性中设置label属性来自定义柱形图的标记点的文字。
示例代码如下:
option = {
xAxis: {
type: 'category',
data: ['A', 'B', 'C', 'D', 'E']
},
yAxis: {
type: 'value'
},
series: [{
type: 'bar',
data: [10, 20, 30, 40, 50],
markPoint: {
data: [{
type: 'max',
name: '最大值',
label: {
show: true,
position: 'top',
formatter: '自定义文字'
}
}, {
type: 'min',
name: '最小值',
label: {
show: true,
position: 'bottom',
formatter: '自定义文字'
}
}]
}
}]
};
在上述代码中,通过在markPoint的data属性中设置label属性来自定义标记点的文字。通过设置formatter属性可以自定义文字内容。
其中,position属性用于设置文字的位置,可以设置为'top'、'bottom'、'left'、'right'等。
注意:在Echarts中,markPoint的label属性只在type为'max'、'min'等特殊类型的标记点中生效,对于普通的标记点无效
原文地址: https://www.cveoy.top/t/topic/iR5l 著作权归作者所有。请勿转载和采集!