highcharts-vue
highcharts-vue copied to clipboard
'Moving window' when data is added dynamically - how to adjust?
So when the data is added every second Highstocks start having a 'moving window'.
But can we set this moving window to something different than 5 seconds?
Here is the demo: https://codesandbox.io/s/highcharts-vue-demo-forked-kk8s0?file=/src/components/Chart.vue:0-852
Here is an example of the code
<template>
<div>
<highcharts
:constructorType="'stockChart'"
class="hc"
:options="chartOptions"
ref="chart"
></highcharts>
</div>
</template>
<script>
export default {
data() {
return {
chartOptions: {
rangeSelector: {
selected: 0,
},
series: [
{
pointStart: Date.now(), // starting at the moment
pointInterval: 1000 , // second data
data: [1, 2, 3],
},
],
},
};
},
created() {
const that = this;
var series = this.chartOptions.series[0];
setInterval(function () {
var x = new Date().getTime(), // current time
y = Math.round(Math.random() * 100);
series.data.push(Math.random() * 100);
}, 1000);
},
methods: {
},
};
</script>
Hi @chapkovski ,
Thank you for contacting us! I see that you also asked about that on Stack Overflow, and Wojtek has replied on that one. Did this answer resolve your issue and can be closed now, or do you still need any support here?
Kind regards!
Closing as it's a duplicate.