import { html, css, cssManager } from '@design.estate/dees-element'; import type { DeesChartGauge } from './component.js'; import '@design.estate/dees-wcctools/demotools'; import './component.js'; export const demoFunc = () => { const defaultThresholds = [ { value: 60, color: 'hsl(142 76% 36%)' }, { value: 80, color: 'hsl(38 92% 50%)' }, { value: 100, color: 'hsl(0 72% 50%)' }, ]; return html` { const cpuGauge = elementArg.querySelector('#cpu-gauge') as DeesChartGauge; const memGauge = elementArg.querySelector('#mem-gauge') as DeesChartGauge; const slaGauge = elementArg.querySelector('#sla-gauge') as DeesChartGauge; let animInterval: number | null = null; const buttons = elementArg.querySelectorAll('dees-button'); buttons.forEach((button: any) => { const text = button.text?.trim(); if (text === 'Animate') { button.addEventListener('click', () => { if (animInterval) return; animInterval = window.setInterval(() => { cpuGauge.value = Math.round(30 + Math.random() * 60); memGauge.value = Math.round(40 + Math.random() * 50); slaGauge.value = Math.round((95 + Math.random() * 5) * 100) / 100; }, 2000); }); } else if (text === 'Stop') { button.addEventListener('click', () => { if (animInterval) { window.clearInterval(animInterval); animInterval = null; } }); } else if (text === 'Spike') { button.addEventListener('click', () => { cpuGauge.value = 95; memGauge.value = 88; slaGauge.value = 96.5; }); } }); }}> Animate Stop Spike Gauge chart with animated value transitions and threshold coloring • Click 'Animate' for live updates, 'Spike' to simulate high load `; };