Use the Echarts in the Vue project a few days ago, so write a simple demo The effect you want to implement data dynamic generation (real-time change) time point 1
Time point 2
code file (Echarts.vue)
<template> <div class= "Echarts" > <i-echarts:option= "Options" ></i-echarts> </div> &L
t;/template> <script> import iecharts from ' Vue-echarts-v3/src/full.vue ' export default {name: ' table ', Components: {iecharts}, data () {return {options: {title: {text : ' Timesky '}, tooltip: {trigger: ' item '}, Legend: {dat A: [' Sales ']}, Xaxis: {name: ' goods ', namelocation: ' Start ', Namegap: ' $ ', boundarygap:true, data: [' shirts ', ' sweaters ', ' chiffon shirts ', ' trousers ', ' heels ', ' socks ']},//Y
Axis: {}, longitudinal axis adaptive yaxis: {//Vertical axis ruler fixed type: ' Value ', Scale:true,
Name: ' Sales ', max:100, min:0, Boundarygap: [0.2, 0.2]},
Series: [{ Name: ' Sales ', type: ' Bar ', data: [5, 20, 36, 60, 10, 55]}}}, Mounted () {This.changedata ()}, methods: {Changedata () {Let data = [] for (Let i = 0, min = 5, max = 99; I < 6; i++) {Data.push (Math.floor (Math.random () * (max + 1-min) + min)} this.options.series[0].dat A = Data settimeout (this.changedata)}} </script> <style>. echarts {width:
800px;
height:400px; } </style>
The y-axis scale is adaptive and fixed as shown in the comments in the previous paragraph, which is adaptive by default and has the following effect
If you want to fix the longitudinal axis only need to configure Min and Max values, you can configure the Splitnumber property if you want to divide more ticks
YAxis: {}, //longitudinal axis adaptive
yaxis: { //Vertical axis ruler fixed
type: ' Value ',
scale:true,
name: ' Sales ',
max:100,
min:0,
splitnumber:10,
boundarygap: [0.2, 0.2]
},
The effect is as follows
This article refers to the blog JavaScript echart yaxis fixed value change value Echarts Official website example