Skip to content

Commit 6cd6aca

Browse files
CyanCyan
authored andcommitted
- 修复bug:「value=0」也会上色,这不对
- 现在直接过滤到「x<0.01」的值,不参与上色任务,直接显示nodata
1 parent 855e7af commit 6cd6aca

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

provisioning/dashboards/dashboard.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
},
4848
"refId": "A",
4949
"scenarioId": "csv_content",
50-
"csvContent": "time,value\n2026-02-28T00:30:00Z,1\n2026-02-28T16:30:00Z,2\n2026-02-28T23:30:00Z,3\n2026-02-27T00:30:00Z,4\n2026-02-27T16:30:00Z,5\n2026-02-27T23:30:00Z,6\n2026-02-26T00:30:00Z,7\n2026-02-26T16:30:00Z,8\n2026-02-26T23:30:00Z,9"
50+
"csvContent": "time,value\n2026-02-14T00:00:00Z,1\n2026-02-15T00:00:00Z,2\n2026-02-16T00:00:00Z,3\n2026-02-17T00:00:00Z,4\n2026-02-18T00:00:00Z,5\n2026-02-19T00:00:00Z,0\n2026-02-20T00:00:00Z,0\n2026-02-21T00:00:00Z,8\n2026-02-22T00:00:00Z,9\n2026-02-23T00:00:00Z,10\n2026-02-24T00:00:00Z,11\n2026-02-25T00:00:00Z,12\n2026-02-26T00:00:00Z,13\n2026-02-27T00:00:00Z,14\n2026-02-28T00:00:00Z,15"
5151
}
5252
],
5353
"title": "Calendar Heatmap Panel (Timezone test)",
@@ -74,8 +74,8 @@
7474
"list": []
7575
},
7676
"time": {
77-
"from": "2026-02-25T00:00:00Z",
78-
"to": "2026-03-02T00:00:00Z"
77+
"from": "2026-02-14T00:00:00Z",
78+
"to": "2026-03-01T00:00:00Z"
7979
},
8080
"timepicker": {},
8181
"timezone": "",

src/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ export interface CalendarHeatmapOptions {
4545

4646
bucketMode: 'auto' | 'custom';
4747

48-
/**
49-
* Values < minColoredValue are treated as empty (blank).
50-
* Requirement: empty is [0, minColoredValue), and >= minColoredValue is colored.
51-
*/
52-
minColoredValue: number;
53-
5448
/**
5549
* Custom bucket edges for bucketMode=custom.
5650
* Must be 4 numbers, strictly increasing, and include 0.

src/utils/dataProcessor.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ export function processTimeSeriesData(series: DataFrame[], aggregation: Aggregat
3838

3939
dailyData.forEach((values, date) => {
4040
const count = aggregate(values, aggregation);
41+
42+
// 把 [0, 0.01) 当作 “没有数据”:不生成 heatmap cell
43+
// 这样可以保证 0 不会落入任何颜色 bucket(避免被渲染成浅绿/浅蓝)
44+
if (count >= 0 && count < 0.01) {
45+
return;
46+
}
47+
4148
result.push({ date, count: Math.round(count * 100) / 100 });
4249
});
4350

0 commit comments

Comments
 (0)