-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Open
Labels
bugpendingWe are not sure about whether this is a bug/new feature.We are not sure about whether this is a bug/new feature.
Description
Version
5.2.2
Link to Minimal Reproduction
Steps to Reproduce
function generateEChartsOption(options = {}) {
const {
startTime = "2025-11-28 00:00:00",
endTime = "2025-11-29 00:00:00",
zoomStartTime = "2025-11-28 05:35:00",
zoomEndTime = "2025-11-28 13:35:00",
numLines = 32,
numPoints = 288
} = options;
// 解析总时间开始和结束为 Date 对象(一天总跨度)
const totalStartDate = new Date(startTime);
const totalEndDate = new Date(endTime);
const totalDuration = totalEndDate - totalStartDate; // 毫秒差值(应为 24 小时 = 86400000 ms)
const interval = totalDuration / (numPoints - 1); // 每个点间隔(均匀分布在一天)
// 生成时间序列(x 轴数据,覆盖全天)
const timestamps = [];
for (let i = 0; i < numPoints; i++) {
const timestamp = new Date(totalStartDate.getTime() + i * interval);
timestamps.push(timestamp.getTime()); // 使用毫秒时间戳
}
// 生成 32 条线的数据(随机 y 值,模拟数据)
const series = [];
for (let lineIndex = 0; lineIndex < numLines; lineIndex++) {
const data = [];
for (let pointIndex = 0; pointIndex < numPoints; pointIndex++) {
// 随机 y 值(例如,0-100 范围,带一些噪声)
const baseValue = 50 + Math.sin(pointIndex / 10 + lineIndex) * 20; // 基础波形
const noise = (Math.random() - 0.5) * 10; // 噪声
data.push([timestamps[pointIndex], baseValue + noise]);
}
series.push({
name: `线条 ${lineIndex + 1}`,
type: 'line',
z: lineIndex + 1, // z 属性依次递增(从 1 到 32)
data: data,
"emphasis": {
"focus": "series"
},
smooth: true, // 启用平滑曲线
lineStyle: {
width: 1
}
});
}
// ECharts option 配置
const echartsOption = {
title: {
text: '32 条线图示例(288 点覆盖一天,dataZoom 聚焦 8 小时)'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: series.map(s => s.name),
bottom: 10
},
dataZoom: [
{
type: "inside",
startValue: zoomStartTime,
endValue: zoomEndTime,
zoomOnMouseWheel: true
}
],
xAxis: {
type: 'time',
name: '时间(全天)'
},
yAxis: {
type: 'value',
name: '数值'
},
series: series
};
return echartsOption;
}
option = generateEChartsOption()
Current Behavior
偶现线条变暗后恢复不了
Expected Behavior
线条恢复正常颜色
Environment
- OS:
- Browser:
- Framework:Any additional comments?
No response
Metadata
Metadata
Assignees
Labels
bugpendingWe are not sure about whether this is a bug/new feature.We are not sure about whether this is a bug/new feature.