目前的Line类型的曲线横纵坐标的值必须是一一对应的,很多场合下,横坐标的值一般都是从某一值开始,等间隔分布的,这时如果每一条曲线都按现在的方式存储值的话,在数据量大的时候太浪费空间了。
建议增加一个类型,x值可只保存起始值,间隔值这两个值就可以,具体Y对应的值通过这两个值计算即可
或者有没有其他的方式可实现这一需求,请大家帮忙指教,谢谢
series:{
x:{
startvalue:0.1,
interval:0.2
},
y:[0,1.1,3,4,5.6,...]
}
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical questions.
If you are interested in the project, you may also subscribe our mail list.
Have a nice day! 🍵
Array(n).fill().map((v, i) => startvalue + i * interval);
Array(n).fill().map((v, i) => startvalue + i * interval);
谢谢!
请问需要如何配置?
我看示例里都是这样配置的
series: [{
data: [
// 维度X 维度Y 其他维度 ...
[ 3.4, 4.5, 15, 43],
[ 4.2, 2.3, 20, 91],
[ 10.8, 9.5, 30, 18],
[ 7.2, 8.8, 18, 57]
]
}]
各个维度数据必须长度一样
比如你的Y数据是[2, 4, 5, 6, 8, 9, 10, 14, 17, 23, 30]
就可以写成:
let yData = [2, 4, 5, 6, 8, 9, 10, 14, 17, 23, 30];
let startvalue = 1;
let interval = 2;
let data = yData.map((v, i) => [startvalue + i * interval, v])
option = {
xAxis: {
},
yAxis: {
type: 'value'
},
series: [{
data: data,
type: 'line'
}]
};
比如你的Y数据是
[2, 4, 5, 6, 8, 9, 10, 14, 17, 23, 30]就可以写成:
let yData = [2, 4, 5, 6, 8, 9, 10, 14, 17, 23, 30]; let startvalue = 1; let interval = 2; let data = yData.map((v, i) => [startvalue + i * interval, v]) option = { xAxis: { }, yAxis: { type: 'value' },, series: [{ data: data, type: 'line' }] };还可以这样做的,非常感谢,我试试
Most helpful comment
比如你的Y数据是
[2, 4, 5, 6, 8, 9, 10, 14, 17, 23, 30]就可以写成: