更改 eCharts 热图特定单元格的边框宽度
Change border width in specific cell of eCharts heatmap
我正在尝试更改中间单元格的边框以强调它。
我可以使用 series-heatmap.itemStyle
更改整个图表的边框,但不能只更改一个单元格的边框。
我期待的结果与上图类似:
任何帮助将不胜感激!!
[编辑]
我在 docs 中发现,如果需要对某些特定项目进行自定义,可以在 data
数组中进行设置:
[
12,
24,
{
value: [24, 32],
// label style, only works in this data item.
label: {},
// item style, only works in this data item.
itemStyle:{}
},
33
]
// Or
[
[12, 332],
[24, 32],
{
value: [24, 32],
// label style, only works in this data item.
label: {},
// item style, only works in this data item.
itemStyle:{}
},
[33, 31]
]
我的数据系列设置如下:
[[0, 0, 549], [0, 1, 571] ...
已经按照这些示例仅尝试更改中间带有“653”的数组,但没有成功...
我找到了解决这个问题的方法
只需添加一个新系列,其值为我想更改边框
因为我的DataSerie
是一个长度为62的数组,只需要将平均值放在第二个系列中:
DataSerie 示例
[[0,0,1], [0,0,2], ... ]
ChartOptions = {
...
series: [
{
type: 'heatmap',
data: DataSerie
},
{
type: "heatmap",
// [ [x, y, value] ]
data: [ [DataSerie[31] ]
}
]
...
我正在尝试更改中间单元格的边框以强调它。
我可以使用 series-heatmap.itemStyle
更改整个图表的边框,但不能只更改一个单元格的边框。
我期待的结果与上图类似:
任何帮助将不胜感激!!
[编辑]
我在 docs 中发现,如果需要对某些特定项目进行自定义,可以在 data
数组中进行设置:
[
12,
24,
{
value: [24, 32],
// label style, only works in this data item.
label: {},
// item style, only works in this data item.
itemStyle:{}
},
33
]
// Or
[
[12, 332],
[24, 32],
{
value: [24, 32],
// label style, only works in this data item.
label: {},
// item style, only works in this data item.
itemStyle:{}
},
[33, 31]
]
我的数据系列设置如下:
[[0, 0, 549], [0, 1, 571] ...
已经按照这些示例仅尝试更改中间带有“653”的数组,但没有成功...
我找到了解决这个问题的方法
只需添加一个新系列,其值为我想更改边框
因为我的DataSerie
是一个长度为62的数组,只需要将平均值放在第二个系列中:
DataSerie 示例
[[0,0,1], [0,0,2], ... ]
ChartOptions = {
...
series: [
{
type: 'heatmap',
data: DataSerie
},
{
type: "heatmap",
// [ [x, y, value] ]
data: [ [DataSerie[31] ]
}
]
...