Run
Auto Run
define('my-app', class extends WeElement { install(){ const data = [ rd(), rd(), rd(), rd(), rd(), rd() ] const steppedLineSettings = [{ steppedLine: false, label: 'No Step Interpolation', color: 'rgb(255, 99, 132)' }, { steppedLine: true, label: 'Step Before Interpolation', color: 'rgb(255, 159, 64)' }, { steppedLine: 'before', label: 'Step Before Interpolation', color:'rgb(75, 192, 192)' }, { steppedLine: 'after', label: 'Step After Interpolation', color: 'rgb(54, 162, 235)' }] this.configs = [] steppedLineSettings.forEach((details) => { this.configs.push(createConfig(details, data)) }) } render(props, data) { return (
{this.configs.map(config => (
))}
) } }) render(
, 'body') function createConfig(details, data) { return { data: { labels: ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6'], datasets: [{ label: 'steppedLine: ' + details.steppedLine, steppedLine: details.steppedLine, data: data, borderColor: details.color, fill: false, }] }, options: { responsive: true, title: { display: true, text: details.label, } } }; } function rd(){ return Math.random() * 100 }