fix: traffic graph invisible — scale dominated by capacity lines (#140)
## Problem
On backhaul devices, the Y axis auto-scale includes capacity reference line values (e.g. 100 Mbps) alongside actual traffic (e.g. 5 Mbps). This makes the traffic data appear as a flat line near zero — effectively invisible.
## Fix
Exclude datasets with `Capacity` prefix from the max-value calculation used for symmetric Y axis scaling. The capacity dashed lines still render and clip at the chart edges as a visual ceiling reference.
## 1-line change
```js
if (dataset.label?.startsWith("Capacity")) return
```
Reviewed-on: graham/towerops-web#140
This commit is contained in:
parent
4a43d9decc
commit
cb9becae4e
1 changed files with 2 additions and 0 deletions
|
|
@ -127,8 +127,10 @@ const SensorChart: SensorChartHook = {
|
||||||
if (autoScale) {
|
if (autoScale) {
|
||||||
if (showZeroLine && unit === 'bps') {
|
if (showZeroLine && unit === 'bps') {
|
||||||
// Find max absolute value to make symmetric scale
|
// Find max absolute value to make symmetric scale
|
||||||
|
// Exclude capacity reference lines so they don't dominate the scale
|
||||||
let maxAbsValue = 0
|
let maxAbsValue = 0
|
||||||
datasets.forEach(dataset => {
|
datasets.forEach(dataset => {
|
||||||
|
if (dataset.label?.startsWith('Capacity')) return
|
||||||
if (dataset.data && dataset.data.length > 0) {
|
if (dataset.data && dataset.data.length > 0) {
|
||||||
dataset.data.forEach((point: ChartDataPoint) => {
|
dataset.data.forEach((point: ChartDataPoint) => {
|
||||||
if (point && typeof point.y === 'number') {
|
if (point && typeof point.y === 'number') {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue