import { html, css, cssManager } from '@design.estate/dees-element'; import type { DeesChartBar } from './component.js'; import '@design.estate/dees-wcctools/demotools'; import './component.js'; export const demoFunc = () => { const endpointCategories = ['/api/users', '/api/orders', '/api/products', '/api/auth', '/api/search']; const endpointSeries = [ { name: 'GET', data: [1240, 890, 720, 2100, 560] }, { name: 'POST', data: [320, 450, 180, 890, 40] }, { name: 'PUT', data: [90, 210, 150, 30, 10] }, ]; const regionCategories = ['US-East', 'US-West', 'EU', 'Asia', 'Other']; const regionSeries = [ { name: 'Requests', data: [4500, 3200, 2800, 1900, 600] }, ]; return html` { const vertChart = elementArg.querySelector('#vert-chart') as DeesChartBar; const horizChart = elementArg.querySelector('#horiz-chart') as DeesChartBar; const stackChart = elementArg.querySelector('#stack-chart') as DeesChartBar; const buttons = elementArg.querySelectorAll('dees-button'); buttons.forEach((button: any) => { const text = button.text?.trim(); if (text === 'Randomize') { button.addEventListener('click', () => { vertChart.series = endpointSeries.map((s) => ({ ...s, data: s.data.map((v) => Math.round(v * (0.5 + Math.random()))), })); horizChart.series = regionSeries.map((s) => ({ ...s, data: s.data.map((v) => Math.round(v * (0.5 + Math.random()))), })); stackChart.series = endpointSeries.map((s) => ({ ...s, data: s.data.map((v) => Math.round(v * (0.5 + Math.random()))), })); }); } }); }}>
Randomize
`${val} req`} > `${(val / 1000).toFixed(1)}k`} >
`${val} req`} >
Bar chart with vertical, horizontal, and stacked modes • Click 'Randomize' to update data with animation
`; };