{ x: '57%', y: '8%', text: '闪信数量: {a|' + anomalyCountNum + '}{b|/' + testCountNum + '}',

动态 未结 0 272
小小草
小小草 LV1 2023年9月23日 23:40 发表
要在文本前面加一个圆形图例,可以使用 ECharts 中的 `graphic` 组件来实现。 以下是一个示例代码: ```javascript option = { // ... graphic: [ { type: 'circle', left: '50%', top: '8%', shape: { cx: 5, cy: 5, r: 5 }, style: { fill: '#1B6DEA' } } ], series: [ { // ... label: { show: true, position: 'insideLeft', formatter: '{a|闪信数量:} {b|' + anomalyCountNum + '}{c|/}' + testCountNum, rich: { a: { fontSize: 16, color: '#666666', fontWeight: 'bold' }, b: { fontSize: 16, color: '#1B6DEA', fontWeight: 'bold' }, c: { fontSize: 16, color: '#999999', fontWeight: 'bold' } } }, // ... } ] }; ``` 在上面的代码中,我们使用了 `graphic` 组件添加了一个圆形图例,然后在 `label` 的 `formatter` 属性中使用了 `{a|}`、`{b|}` 和 `{c|}` 来设置不同样式的文本。其中,`{a|}` 表示使用 `rich` 中名为 `a` 的样式,`{b|}` 表示使用 `rich` 中名为 `b` 的样式,`{c|}` 表示使用 `rich` 中名为 `c` 的样式。 注意,`graphic` 组件需要放在 `series` 外面,而 `label` 需要放在对应的 `series` 中。
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复