ElemeFE / v-charts

基于 Vue2.0 和 ECharts 封装的图表组件📈📊
https://v-charts.js.org
MIT License
6.8k stars 1.98k forks source link

Could not set max time in line chart #898

Open erhansaydam opened 3 years ago

erhansaydam commented 3 years ago

Hello V-Charts Team,

I am using a dynamic line chart with a time period. I want to set max time for the x axis. In the documentiation it seems to be setting xAxis.max value. But I could not done it. My code is as follows:

<template>
  <ve-line :data="chartData" theme-name="dark" :settings="chartSettings" judge-width>
  </ve-line>
</template>
<script>
import VeLine from 'v-charts/lib/line.common'
import 'echarts/lib/component/axis'
...
data() {
    return {
      i: 0,
      chartData: {columns: ['date', 'r'], rows: []},
      chartSettings: {}
  }
}
...
methods: {
...
    addData(data) { // this method called from another place
      this.chartData.rows.push(data);
      if (this.i === 0)
          this.extend['xAxis.max'] = '2021-01-29 18:00:00' // this value will be dynamic but for this example set as static
      this.i++;
    },
}
...
</script>

The pushed data's time format is the same with max time value. When data starts to flow to linechart I want to set max time as in the code.

Is there something I am missing, can you help me to solve this issue?

Best regards, Erhan Saydam