From c85cc7dce37fbe0a83e76495a7d3a1cd16cdf114 Mon Sep 17 00:00:00 2001 From: quietcoder <1642965215@qq.com> Date: Mon, 10 Jul 2017 14:53:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E7=9A=84=20echarts=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=89=A9=E5=B1=95=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/echarts-lib.js | 37 +++++++++++++++++++++++++++++++------ src/mixins.js | 46 +++++++++++++++++++++++++++++++++++++++------- 3 files changed, 71 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 95c243f..7e34c28 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "v-charts", - "version": "1.2.9", + "version": "1.3.0", "description": "", "main": "lib/index.js", "scripts": { diff --git a/src/echarts-lib.js b/src/echarts-lib.js index 05678ae..dff7780 100644 --- a/src/echarts-lib.js +++ b/src/echarts-lib.js @@ -1,19 +1,44 @@ module.exports = [ 'echarts/lib/echarts', - 'echarts/lib/chart/bar', - 'echarts/lib/chart/funnel', + 'echarts/lib/chart/line', + 'echarts/lib/chart/bar', 'echarts/lib/chart/pie', - 'echarts/lib/chart/radar', 'echarts/lib/chart/scatter', - 'echarts/lib/component/tooltip', + 'echarts/lib/chart/radar', + 'echarts/lib/chart/map', + 'echarts/lib/chart/treemap', + 'echarts/lib/chart/graph', + 'echarts/lib/chart/gauge', + 'echarts/lib/chart/funnel', + 'echarts/lib/chart/parallel', + 'echarts/lib/chart/sankey', + 'echarts/lib/chart/boxplot', + 'echarts/lib/chart/candlestick', + 'echarts/lib/chart/effectScatter', + 'echarts/lib/chart/lines', + 'echarts/lib/chart/heatmap', + 'echarts/lib/chart/pictorialBar', + 'echarts/lib/chart/themeRiver', + 'echarts/lib/chart/custom', + + 'echarts/lib/component/graphic', + 'echarts/lib/component/grid', 'echarts/lib/component/legend', + 'echarts/lib/component/tooltip', + 'echarts/lib/component/axisPointer', + 'echarts/lib/component/polar', + 'echarts/lib/component/geo', + 'echarts/lib/component/parallel', + 'echarts/lib/component/singleAxis', + 'echarts/lib/component/brush', + 'echarts/lib/component/calendar', 'echarts/lib/component/title', + 'echarts/lib/component/dataZoom', + 'echarts/lib/component/visualMap', 'echarts/lib/component/markPoint', 'echarts/lib/component/markLine', 'echarts/lib/component/markArea', - 'echarts/lib/component/dataZoom', - 'echarts/lib/component/visualMap', 'echarts/lib/component/timeline', 'echarts/lib/component/toolbox' ] diff --git a/src/mixins.js b/src/mixins.js index bdc9549..64468d7 100644 --- a/src/mixins.js +++ b/src/mixins.js @@ -18,7 +18,22 @@ const chartMixin = { visualMap: { type: [Object, Array] }, dataZoom: { type: [Object, Array] }, toolbox: { type: Object }, - initOptions: { type: Object, default () { return {} } } + initOptions: { type: Object, default () { return {} } }, + title: Object, + legend: Object, + xAxis: Object, + yAxis: Object, + radar: Object, + tooltip: Object, + axisPointer: Object, + brush: Object, + geo: Object, + timeline: Object, + graphic: Object, + series: Object, + backgroundColor: [Object, String], + textStyle: Object, + animation: Object }, watch: { @@ -64,8 +79,6 @@ const chartMixin = { let options = this.chartHandler(columns, rows, this.settings, extra) if (options) { - if (this.colors) options.color = this.colors - if (this.grid) options.grid = this.grid if (this.legendPosition && options.legend) { options.legend[this.legendPosition] = 10 if (~['left', 'right'].indexOf(this.legendPosition)) { @@ -73,9 +86,30 @@ const chartMixin = { options.legend.orient = 'vertical' } } + if (this.colors) options.color = this.colors + if (this.grid) options.grid = this.grid if (this.dataZoom) options.dataZoom = this.dataZoom if (this.visualMap) options.visualMap = this.visualMap if (this.toolbox) options.toolbox = this.toolbox + if (this.title) options.title = this.title + if (this.legend) options.legend = this.legend + if (this.xAxis) options.xAxis = this.xAxis + if (this.yAxis) options.yAxis = this.yAxis + if (this.radar) options.radar = this.radar + if (this.tooltip) options.tooltip = this.tooltip + if (this.axisPointer) options.axisPointer = this.axisPointer + if (this.brush) options.brush = this.brush + if (this.geo) options.geo = this.geo + if (this.timeline) options.timeline = this.timeline + if (this.graphic) options.graphic = this.graphic + if (this.series) options.series = this.series + if (this.backgroundColor) options.backgroundColor = this.backgroundColor + if (this.textStyle) options.textStyle = this.textStyle + if (this.animation) { + Object.keys(this.animation).forEach(key => { + options[key] = this.animation[key] + }) + } if (this.markArea || this.markLine || this.markPoint) { const marks = { markArea: this.markArea, @@ -123,10 +157,8 @@ const chartMixin = { }, mounted () { - this.$nextTick(() => { - this.init() - window.addEventListener('resize', this.echarts.resize) - }) + this.init() + window.addEventListener('resize', this.echarts.resize) }, beforeDestory () {