You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2021/10/13 10:46:41 UTC
[echarts-bar-racing] branch master updated: feat: add
life-expectancy data
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-bar-racing.git
The following commit(s) were added to refs/heads/master by this push:
new ce1de0a feat: add life-expectancy data
ce1de0a is described below
commit ce1de0a451283defbd139c5f7fb0381aab6368df
Author: Ovilia <zw...@gmail.com>
AuthorDate: Wed Oct 13 18:46:31 2021 +0800
feat: add life-expectancy data
---
src/components/BBody.vue | 13 ++++++++++++-
src/components/BTable.vue | 22 ++++++++++------------
src/data/expectancy.ts | 1 +
src/data/fruit.ts | 8 ++++++++
4 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/src/components/BBody.vue b/src/components/BBody.vue
index d0d1638..7c57b3f 100644
--- a/src/components/BBody.vue
+++ b/src/components/BBody.vue
@@ -7,6 +7,13 @@
</h1>
<div id="el-config" class="align-middle">
<el-form ref="form" :disabled="isExportingVideo">
+ <h2>示例数据</h2>
+ <el-button @click="download" type="primary">
+ 清空
+ </el-button>
+
+ <el-divider></el-divider>
+
<h2>图表设置</h2>
<el-row>
<el-col :span="12">
@@ -35,7 +42,7 @@
size="medium"
class="col-span-2"
placeholder="为空则显示所有"
- v-model="maxDataCnt"
+ v-model.number="maxDataCnt"
@change="runChart"
>
</el-input>
@@ -126,6 +133,7 @@
>
<BTable
ref="btable"
+ :demoData="demoData"
@after-change="tableAfterChange"
/>
</el-card>
@@ -151,11 +159,14 @@ import {defineComponent} from 'vue';
import BTable, {ChartData} from './BTable.vue';
import BChart from './BChart.vue';
import template from '../helper/template';
+import fruit from '../data/fruit';
+import expectancy from '../data/expectancy';
export default defineComponent({
name: 'BBody',
data() {
return {
+ demoData: expectancy,
// @ts-ignore:
title: this.$i18n.t('defaultChartTitle'),
maxDataCnt: null,
diff --git a/src/components/BTable.vue b/src/components/BTable.vue
index c3b883a..318daed 100644
--- a/src/components/BTable.vue
+++ b/src/components/BTable.vue
@@ -35,21 +35,19 @@ function colorRenderer(instance, td, row, col, prop, value) {
export default defineComponent({
name: 'BTable',
props: {
+ demoData: Array
},
data() {
- return {
- tableData: [
- ['', 'blueberry', 'kiwi', 'banana', 'watermelon']
- // @ts-ignore:
- .map(name => name ? this.$i18n.t(name) : ''),
+ const data = this.demoData && this.demoData.length
+ ? [
+ // @ts-ignore:
+ this.demoData[0].map(name => name ? this.$i18n.t(name) : ''),
// @ts-ignore:
- [this.$i18n.t('color'), '', '', '', ''],
- ['2017', '13', '11', '12', '14'],
- ['2018', '20', '44', '34', '39'],
- ['2019', '62', '75', '58', '63'],
- ['2020', '98', '81', '78', '93'],
- ['2021', '139', '98', '88', '143']
- ],
+ [this.$i18n.t('color'), '', '', '', '']
+ ].concat(this.demoData.slice(1))
+ : [];
+ return {
+ tableData: data,
table: null,
debouncedTableChange: null
}
diff --git a/src/data/expectancy.ts b/src/data/expectancy.ts
new file mode 100644
index 0000000..230d59f
--- /dev/null
+++ b/src/data/expectancy.ts
@@ -0,0 +1 @@
+export default [["","Australia","Canada","China","Cuba","Finland","France","Germany","Iceland","India","Japan","North Korea","South Korea","New Zealand","Norway","Poland","Russia","Turkey","United Kingdom","United States"],["1800",34.05,39,32,32.2,36.5731262,33.96717024,38.37,42.84559912,25.4424,36.4,26,25.8,34.05,37.91620899,35.9,29.5734572,35,38.6497603,39.41],["1810",34.05,39.01496774,32,33.64,36.9473378,37.4,38.37,43.13915533,25.4424,36.40397538,26,25.8,34.05,36.47500606,35.9,29.5734 [...]
diff --git a/src/data/fruit.ts b/src/data/fruit.ts
new file mode 100644
index 0000000..cdf2bde
--- /dev/null
+++ b/src/data/fruit.ts
@@ -0,0 +1,8 @@
+export default [
+ ['', 'blueberry', 'kiwi', 'banana', 'watermelon'],
+ ['2017', '13', '11', '12', '14'],
+ ['2018', '20', '44', '34', '39'],
+ ['2019', '62', '75', '58', '63'],
+ ['2020', '98', '81', '78', '93'],
+ ['2021', '139', '98', '88', '143']
+];
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org