I have the following diagram on angular-chart:
<canvas id="line" class="chart chart-line" chart-data="data" chart-colors="colors"
chart-series="series" chart-options="options">
</canvas>
Using these options:
$scope.options = {
type:'line',
tooltips: {
enabled: false
},
showTooltips: false,
hover: {mode: null},
scales: {
xAxes: [{
type:"time"
}]
}
};
I am updating data via websocket as follows:
channel.on("create:entry", function (msg) {
$log.log("received entry");
$log.log(msg);
$scope.data[0].push(
{
x: new Date(),
y: msg.sonnar
});
vm.current = msg.sonnar;
vm.logEntries.splice(0, 0, {time: moment(new Date()).format("MMMM Do YYYY, h:mm:ss a"), level: msg.sonnar});
});
The chart updates the correct path for multiple records. But if I find in the diagram, I get the error:
TypeError: Cannot read property 'skip' of undefined.
This is the function in the js diagram where the application crashes:
function parseVisibleItems(chart, handler) {
var datasets = chart.data.datasets;
var meta, i, j, ilen, jlen;
for (i = 0, ilen = datasets.length; i < ilen; ++i) {
if (!chart.isDatasetVisible(i)) {
continue;
}
meta = chart.getDatasetMeta(i);
for (j = 0, jlen = meta.data.length; j < jlen; ++j) {
var element = meta.data[j];
if (!element._view.skip) {
handler(element);
}
}
}
}
Can someone help me solve the problem?