質問編集履歴

2

ドキュメント追加

2018/08/18 02:30

投稿

aruto
aruto

スコア175

test CHANGED
File without changes
test CHANGED
@@ -277,3 +277,13 @@
277
277
 
278
278
 
279
279
  ```
280
+
281
+
282
+
283
+ ##追記2
284
+
285
+ [ドキュメント](https://vue-chartjs.org/#/home?id=reactive-data)より
286
+
287
+ On data change, it will either call update() if only the data inside the datasets has changed or renderChart() if new datasets were added.
288
+
289
+ とあるのでdatasetsの変更にも対応しているのではと思っています

1

試したこと追加

2018/08/18 02:30

投稿

aruto
aruto

スコア175

test CHANGED
File without changes
test CHANGED
@@ -206,8 +206,74 @@
206
206
 
207
207
 
208
208
 
209
-
210
-
211
209
  ### 補足情報(FW/ツールのバージョンなど)
212
210
 
213
211
  [vue-chartjsのgithub](https://github.com/apertureless/vue-chartjs)
212
+
213
+
214
+
215
+ ##追記
216
+
217
+ ```html
218
+
219
+ <button @click="clicked">ボタン</button>
220
+
221
+ <p>{{datacollection}}</p>
222
+
223
+
224
+
225
+ clicked(){
226
+
227
+ this.$set(datacollection, 'datasets', [
228
+
229
+ {
230
+
231
+ label: '得票数',
232
+
233
+ data: [3, 3, 13, 15, 12, 13],
234
+
235
+ backgroundColor: [
236
+
237
+ 'rgba(0, 99, 132, 0.2)',
238
+
239
+ 'rgba(54, 162, 235, 0.2)',
240
+
241
+ 'rgba(0, 206, 86, 0.2)',
242
+
243
+ 'rgba(75, 192, 192, 0.2)',
244
+
245
+ 'rgba(153, 102, 0, 0.2)',
246
+
247
+ 'rgba(0, 159, 64, 0.2)',
248
+
249
+ ],
250
+
251
+ borderColor: [
252
+
253
+ 'rgba(255,99,132,1)',
254
+
255
+ 'rgba(54, 162, 235, 1)',
256
+
257
+ 'rgba(255, 206, 86, 1)',
258
+
259
+ 'rgba(75, 192, 192, 1)',
260
+
261
+ 'rgba(153, 102, 255, 1)',
262
+
263
+ 'rgba(255, 159, 64, 1)',
264
+
265
+ ],
266
+
267
+ borderWidth: 1,
268
+
269
+ },
270
+
271
+ }
272
+
273
+ //としたところ、これはpタグの内容が更新されました
274
+
275
+ //chartは相変わらず変わりません
276
+
277
+
278
+
279
+ ```