ElemeFE / v-charts

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

如何设置yAxis的min和max的取值 #574

Open CodeDome opened 6 years ago

CodeDome commented 6 years ago

在做数据展示时,有时候y轴数据量过大,需要设定最大值,请问一下该如何设置yAxis的min和max的取值呢?

CodeDome commented 6 years ago

有QQ或者微信讨论群吗

maxy612 commented 6 years ago

https://codepen.io/maxycode/pen/oaPmPV 这样设置就可以了。 在ve-line上直接设置。

CodeDome commented 6 years ago

我绘制的是双y轴,主要想控制的是右侧y轴的值。例子如下:(主要添加了:y-axis="yaxis" 和 this.yaxis = { max: 4000 } 调试链接为:https://v-charts.js.org/#/histogram 设置双y轴的示例)

但是这样加了以后,就报错了。报错提示如下: Uncaught TypeError: Cannot read property 'get' of undefined at isCategory (referHelper.js?8b7f:139) at cartesian2d (referHelper.js?8b7f:85) at getCoordSysDefineBySeries (referHelper.js?8b7f:67) at createListFromArray (createListFromArray.js?3301:65) at ExtendedClass.getInitialData (LineSeries.js?217b:31) at ExtendedClass.init (Series.js?4f85:111) at ExtendedClass.eval (Global.js?7e63:218) at Array.forEach () at each (util.js?1ee1:298) at ExtendedClass.visitComponent (Global.js?7e63:192) isCategory @ referHelper.js?8b7f:139 cartesian2d @ referHelper.js?8b7f:85 getCoordSysDefineBySeries @ referHelper.js?8b7f:67 createListFromArray @ createListFromArray.js?3301:65 getInitialData @ LineSeries.js?217b:31 init @ Series.js?4f85:111 (anonymous) @ Global.js?7e63:218 each @ util.js?1ee1:298 visitComponent @ Global.js?7e63:192 entity.topologicalTravel @ component.js?8918:105 mergeOption @ Global.js?7e63:174 initBase @ Global.js?7e63:643 resetOption @ Global.js?7e63:121 setOption @ Global.js?7e63:103 echartsProto.setOption @ echarts.js?3eba:363 optionsHandler @ index.js?2819:1238 dataHandler @ index.js?2819:1157 (anonymous) @ index.js?2819:331 setTimeout (async) (anonymous) @ index.js?2819:330 handler @ index.js?2819:1088 run @ vue.runtime.esm.js?2b0e:3229 flushSchedulerQueue @ vue.runtime.esm.js?2b0e:2977 (anonymous) @ vue.runtime.esm.js?2b0e:1833 flushCallbacks @ vue.runtime.esm.js?2b0e:1754 Promise.then (async) microTimerFunc @ vue.runtime.esm.js?2b0e:1802 nextTick @ vue.runtime.esm.js?2b0e:1846 queueWatcher @ vue.runtime.esm.js?2b0e:3064 update @ vue.runtime.esm.js?2b0e:3205 notify @ vue.runtime.esm.js?2b0e:693 reactiveSetter @ vue.runtime.esm.js?2b0e:1010 (anonymous) @ AllCountBarChart.vue?2c80:124 Promise.then (async) getDeafaultShowMainData @ AllCountBarChart.vue?2c80:116 mounted @ AllCountBarChart.vue?2c80:101 callHook @ vue.runtime.esm.js?2b0e:2917 insert @ vue.runtime.esm.js?2b0e:4154 invokeInsertHook @ vue.runtime.esm.js?2b0e:5956 patch @ vue.runtime.esm.js?2b0e:6175 Vue._update @ vue.runtime.esm.js?2b0e:2656 updateComponent @ vue.runtime.esm.js?2b0e:2784 get @ vue.runtime.esm.js?2b0e:3138 Watcher @ vue.runtime.esm.js?2b0e:3127 mountComponent @ vue.runtime.esm.js?2b0e:2791 Vue.$mount @ vue.runtime.esm.js?2b0e:7995 (anonymous) @ main.js?2ee2:41 ./src/main.js @ app.js:17571 webpack_require @ app.js:768 fn @ app.js:131 0 @ app.js:20042 webpack_require @ app.js:768 (anonymous) @ app.js:904 (anonymous) @ app.js:907

Hi-yulin commented 5 years ago

yAxisName: ['数量','比例'], max:[10000,1] 用数组,