link1370 link1371 link1372 link1373 link1374 link1375 link1376 link1377 link1378 link1379 link1380 link1381 link1382 link1383 link1384 link1385 link1386 link1387 link1388 link1389 link1390 link1391 link1392 link1393 link1394 link1395 link1396 link1397 link1398 link1399 link1400 link1401 link1402 link1403 link1404 link1405 link1406 link1407 link1408 link1409 link1410 link1411 link1412 link1413 link1414 link1415 link1416 link1417 link1418 link1419 link1420 link1421 link1422 link1423 link1424 link1425 link1426 link1427 link1428 link1429 link1430 link1431 link1432 link1433 link1434 link1435 link1436 link1437 link1438 link1439 link1440 link1441 link1442 link1443 link1444 link1445 link1446 link1447 link1448 link1449 link1450 link1451 link1452 link1453 link1454 link1455 link1456 link1457 link1458 link1459 link1460 link1461 link1462 link1463 link1464 link1465 link1466 link1467 link1468 link1469 link1470 link1471 link1472 link1473 link1474 link1475 link1476 link1477 link1478 link1479 link1480 link1481 link1482 link1483 link1484 link1485 link1486 link1487 link1488 link1489 link1490 link1491 link1492 link1493 link1494 link1495 link1496 link1497 link1498 link1499 link1500 link1501 link1502 link1503 link1504 link1505 link1506

[Vue.js] Cannot find example how to use gradient while using vuex and reactiveProps mixin (API Data)



First, you can keep track this problem on:
Also there is a project using datepicker which rerenders the chart based on given date thus if you look on the codepen, at the BarChart.vue, you can see I add watcher to rerender the chart

But turned out got error when every time I select a date


In a nutshell, I can’t find the example how to put the gradient to the chart.



import { Bar, mixins } from “vue-chartjs”;
import { mapGetters } from “vuex”;

export default {
extends: Bar,
mixins: [mixins.reactiveProp],
props: [“chartData”, “chartLabels”, “options”],

mounted() {
// chartData is created in the mixin
// let gradientFill = this.$refs.canvas.getContext(‘2d’).createLinearGradient(2000, 0, 0, 0);

// gradientFill.addColorStop(0, “#18FFFF”);
// gradientFill.addColorStop(1, “#FF1744”);
labels: this.chartLabels,
datasets: [
data: this.chartData,
backgroundColor: “red”,
hoverBackgroundColor: “red”
computed: {
watch: {
chartData() {
chartLabel() {

Actual Result

Can’t implement the gradient color
Data’s well shown on initial, but got error when a date selected (as shown on image above)

Solution :

I was not able to reproduce with the codesandbox project. How are you changing the date?

The error message is referring to a map() method used on an undefined array, presumably originating in src/store/stores.js. You could try to wrap the offending map() method call in a control statement, like this:

if (payloadInitAllChart.barDataHour) { // Example, could be other map() method =>