Run
Auto Run
define('my-app', class extends WeElement { install(){ this.chartData = { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255,99,132,0.4)', 'rgba(54, 162, 235, 0.4)', 'rgba(255, 206, 86, 0.4)', 'rgba(75, 192, 192, 0.4)', 'rgba(153, 102, 255, 0.4)', 'rgba(255, 159, 64, 0.4)' ], borderColor: 'white', borderWidth: 1 }] } this.chartOptions = { responsive: true, legend: { position: 'top', }, title: { display: true, text: 'Omi-chart Pie Chart' }, animation: { animateScale: true, animateRotate: true } } } onClick = ()=>{ this.chartData.datasets.forEach(dataset => { dataset.data.forEach((item, index) => { dataset.data[index] = Math.random() * 100 }) }) this.update() } render(props, data) { return (
random data
) } }) render(
, 'body')