This commit is contained in:
Justineo
2018-01-15 00:49:51 +08:00
parent ec43f1c91a
commit 18aff09032
9 changed files with 37 additions and 56 deletions

View File

@ -17,13 +17,9 @@
auto-resize
/>
</figure>
<template v-if="seconds < 0">
<p><button @click="load">Load</button></p>
</template>
<template v-else>
<p v-if="seconds"><small>Data coming in <b>{{ seconds }}</b> second{{ seconds > 1 ? 's' : '' }}...</small></p>
<p v-else><small>Ready.</small></p>
</template>
<p v-if="seconds <= 0"><small>Loaded.</small></p>
<p v-else><small>Data coming in <b>{{ seconds }}</b> second{{ seconds > 1 ? 's' : '' }}...</small></p>
<p><button @click="refresh" :disabled="seconds > 0">Refresh</button></p>
<h2>Pie chart <small>(with action dispatch)</small></h2>
<figure>
@ -372,7 +368,7 @@ import 'echarts/lib/component/visualMap'
import 'echarts-liquidfill'
import logo from './data/logo'
import { initial as barInit, async as barAsync } from './data/bar'
import getBar from './data/bar'
import pie from './data/pie'
import polar from './data/polar'
import scatter from './data/scatter'
@ -403,7 +399,7 @@ export default {
data () {
return {
logo,
bar: barInit,
bar: getBar(),
pie,
polar,
scatter,
@ -435,7 +431,7 @@ export default {
}
},
methods: {
load () {
refresh () {
// simulating async data from server
this.seconds = 3
let bar = this.$refs.bar
@ -449,7 +445,7 @@ export default {
if (this.seconds === 0) {
clearTimeout(timer)
bar.hideLoading()
bar.mergeOptions(barAsync)
bar.mergeOptions(getBar())
}
}, 1000)
},

View File

@ -1,38 +1,23 @@
export let initial = {
title: {
text: '异步数据加载示例'
},
tooltip: {},
legend: {
data: ['销量']
},
xAxis: {
data: []
},
yAxis: {
axisLabel: {show: false}
},
series: [{
name: '销量',
type: 'bar',
data: []
}]
}
let asyncData = {
categories: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'],
data: [5, 20, 36, 10, 10, 20]
}
export let async = {
xAxis: {
data: asyncData.categories
},
yAxis: {
axisLabel: {show: true}
},
series: [{
name: '销量',
data: asyncData.data
}]
}
export default function getData () {
let items = ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
return {
title: {
text: '异步数据加载示例'
},
tooltip: {},
legend: {
data: ['销量']
},
xAxis: {
data: items
},
yAxis: {
axisLabel: {show: true}
},
series: [{
type: 'bar',
name: '销量',
data: items.map(() => Math.floor(Math.random() * 40 + 10))
}]
}
}

View File

@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=UTF-8><meta name=viewport content="width=device-width,minimum-scale=1,maximum-scale=1,user-scalable=no"><title>Vue-ECharts Demo</title><link rel=stylesheet href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600|Roboto Mono"><link rel=stylesheet href="//fonts.googleapis.com/css?family=Dosis:300,500&amp;text=Vue-ECharts"><link href=./static/css/app.3260a718b51053550a27986bd64fa6c4.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.e4c24d22db75c56392ed.js></script><script type=text/javascript src=./static/js/vendor.0453f4e8e617bca22c79.js></script><script type=text/javascript src=./static/js/app.68bbcc4d45a0f41f151a.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=UTF-8><meta name=viewport content="width=device-width,minimum-scale=1,maximum-scale=1,user-scalable=no"><title>Vue-ECharts Demo</title><link rel=stylesheet href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600|Roboto Mono"><link rel=stylesheet href="//fonts.googleapis.com/css?family=Dosis:300,500&amp;text=Vue-ECharts"><link href=./static/css/app.3260a718b51053550a27986bd64fa6c4.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.5e3a652737d19a61ebd8.js></script><script type=text/javascript src=./static/js/vendor.0453f4e8e617bca22c79.js></script><script type=text/javascript src=./static/js/app.d0c457ef49c2d5e3f3c3.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
!function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,i){for(var u,a,f,s=0,l=[];s<t.length;s++)a=t[s],o[a]&&l.push(o[a][0]),o[a]=0;for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(e[u]=c[u]);for(n&&n(t,c,i);l.length;)l.shift()();if(i)for(s=0;s<i.length;s++)f=r(r.s=i[s]);return f};var t={},o={2:0};r.e=function(e){function n(){i.onerror=i.onload=null,clearTimeout(u);var r=o[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}if(0===o[e])return Promise.resolve();if(o[e])return o[e][2];var t=new Promise(function(r,n){o[e]=[r,n]});o[e][2]=t;var c=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.charset="utf-8",i.async=!0,i.timeout=12e4,r.nc&&i.setAttribute("nonce",r.nc),i.src=r.p+"static/js/"+e+"."+{0:"0453f4e8e617bca22c79",1:"d0c457ef49c2d5e3f3c3"}[e]+".js";var u=setTimeout(n,12e4);return i.onerror=i.onload=n,c.appendChild(i),t},r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p=".",r.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.5e3a652737d19a61ebd8.js.map

View File

@ -1,2 +0,0 @@
!function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var i,u,f,s=0,l=[];s<t.length;s++)u=t[s],o[u]&&l.push(o[u][0]),o[u]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(n&&n(t,c,a);l.length;)l.shift()();if(a)for(s=0;s<a.length;s++)f=r(r.s=a[s]);return f};var t={},o={2:0};r.e=function(e){function n(){a.onerror=a.onload=null,clearTimeout(i);var r=o[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}if(0===o[e])return Promise.resolve();if(o[e])return o[e][2];var t=new Promise(function(r,n){o[e]=[r,n]});o[e][2]=t;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,r.nc&&a.setAttribute("nonce",r.nc),a.src=r.p+"static/js/"+e+"."+{0:"0453f4e8e617bca22c79",1:"68bbcc4d45a0f41f151a"}[e]+".js";var i=setTimeout(n,12e4);return a.onerror=a.onload=n,c.appendChild(a),t},r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p=".",r.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.e4c24d22db75c56392ed.js.map