Hello, everyone! I'm starting in node-red and trying to load the msg.payload data inside the apex chart, but to no avail. Grateful
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>ApexChart/VueJS Example - Node-RED UI Builder</title>
<meta name="description" content="Node-RED UI Builder - ApexChart/VueJS Example">
<link rel="icon" href="./images/node-blue.ico">
<link type="text/css" rel="stylesheet" href="../uibuilder/vendor/bootstrap/dist/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="../uibuilder/vendor/bootstrap-vue/dist/bootstrap-vue.css" />
<link rel="stylesheet" href="./index.css" media="all">
</head>
<body>
<div id="app">
<b-container id="app_container">
<h1>
Examples of using <a href="https://apexcharts.com/docs/vue-charts/" target="_blank">ApexChart</a>
with uibuilder, VueJS and bootstrap-vue
</h1>
<b-row>
<b-card col class="w-50" header="Line Chart" border-variant="primary" header-bg-variant="primary" header-text-variant="white" align="center">
<apexchart width="100%" type="line" :options="options" :series="series"></apexchart>
</b-card>
</b-row>
</b-container>
</div>
<script src="../uibuilder/vendor/socket.io/socket.io.js"></script>
<script src="../uibuilder/vendor/vue/dist/vue.min.js"></script>
<script src="../uibuilder/vendor/bootstrap-vue/dist/bootstrap-vue.js"></script>
<!-- Loading from CDN, use uibuilder to install packages and change to vendor links -->
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
<script src="./uibuilderfe.min.js"></script> <!-- //prod version -->
<script src="./index.js"></script>
</body>
</html>
index.js
/* jshint browser: true, esversion: 5 */
/* globals document,Vue,window,uibuilder,VueApexCharts */
'use strict'
/** Reference the apexchart component (removes need for a build step) */
Vue.component('apexchart', VueApexCharts)
// eslint-disable-next-line no-unused-vars
var app1 = new Vue({
el: '#app',
data: {
startMsg : 'Vue has started, waiting for messages',
options: {
chart: {
id: 'vuechart-example'
},
xaxis: {
type: 'datetime',
labels: {
format: 'yyyy-MM-dd HH:mm',
}
}
},
series: [{
name: "Temperatura",
data: [],
}],
}, // --- End of data --- //
computed: {
}, // --- End of computed --- //
methods: {
}, // --- End of methods --- //
mounted: function(){
uibuilder.start()
var vueApp = this
uibuilder.onChange('msg', function (msg) {
Vue.set(vueApp.series, 0, {'data': msg.payload})
//vueApp.series[0].data = msg.payload
console.log('SERIES: ', vueApp.series)
})
} // --- End of mounted hook --- //
}) // --- End of app1 --- //
// EOF