This is an automated email from the ASF dual-hosted git repository. shenyi pushed a commit to branch next in repository https://gitbox.apache.org/repos/asf/incubator-echarts-examples.git
The following commit(s) were added to refs/heads/next by this push: new c59ed28 show zh title with en subtitle in example page c59ed28 is described below commit c59ed2832e61d0fb770ea7e9a3814df16134a010 Author: pissang <bm2736...@gmail.com> AuthorDate: Tue Oct 27 13:53:31 2020 +0800 show zh title with en subtitle in example page --- public/data-gl/graphgl-npm-dep.js | 2 +- public/data/.eslintrc.yaml | 1 + public/data/bar-background.js | 2 +- public/data/bar-histogram.js | 3 ++- public/data/bar-rich-text.js | 1 + public/data/bar-simple.js | 3 ++- public/data/boxplot-light-velocity.js | 2 +- public/data/calendar-lunar.js | 2 +- public/data/candlestick-simple.js | 2 +- public/data/custom-bar-trend.js | 2 +- public/data/custom-calendar-icon.js | 2 +- public/data/custom-error-bar.js | 2 +- public/data/custom-error-scatter.js | 2 +- public/data/custom-hexbin.js | 2 +- public/data/custom-ohlc.js | 2 +- public/data/custom-polar-heatmap.js | 2 +- public/data/custom-profile.js | 2 +- public/data/custom-profit.js | 2 +- public/data/custom-wind.js | 23 ++++++++++++++++++++++- public/data/graph-npm.js | 2 +- public/data/graph-webkit-dep.js | 2 +- public/data/line-simple.js | 2 +- public/data/line-smooth.js | 2 +- public/data/line-style.js | 2 +- public/data/line-tooltip-touch.js | 2 +- public/data/mix-zoom-on-value.js | 2 +- public/data/parallel-aqi.js | 2 +- public/data/parallel-nutrients.js | 2 +- public/data/parallel-simple.js | 2 +- public/data/pie-custom.js | 14 ++++++++------ public/data/sankey-simple.js | 2 +- public/data/sankey-vertical.js | 2 +- public/data/scatter-clustering-process.js | 2 +- public/data/scatter-effect.js | 2 +- public/data/scatter-exponential-regression.js | 2 +- public/data/scatter-linear-regression.js | 2 +- public/data/scatter-logarithmic-regression.js | 2 +- public/data/scatter-matrix.js | 2 +- public/data/scatter-nebula.js | 1 + public/data/scatter-polar-punchCard.js | 2 +- public/data/scatter-polynomial-regression.js | 2 +- public/data/scatter-punchCard.js | 2 +- public/data/scatter-simple.js | 2 +- public/data/sunburst-book.js | 2 +- public/data/sunburst-label-rotate.js | 2 +- public/data/sunburst-visualMap.js | 2 +- public/data/treemap-show-parent.js | 2 +- public/data/treemap-simple.js | 2 +- src/explore/ExampleCard.vue | 21 ++++++++++++++++++++- 49 files changed, 98 insertions(+), 51 deletions(-) diff --git a/public/data-gl/graphgl-npm-dep.js b/public/data-gl/graphgl-npm-dep.js index 489fcfb..5b8ac35 100644 --- a/public/data-gl/graphgl-npm-dep.js +++ b/public/data-gl/graphgl-npm-dep.js @@ -1,5 +1,5 @@ /* -title: 1w 节点 2w7 边的NPM 依赖图 +title: NPM Dependencies with graphGL category: graphGL theme: dark titleCN: 1w 节点 2w7 边的NPM 依赖图 diff --git a/public/data/.eslintrc.yaml b/public/data/.eslintrc.yaml index b0111b4..e208285 100644 --- a/public/data/.eslintrc.yaml +++ b/public/data/.eslintrc.yaml @@ -3,5 +3,6 @@ env: globals: myChart: true option: true + echarts: true extends: '../../.eslintrc.yaml' \ No newline at end of file diff --git a/public/data/bar-background.js b/public/data/bar-background.js index 4c5df81..74d9ce0 100644 --- a/public/data/bar-background.js +++ b/public/data/bar-background.js @@ -1,7 +1,7 @@ /* title: Bar with Background -titleCN: 带背景色的柱状图 category: bar +titleCN: 带背景色的柱状图 difficulty: 0 */ diff --git a/public/data/bar-histogram.js b/public/data/bar-histogram.js index 42e1ab1..be0b6ec 100644 --- a/public/data/bar-histogram.js +++ b/public/data/bar-histogram.js @@ -1,6 +1,7 @@ /* -title: Girths of Black Cherry Trees +title: Histogram with Custom Series category: custom +titleCN: 直方图(自定义系列) difficulty: 0 */ diff --git a/public/data/bar-rich-text.js b/public/data/bar-rich-text.js index 43d0bff..2fa6a32 100644 --- a/public/data/bar-rich-text.js +++ b/public/data/bar-rich-text.js @@ -1,6 +1,7 @@ /* title: Wheater Statistics category: 'bar, rich' +titleCN: 天气统计(富文本) difficulty: 6 */ diff --git a/public/data/bar-simple.js b/public/data/bar-simple.js index f0f9293..6a584f3 100644 --- a/public/data/bar-simple.js +++ b/public/data/bar-simple.js @@ -1,6 +1,7 @@ /* -title: Bar Simple +title: Basic Bar category: bar +titleCN: 基础柱状图 difficulty: 0 */ diff --git a/public/data/boxplot-light-velocity.js b/public/data/boxplot-light-velocity.js index dcee9a0..a6d3afc 100644 --- a/public/data/boxplot-light-velocity.js +++ b/public/data/boxplot-light-velocity.js @@ -8,7 +8,7 @@ option = { title: [ { text: 'Michelson-Morley Experiment', - left: 'center', + left: 'center' }, { text: 'upper: Q3 + 1.5 * IQR \nlower: Q1 - 1.5 * IQR', diff --git a/public/data/calendar-lunar.js b/public/data/calendar-lunar.js index 5325063..16856cd 100644 --- a/public/data/calendar-lunar.js +++ b/public/data/calendar-lunar.js @@ -1,7 +1,7 @@ /* title: Calendar Lunar category: calendar -titleCN: Calendar Lunar +titleCN: 农历日历图 difficulty: 4 */ diff --git a/public/data/candlestick-simple.js b/public/data/candlestick-simple.js index 244fca8..a5dbdff 100644 --- a/public/data/candlestick-simple.js +++ b/public/data/candlestick-simple.js @@ -1,7 +1,7 @@ /* title: Basic Candlestick category: candlestick -titleCN: Basic Candlestick +titleCN: 基础 K 线图 difficulty: 0 */ diff --git a/public/data/custom-bar-trend.js b/public/data/custom-bar-trend.js index 3fed62c..11b6d75 100644 --- a/public/data/custom-bar-trend.js +++ b/public/data/custom-bar-trend.js @@ -1,7 +1,7 @@ /* title: Custom Bar Trend category: custom -titleCN: Custom Bar Trend +titleCN: 使用自定义系列添加柱状图趋势 difficulty: 3 */ diff --git a/public/data/custom-calendar-icon.js b/public/data/custom-calendar-icon.js index 7df7026..0841e44 100644 --- a/public/data/custom-calendar-icon.js +++ b/public/data/custom-calendar-icon.js @@ -1,7 +1,7 @@ /* title: Custom Calendar Icon category: 'custom, calendar' -titleCN: Custom Calendar Icon +titleCN: 日历图自定义图标 difficulty: 7 */ diff --git a/public/data/custom-error-bar.js b/public/data/custom-error-bar.js index 70e6526..429d9b2 100644 --- a/public/data/custom-error-bar.js +++ b/public/data/custom-error-bar.js @@ -1,7 +1,7 @@ /* title: Error Bar on Catesian category: custom -titleCN: Error Bar on Catesian +titleCN: 使用自定系列给柱状图添加误差范围 difficulty: 3 */ diff --git a/public/data/custom-error-scatter.js b/public/data/custom-error-scatter.js index 18d3b37..df10d2e 100644 --- a/public/data/custom-error-scatter.js +++ b/public/data/custom-error-scatter.js @@ -1,7 +1,7 @@ /* title: Error Scatter on Catesian category: 'custom, dataZoom' -titleCN: Error Scatter on Catesian +titleCN: 使用自定系列给散点图添加误差范围 difficulty: 2 */ diff --git a/public/data/custom-hexbin.js b/public/data/custom-hexbin.js index 4b8a870..e67b496 100644 --- a/public/data/custom-hexbin.js +++ b/public/data/custom-hexbin.js @@ -1,7 +1,7 @@ /* title: Hexagonal Binning category: 'custom, map' -titleCN: Hexagonal Binning +titleCN: 六边形分箱图(自定义系列) difficulty: 6 */ diff --git a/public/data/custom-ohlc.js b/public/data/custom-ohlc.js index 504d31e..a33f965 100644 --- a/public/data/custom-ohlc.js +++ b/public/data/custom-ohlc.js @@ -1,7 +1,7 @@ /* title: OHLC Chart category: candlestick -titleCN: OHLC Chart +titleCN: OHLC 图(使用自定义系列) difficulty: 1 */ diff --git a/public/data/custom-polar-heatmap.js b/public/data/custom-polar-heatmap.js index 9a9fe09..c5e32f2 100644 --- a/public/data/custom-polar-heatmap.js +++ b/public/data/custom-polar-heatmap.js @@ -1,7 +1,7 @@ /* title: Polar Heatmap category: custom -titleCN: Polar Heatmap +titleCN: 极坐标热力图(自定义系列) difficulty: 4 */ diff --git a/public/data/custom-profile.js b/public/data/custom-profile.js index 7f80d2c..d7b4876 100644 --- a/public/data/custom-profile.js +++ b/public/data/custom-profile.js @@ -1,7 +1,7 @@ /* title: Profile category: custom -titleCN: Profile +titleCN: 性能分析图 difficulty: 3 */ diff --git a/public/data/custom-profit.js b/public/data/custom-profit.js index e266508..5fc8b77 100644 --- a/public/data/custom-profit.js +++ b/public/data/custom-profit.js @@ -1,7 +1,7 @@ /* title: Profit category: custom -titleCN: Profit +titleCN: 利润分布直方图 difficulty: 1 */ diff --git a/public/data/custom-wind.js b/public/data/custom-wind.js index 194a107..790ae1b 100644 --- a/public/data/custom-wind.js +++ b/public/data/custom-wind.js @@ -5,6 +5,27 @@ category: custom difficulty: 7 */ +function shuffle(array) { + // https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array + var currentIndex = array.length; + var temporaryValue; + var randomIndex; + + // While there remain elements to shuffle... + while (0 !== currentIndex) { + // Pick a remaining element... + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } + + return array; +} + $.getJSON(ROOT_PATH + '/data-gl/asset/data/winds.json', function (windData) { var p = 0; var maxMag = 0; @@ -28,7 +49,7 @@ $.getJSON(ROOT_PATH + '/data-gl/asset/data/winds.json', function (windData) { minMag = Math.min(mag, minMag); } } - data.reverse(); + shuffle(data); myChart.setOption(option = { backgroundColor: '#333', diff --git a/public/data/graph-npm.js b/public/data/graph-npm.js index e608a35..629db23 100644 --- a/public/data/graph-npm.js +++ b/public/data/graph-npm.js @@ -1,7 +1,7 @@ /* title: NPM Dependencies category: graph -titleCN: NPM Dependencies +titleCN: NPM 依赖关系图 */ myChart.showLoading(); diff --git a/public/data/graph-webkit-dep.js b/public/data/graph-webkit-dep.js index ab962e7..6890b0b 100644 --- a/public/data/graph-webkit-dep.js +++ b/public/data/graph-webkit-dep.js @@ -1,7 +1,7 @@ /* title: Graph Webkit Dep category: graph -titleCN: Graph Webkit Dep +titleCN: WebKit 模块关系依赖图 */ myChart.showLoading(); diff --git a/public/data/line-simple.js b/public/data/line-simple.js index 12164c6..9b0371d 100644 --- a/public/data/line-simple.js +++ b/public/data/line-simple.js @@ -1,7 +1,7 @@ /* title: Basic Line Chart category: line -titleCN: Basic Line Chart +titleCN: 基础折线图 difficulty: 0 */ diff --git a/public/data/line-smooth.js b/public/data/line-smooth.js index 08f7082..775c37a 100644 --- a/public/data/line-smooth.js +++ b/public/data/line-smooth.js @@ -1,7 +1,7 @@ /* title: Smoothed Line Chart category: line -titleCN: Smoothed Line Chart +titleCN: 基础平滑折线图 difficulty: 0 */ diff --git a/public/data/line-style.js b/public/data/line-style.js index 18725e5..153c0ed 100644 --- a/public/data/line-style.js +++ b/public/data/line-style.js @@ -1,7 +1,7 @@ /* title: Line Style and Item Style category: line -titleCN: Line Style and Item Style +titleCN: 自定义折线图样式 difficulty: 6 */ diff --git a/public/data/line-tooltip-touch.js b/public/data/line-tooltip-touch.js index 5520dee..c494ad6 100644 --- a/public/data/line-tooltip-touch.js +++ b/public/data/line-tooltip-touch.js @@ -1,7 +1,7 @@ /* title: Tooltip and DataZoom on Mobile category: 'line, dataZoom' -titleCN: Tooltip and DataZoom on Mobile +titleCN: 移动端上的 dataZoom 和 tooltip difficulty: 10 */ diff --git a/public/data/mix-zoom-on-value.js b/public/data/mix-zoom-on-value.js index 33d095e..63d9408 100644 --- a/public/data/mix-zoom-on-value.js +++ b/public/data/mix-zoom-on-value.js @@ -1,7 +1,7 @@ /* title: Mix Zoom On Value category: bar -titleCN: Mix Zoom On Value +titleCN: 多数值轴轴缩放 difficulty: 4 */ diff --git a/public/data/parallel-aqi.js b/public/data/parallel-aqi.js index 3ce66aa..7799f6a 100644 --- a/public/data/parallel-aqi.js +++ b/public/data/parallel-aqi.js @@ -1,7 +1,7 @@ /* title: Parallel Aqi category: parallel -titleCN: Parallel Aqi +titleCN: AQI 分布(平行坐标) difficulty: 2 */ diff --git a/public/data/parallel-nutrients.js b/public/data/parallel-nutrients.js index f08935c..75662b6 100644 --- a/public/data/parallel-nutrients.js +++ b/public/data/parallel-nutrients.js @@ -1,7 +1,7 @@ /* title: Parallel Nutrients category: parallel -titleCN: Parallel Nutrients +titleCN: 营养结构(平行坐标) difficulty: 4 */ diff --git a/public/data/parallel-simple.js b/public/data/parallel-simple.js index d67f001..ccab0a0 100644 --- a/public/data/parallel-simple.js +++ b/public/data/parallel-simple.js @@ -1,7 +1,7 @@ /* title: Basic Parallel category: parallel -titleCN: Basic Parallel +titleCN: 基础平行坐标 difficulty: 1 */ diff --git a/public/data/pie-custom.js b/public/data/pie-custom.js index 57f6b8f..0efe9e1 100644 --- a/public/data/pie-custom.js +++ b/public/data/pie-custom.js @@ -1,7 +1,7 @@ /* title: Customized Pie category: pie -titleCN: Customized Pie +titleCN: 饼图自定义样式 difficulty: 2 */ @@ -11,9 +11,9 @@ option = { left: 'center', top: 20, textStyle: { - fontSize: 24, - }, - + fontSize: 24 + } + }, tooltip: { trigger: 'item', @@ -39,10 +39,12 @@ option = { {value: 324, name: '文艺'}, {value: 265, name: '喜剧'}, {value: 230, name: '其他'} - ].sort(function (a, b) { return a.value - b.value; }), + ].sort(function (a, b) { + return a.value - b.value; + }), roseType: 'radius', label: { - fontSize: 14, + fontSize: 14 }, labelLine: { smooth: 0.2, diff --git a/public/data/sankey-simple.js b/public/data/sankey-simple.js index 3c87665..fa0f5f1 100644 --- a/public/data/sankey-simple.js +++ b/public/data/sankey-simple.js @@ -1,7 +1,7 @@ /* title: Basic Sankey category: sankey -titleCN: Basic Sankey +titleCN: 基础桑基图 difficulty: 0 */ diff --git a/public/data/sankey-vertical.js b/public/data/sankey-vertical.js index a88b8f4..eb76f8e 100644 --- a/public/data/sankey-vertical.js +++ b/public/data/sankey-vertical.js @@ -1,7 +1,7 @@ /* title: Sankey Orient Vertical category: sankey -titleCN: Sankey Orient Vertical +titleCN: 垂直方向的桑基图 difficulty: 1 */ diff --git a/public/data/scatter-clustering-process.js b/public/data/scatter-clustering-process.js index a2db127..89b4807 100644 --- a/public/data/scatter-clustering-process.js +++ b/public/data/scatter-clustering-process.js @@ -1,7 +1,7 @@ /* title: Clustering Process category: scatter -titleCN: Clustering Process +titleCN: 聚合过程可视化 difficulty: 1 */ diff --git a/public/data/scatter-effect.js b/public/data/scatter-effect.js index 51a7057..0765d74 100644 --- a/public/data/scatter-effect.js +++ b/public/data/scatter-effect.js @@ -1,7 +1,7 @@ /* title: Effect Scatter Chart category: scatter -titleCN: Effect Scatter Chart +titleCN: 涟漪特效散点图 difficulty: 2 */ diff --git a/public/data/scatter-exponential-regression.js b/public/data/scatter-exponential-regression.js index 0556a5b..f753c15 100644 --- a/public/data/scatter-exponential-regression.js +++ b/public/data/scatter-exponential-regression.js @@ -1,7 +1,7 @@ /* title: Exponential Regression category: scatter -titleCN: Exponential Regression +titleCN: 指数回归(使用统计插件) difficulty: 1 */ diff --git a/public/data/scatter-linear-regression.js b/public/data/scatter-linear-regression.js index 47adca0..f2144e9 100644 --- a/public/data/scatter-linear-regression.js +++ b/public/data/scatter-linear-regression.js @@ -1,7 +1,7 @@ /* title: Linear Regression category: scatter -titleCN: Linear Regression +titleCN: 线性回归(使用统计插件) difficulty: 2 */ diff --git a/public/data/scatter-logarithmic-regression.js b/public/data/scatter-logarithmic-regression.js index 00648f8..048cbc7 100644 --- a/public/data/scatter-logarithmic-regression.js +++ b/public/data/scatter-logarithmic-regression.js @@ -1,7 +1,7 @@ /* title: Logarithmic Regression category: scatter -titleCN: Logarithmic Regression +titleCN: 对数回归(使用统计插件) difficulty: 16 */ diff --git a/public/data/scatter-matrix.js b/public/data/scatter-matrix.js index cf60d6b..68c1c0e 100644 --- a/public/data/scatter-matrix.js +++ b/public/data/scatter-matrix.js @@ -1,7 +1,7 @@ /* title: Scatter Matrix category: 'parallel, scatter' -titleCN: Scatter Matrix +titleCN: 散点矩阵和平行坐标 difficulty: 10 */ diff --git a/public/data/scatter-nebula.js b/public/data/scatter-nebula.js index 87345f2..b7b9aaf 100644 --- a/public/data/scatter-nebula.js +++ b/public/data/scatter-nebula.js @@ -1,6 +1,7 @@ /* title: Scatter Nebula category: scatter +titleCN: 大规模星云散点图 difficulty: 5 */ diff --git a/public/data/scatter-polar-punchCard.js b/public/data/scatter-polar-punchCard.js index e4bad5a..9b7741e 100644 --- a/public/data/scatter-polar-punchCard.js +++ b/public/data/scatter-polar-punchCard.js @@ -1,7 +1,7 @@ /* title: Punch Card of Github category: scatter -titleCN: Punch Card of Github +titleCN: GitHub 打卡气泡图(极坐标) difficulty: 8 */ diff --git a/public/data/scatter-polynomial-regression.js b/public/data/scatter-polynomial-regression.js index 290a245..440f442 100644 --- a/public/data/scatter-polynomial-regression.js +++ b/public/data/scatter-polynomial-regression.js @@ -1,7 +1,7 @@ /* title: Polynomial Regression category: scatter -titleCN: Polynomial Regression +titleCN: 多项式回归(使用统计插件) difficulty: 2 */ diff --git a/public/data/scatter-punchCard.js b/public/data/scatter-punchCard.js index 32c0b81..66faea8 100644 --- a/public/data/scatter-punchCard.js +++ b/public/data/scatter-punchCard.js @@ -1,7 +1,7 @@ /* title: Punch Card of Github category: scatter -titleCN: Punch Card of Github +titleCN: GitHub 打卡气泡图 difficulty: 3 */ diff --git a/public/data/scatter-simple.js b/public/data/scatter-simple.js index 1d65c9b..0338a35 100644 --- a/public/data/scatter-simple.js +++ b/public/data/scatter-simple.js @@ -1,7 +1,7 @@ /* title: Basic Scatter Chart category: scatter -titleCN: 'Basic Scatter Chart,' +titleCN: 基础散点图 difficulty: 0 */ diff --git a/public/data/sunburst-book.js b/public/data/sunburst-book.js index 5e4a534..a0c95a7 100644 --- a/public/data/sunburst-book.js +++ b/public/data/sunburst-book.js @@ -1,7 +1,7 @@ /* title: Book Records category: sunburst -titleCN: Book Records +titleCN: 书籍分布 difficulty: 6 */ diff --git a/public/data/sunburst-label-rotate.js b/public/data/sunburst-label-rotate.js index eea5191..653475d 100644 --- a/public/data/sunburst-label-rotate.js +++ b/public/data/sunburst-label-rotate.js @@ -1,7 +1,7 @@ /* title: Sunburst Label Rotate category: sunburst -titleCN: Sunburst Label Rotate +titleCN: 旭日图标签旋转 difficulty: 3 */ diff --git a/public/data/sunburst-visualMap.js b/public/data/sunburst-visualMap.js index 29780a3..223e9a4 100644 --- a/public/data/sunburst-visualMap.js +++ b/public/data/sunburst-visualMap.js @@ -1,7 +1,7 @@ /* title: Sunburst VisualMap category: sunburst -titleCN: Sunburst VisualMap +titleCN: 旭日图使用视觉编码 difficulty: 4 */ diff --git a/public/data/treemap-show-parent.js b/public/data/treemap-show-parent.js index 51d17a1..90ccf0d 100644 --- a/public/data/treemap-show-parent.js +++ b/public/data/treemap-show-parent.js @@ -1,7 +1,7 @@ /* title: Show Parent Labels category: treemap -titleCN: Show Parent Labels +titleCN: 显示父层级标签 */ myChart.showLoading(); diff --git a/public/data/treemap-simple.js b/public/data/treemap-simple.js index 061414e..57d7d1d 100644 --- a/public/data/treemap-simple.js +++ b/public/data/treemap-simple.js @@ -1,7 +1,7 @@ /* title: Basic Treemap category: treemap -titleCN: Basic Treemap +titleCN: 基础矩形树图 */ option = { diff --git a/src/explore/ExampleCard.vue b/src/explore/ExampleCard.vue index f1dfd8c..0e6fc3e 100644 --- a/src/explore/ExampleCard.vue +++ b/src/explore/ExampleCard.vue @@ -2,7 +2,8 @@ <div class="example-list-item"> <a target="_blank" class="example-link" :href="exampleLink"> <img class="chart-area" src="../asset/placeholder.jpg" :data-src="screenshotURL" /> - <h4 class="example-title">{{example.title || ''}}</h4> + <h4 class="example-title">{{title}}</h4> + <h5 class="example-subtitle" v-if="title !== subtitle">{{subtitle}}</h5> </a> </div> </template> @@ -17,6 +18,15 @@ export default { computed: { + title() { + return (store.locale === 'zh' ? this.example.titleCN : this.example.title) + || this.example.title || ''; + }, + + subtitle() { + return this.example.title || ''; + }, + exampleTheme() { const example = this.example; return example.isGL ? '' : (example.theme || (store.darkMode ? 'dark' : '')); @@ -87,6 +97,15 @@ export default { font-size: 14px; text-align: center; } + + .example-subtitle { + font-size: 12px; + text-align: center; + color: #aaa; + font-weight: normal; + // font-weight: 200; + margin: 3px 0 0 0; + } } .example-info { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org