【发布时间】:2023-01-26 07:30:47
【问题描述】:
我当时在做一个 eCharts 项目。在那里,我根据对象数组中的数据制作了一个折线图:
data = [
{
des: 'pikachu',
score: 75,
},
{
des: 'jigglypuff',
score: 80,
},
{
des: 'balbasaur',
score: 40,
},
{
des: 'charizard',
score: 70,
},
{
des: 'snorlax',
score: 60,
},
{
des: 'meowto',
score: 90,
},
];
- 如何编辑工具提示,即,当我将轴带到一个点时,标签显示索引(在本例中为 1)和值(为 23)。我想删除索引并只保留值并更改它旁边的项目符号的颜色。
- 我如何控制号码。 yAxis 中的轴,即在 yAxis 上显示的值来自
0 to 70,我希望它类似于0,50,100。 有人可以帮我吗?这是stackblitz representation我试过这个
this.data.map((x) => { this.chartOptions = { xAxis: { type: 'category', show: false, axisPointer: { show: true, type: 'line', }, }, yAxis: { type: 'value', show: true, }, tooltip: { show: true, axisPointer: { type: 'cross', label: { formatter: function (x) { return `<div>some data {x.des}</div>`; }, }, }, }, series: [ { data: lineData, type: 'line', lineStyle: { color: '#1bc9b7', }, }, ], }; });希望我能得到一些自定义输出,但它没有用。我考虑过使用
map()并将chartOptions放入循环中,以便我可以将des附加到它的特定值。但这也没有成功。
【问题讨论】:
标签: javascript angular echarts ngx-echarts