Add console logging to debug traffic graph issues

This commit is contained in:
Graham McIntire 2026-01-05 13:45:37 -06:00
parent 13ca70da40
commit ae5b73c495
No known key found for this signature in database

View file

@ -51,10 +51,12 @@ const SensorChart = {
const canvas = this.el.querySelector('canvas')
const ctx = canvas.getContext('2d')
const unit = this.el.dataset.unit || '%'
const autoScale = this.el.dataset.autoScale === 'true'
const showZeroLine = this.el.dataset.showZeroLine === 'true'
const autoScale = this.el.dataset.autoScale === 'true' || this.el.dataset.autoScale === true
const showZeroLine = this.el.dataset.showZeroLine === 'true' || this.el.dataset.showZeroLine === true
const chartType = unit === 'bps' ? 'bar' : 'line'
console.log('Chart config:', { unit, autoScale, showZeroLine, chartType, datasetsCount: data.datasets.length })
// Generate colors for each dataset
const colors = [
'rgb(59, 130, 246)', // blue
@ -118,6 +120,8 @@ const SensorChart = {
// Add 10% padding, ensure minimum of 1000 (1 Kbps)
maxAbsValue = Math.max(maxAbsValue * 1.1, 1000)
console.log('Traffic graph scale:', { maxAbsValue, min: -maxAbsValue, max: maxAbsValue })
yAxisConfig = {
min: -maxAbsValue,
max: maxAbsValue,