changxin commited on
Commit
bf35136
1 Parent(s): 1202084

Delete wps-test/ui/chartjs2.html

Browse files
Files changed (1) hide show
  1. wps-test/ui/chartjs2.html +0 -32
wps-test/ui/chartjs2.html DELETED
@@ -1,32 +0,0 @@
1
- <head><meta chartset="utf-8">
2
- <script type="text/javascript" src="../js/util.js"></script>
3
- <script type="text/javascript" src="../.debugTemp/wpsjsrpcsdk.js"></script>
4
- <script src="https://cdn.staticfile.org/Chart.js/3.9.1/chart.js"></script>
5
- </head>
6
- <body>
7
- <div style="width:600px;height:500px;margin:auto">
8
- <canvas id="myChart" width="400" height="300"></canvas>
9
- </div>
10
- <h3>建议直接复制下方数据粘贴到Sheet1表格A1:E1区域,使用时修改数据源区域B1:E1数值即可。</h3>
11
- <table border="1" align="center"><tr><td>数值</td><td>5</td><td>6</td><td>2</td><td>7</td></tr></table>
12
- <script>
13
- wps.ApiEvent.AddApiEventListener('SheetChange',(x,y)=>if(x.Name=='Sheet1'){fx()});
14
- function fx(){
15
- var data0=wps.ActiveSheet.Range("B1:E1").Value().flat();
16
- const ctx = document.getElementById('myChart');
17
- const context = ctx.getContext('2d');
18
- context.clearRect(0, 0,ctx.width, ctx.height);
19
- new Chart(ctx, {type: 'bar',
20
- data: {labels: ['Red', 'Blue', 'Yellow', 'Green'],
21
- datasets: [{label: '# 票数',data: data0,
22
- backgroundColor: ['rgba(255, 99, 132, 0.2)','rgba(54, 162, 235, 0.2)','rgba(255, 206, 86, 0.2)','rgba(75, 192, 192, 0.2)'],
23
- borderColor: ['rgba(255, 99, 132, 1)','rgba(54, 162, 235, 1)','rgba(255, 206, 86, 1)','rgba(75, 192, 192, 1)'],
24
- borderWidth: 1
25
- }]
26
- },
27
- options: {scales: {y: {beginAtZero: true}}}
28
- });
29
- }
30
-
31
- </script>
32
- </body>