34 |
35 |
36 |
85 |
86 |
106 |
--------------------------------------------------------------------------------
/configs/config.asf.js:
--------------------------------------------------------------------------------
1 | export default {
2 | routerBase: '/handbook',
3 | rootPath: 'https://echarts.apache.org/handbook/',
4 | exampleViewPath: 'https://echarts.apache.org/examples/${lang}/view.html?c=',
5 | exampleEditorPath:
6 | 'https://echarts.apache.org/examples/${lang}/editor.html?c=',
7 | mainSitePath: 'https://echarts.apache.org/',
8 | optionPath: 'https://echarts.apache.org/option.html#',
9 | gitRepo: 'apache/echarts-handbook'
10 | }
11 |
--------------------------------------------------------------------------------
/configs/config.dev.js:
--------------------------------------------------------------------------------
1 | export default {
2 | routerBase: '/echarts-handbook/dist',
3 | rootPath: 'http://localhost:3000/echarts-handbook/dist/',
4 | exampleViewPath:
5 | 'http://localhost/echarts-examples/public/${lang}/view.html?c=',
6 | exampleEditorPath:
7 | 'http://localhost/echarts-examples/public/${lang}/editor.html?c=',
8 | mainSitePath: 'http://localhost/echarts-website/',
9 | optionPath: 'http://localhost/echarts-website/option.html#',
10 | gitRepo: 'apache/echarts-handbook'
11 | }
12 |
--------------------------------------------------------------------------------
/configs/config.gh.js:
--------------------------------------------------------------------------------
1 | export default {
2 | routerBase: '/echarts-handbook',
3 | rootPath: 'https://apache.github.io/echarts-handbook/',
4 | exampleViewPath: 'https://echarts.apache.org/examples/${lang}/view.html?c=',
5 | exampleEditorPath:
6 | 'https://echarts.apache.org/examples/${lang}/editor.html?c=',
7 | mainSitePath: 'https://echarts.apache.org/',
8 | optionPath: 'https://echarts.apache.org/option.html#',
9 | gitRepo: 'apache/echarts-handbook'
10 | }
11 |
--------------------------------------------------------------------------------
/configs/config.js:
--------------------------------------------------------------------------------
1 | import configDev from './config.dev'
2 | import configGh from './config.gh'
3 | import configAsf from './config.asf'
4 | import configLocal from './config.local'
5 | import configLocalSite from './config.localsite'
6 |
7 | const deployConfigs = {
8 | gh: configGh,
9 | asf: configAsf,
10 | local: configLocal,
11 | localsite: configLocalSite
12 | }
13 |
14 | function getDeployConfig() {
15 | const deployTarget = process.env.NUXT_ENV_DEPLOY
16 |
17 | if (!deployTarget) {
18 | throw `process.env.NUXT_ENV_DEPLOY not exits`
19 | }
20 | if (!deployConfigs[deployTarget]) {
21 | throw `Deploy config ${deployTarget} not exits`
22 | }
23 | return deployConfigs[deployTarget]
24 | }
25 |
26 | const isProduction = process.env.NODE_ENV === 'production'
27 | const config = isProduction ? getDeployConfig() : configDev
28 |
29 | export default config
30 |
--------------------------------------------------------------------------------
/configs/config.local.js:
--------------------------------------------------------------------------------
1 | export default {
2 | routerBase: '/echarts-handbook/dist',
3 | rootPath: 'http://localhost/echarts-handbook/dist/',
4 | exampleViewPath:
5 | 'http://localhost/echarts-website/examples/${lang}/view.html?c=',
6 | exampleEditorPath:
7 | 'http://localhost/echarts-website/examples/${lang}/editor.html?c=',
8 | mainSitePath: 'http://localhost/echarts-website/',
9 | optionPath: 'http://localhost/echarts-website/option.html#',
10 | gitRepo: 'apache/echarts-handbook'
11 | }
12 |
--------------------------------------------------------------------------------
/configs/config.localsite.js:
--------------------------------------------------------------------------------
1 | export default {
2 | routerBase: '/echarts-website/handbook',
3 | rootPath: 'http://localhost/echarts-website/handbook',
4 | exampleViewPath:
5 | 'http://localhost/echarts-website/examples/${lang}/view.html?c=',
6 | exampleEditorPath:
7 | 'http://localhost/echarts-website/examples/${lang}/editor.html?c=',
8 | mainSitePath: 'http://localhost/echarts-website/',
9 | optionPath: 'http://localhost/echarts-website/option.html#',
10 | gitRepo: 'apache/echarts-handbook'
11 | }
12 |
--------------------------------------------------------------------------------
/contents/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "semi": true,
4 | "singleQuote": true
5 | }
6 |
--------------------------------------------------------------------------------
/contents/en/basics/download.md:
--------------------------------------------------------------------------------
1 | # Get Apache ECharts
2 |
3 | Apache ECharts offers a variety of installation options, so you can choose any of the following options depending on your project.
4 |
5 | - Install From npm
6 | - Use From CDN
7 | - Download From GitHub
8 | - Online Customization
9 |
10 | We'll go over each of these installation methods and the directory structure after download.
11 |
12 | ## Installation
13 |
14 | ### Install From npm
15 |
16 | ```sh
17 | npm install echarts
18 | ```
19 |
20 | See [Import ECharts](${lang}/basics/import) for details on usage.
21 |
22 | ### Use From CDN
23 |
24 | ECharts is available on the following free CDNs:
25 |
26 | - [jsDelivr](https://www.jsdelivr.com/package/npm/echarts)
27 | - [unpkg](https://unpkg.com/browse/echarts/)
28 | - [cdnjs](https://cdnjs.com/libraries/echarts)
29 |
30 | ### Download From GitHub
31 |
32 | You can find links to each version on the [releases](https://github.com/apache/echarts/releases) page of the [apache/echarts project](https://github.com/apache/echarts). Click on the Source code under Assets at the bottom of the desired release version. After downloading, unzip the file and locate `echarts.js` file in the `dist` folder to include the full ECharts functionality.
33 |
34 | ### Online Customization
35 |
36 | If you want to introduce only some modules to reduce package size, you can use the [ECharts online customization](${mainSitePath}builder.html) function to create a customized download of ECharts.
37 |
--------------------------------------------------------------------------------
/contents/en/basics/help.md:
--------------------------------------------------------------------------------
1 | # Get Help
2 |
3 | ## Technical Problems
4 |
5 | ### Make sure that existing documentation do not solve your problem
6 |
7 | ECharts has a very large number of users, so it's more than likely that someone else has encountered and solved the problem you've had. By reading the documentation and using the search engine, you can solve your problem quickly by yourself without help from the community.
8 |
9 | Therefore, before doing anything else, make sure that current documentation and other resources can't solve your problem. Resources that can be helpful for you include,
10 |
11 | - [API](${mainSitePath}api.html)
12 | - [Option Manual](${mainSitePath}option.html) - you can try to use the search function
13 | - Articles in this handbook
14 | - [FAQ](${mainSitePath}faq.html)
15 | - Searching in [GitHub issue](https://github.com/apache/echarts/issues)
16 | - Using the search engine
17 |
18 | ### Create the Minimal Reproducible Demo
19 |
20 | Create an example on [Official Editor](${mainSitePath}examples/editor.html), [CodePen](https://codepen.io/Ovilia/pen/dyYWXWM), [CodeSandbox](https://codesandbox.io/s/echarts-basic-example-template-mpfz1s) or [JSFiddle](https://jsfiddle.net/plainheart/e46ozpqj/7/), which will make it easier for others to reproduce your problem.
21 |
22 | The example should reproduce your problem in the simplest way. Removing unnecessary code and data can enable those who want to help you to locate and then solve the problem more quickly. Please refer to [How to Create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) for more details.
23 |
24 | ### Determining if It's a Bug
25 |
26 | #### Report a Bug or Request a New Feature
27 |
28 | If some behavior is different from the documentation or isn't what you expected, it's probably a bug. If it's a bug, or you have a feature request, please use the [issue template](https://github.com/apache/echarts/issues/new/choose) to create a new issue and describe it in detail as per the prompts.
29 |
30 | #### How-To Questions
31 |
32 | If it's not a bug, but you don't know how to achieve something, try the stackoverflow.com
33 |
34 | If you don't get an answer, you can also send an email to [dev@echarts.apache.org](mailto:dev@echarts.apache.org). In order for more people to understand your question and to get help in future searches, it is highly recommended to write the email in English.
35 |
36 | ## Non-technical questions
37 |
38 | For other non-technical questions, you can send an email in English to [dev@echarts.apache.org](mailto:dev@echarts.apache.org).
39 |
--------------------------------------------------------------------------------
/contents/en/basics/inspiration.md:
--------------------------------------------------------------------------------
1 | # Get Inspired
2 |
3 | The following list provides some ideas when you have a question "I don't know how to design a chart" or "I don't know how to use Apache ECharts to achieve a certain effect".
4 |
5 | - [Apache ECharts Official Examples](${mainSitePath}/examples)
6 | - "How To Guides - Common Charts" in this handbook
7 |
--------------------------------------------------------------------------------
/contents/en/basics/release-note/5-4-0.md:
--------------------------------------------------------------------------------
1 | # Apache ECharts 5.4.0 Features
2 |
3 | ## Intelligent Pointer Snapping
4 |
5 | Some interactive elements may be relatively small in charts, so sometimes it is difficult for users to click and do other operations accurately, especially on the mobile. Therefore, in Apache ECharts 5.4.0, we introduced the concept of "intelligent pointer snapping".
6 |
7 | See [intelligent pointer snapping](${lang}/how-to/interaction/coarse-pointer) for details.
8 |
9 | ## Using Pie charts in more coordinate systems
10 |
11 | A very powerful feature of Apache ECharts is the combination of various chart types, coordinate systems, and components. In this version, we have added the coordinate systems option for pie charts.
12 |
13 | Thus, pie charts can appear in the Cartesian coordinate systems,
14 |
15 | 
16 |
17 | calendar coordinate systems,
18 |
19 | 
20 |
21 | geographical coordinate systems,
22 |
23 | 
24 |
25 | and even with the Baidu Map and Gaode Map extension.
26 |
27 | 
28 |
29 | 
30 |
31 | This greatly extends the flexibility of pie charts, allowing developers to create more combinations of chart effects using Apache ECharts.
32 |
33 | ## Ukrainian Translation
34 |
35 | In this release, we added the support of the Ukrainian language. **Now Apache ECharts supports 17 languages!**
36 |
37 | > If you need to use a language other than English or Chinese, you need to call `echarts.registerLocale` to initialize the chart before initializing it, and then pass `opts.locale` to modify the chart language during `init`.
38 |
39 | ## Gauge Label Rotation
40 |
41 | In this version, we support text rotation of the Gauge series.
42 |
43 |
44 |
45 | `axisLabel.rotate` can be set to `'tangential' | 'radial' | number`. If it is of type `number`, it indicates the rotation angle of the label from -90 degrees to 90 degrees, with positive values being counterclockwise. In addition to this, it can also be the strings `'radial'` for radial rotation and `'tangential'` for tangential rotation.
46 |
47 | ## Full Changelog
48 |
49 | View the [Changelog](${mainSitePath}/changelog.html#v5-4-0)
50 |
--------------------------------------------------------------------------------
/contents/en/basics/release-note/5-6-0.md:
--------------------------------------------------------------------------------
1 | # Apache ECharts 5.6.0 Features
2 |
3 | ## Define Region Styles in Original GeoJSON Data
4 |
5 | ECharts maps use GeoJSON format to define data. In theory, following the principle of "separation of data and style", GeoJSON should only define data while styles should be defined in ECharts. However, in some cases, styles themselves are a form of data expression (for example: using dashed lines to represent disputed borders - here the "dashed line" is a style but actually expresses a data concept, so defining styles in GeoJSON is reasonable).
6 |
7 | In ECharts 5.6.0, we support defining region styles in the original GeoJSON data by specifying `features[].properties.echartsStyle`. This is consistent with the [data](${optionPath}series-map.data) option, which supports configuring `itemStyle`, `label`, `tooltip` etc. Example:
8 |
9 | ```ts
10 | geoJSON.features[0].properties.echartsStyle = {
11 | itemStyle: {
12 | areaColor: 'green'
13 | }
14 | }
15 |
16 | geoJSON.features[1].properties.echartsStyle = {
17 | selected: true,
18 | label: {
19 | formatter: 'Default Selected:\n{b}'
20 | }
21 | }
22 |
23 | geoJSON.features[2].properties.echartsStyle = {
24 | itemStyle: {
25 | borderType: 'dotted',
26 | borderColor: 'blue'
27 | }
28 | }
29 |
30 | geoJSON.features[11].properties.echartsStyle = {
31 | itemStyle: {
32 | // This region will be overridden as `cyan` by the data item option
33 | areaColor: 'black'
34 | },
35 | tooltip: {
36 | formatter: function (params) {
37 | return 'This is a custom tooltip from GeoJSON: ' + params.name;
38 | }
39 | }
40 | }
41 | ```
42 |
43 | ## Axis Labels Support Tooltips
44 |
45 | In some cases, axis labels are too long or we want to display more information on axis labels. In ECharts 5.6.0, we support adding tooltips to axis labels. The configuration is consistent with the `tooltip` option, please refer to [axis.tooltip documentation](${optionPath}xAxis.tooltip) for details.
46 |
47 | 
48 |
49 | ## Sunburst Chart Supports Focusing All Descendants and Ancestors
50 |
51 | In previous versions of sunburst charts, [emphasis.focus](${optionPath}series-sunburst.emphasis.focus) supported the following values:
52 |
53 | - `'none'` Do not fade out other data, it's by default.
54 | - `'self'` Only focus (not fade out) the element of the currently highlighted data.
55 | - `'series'` Focus on all elements of the series which the currently highlighted data belongs to.
56 | - `'ancestor'` Focus on all ancestor nodes.
57 | 'descendant' Focus on all descendants nodes.
58 |
59 | In ECharts 5.6.0, we added `'relative'`, which focuses on all descendants and ancestor nodes.
60 |
61 | 
62 |
63 | ## Added Support for Two New Languages
64 |
65 | In this version, support for Swedish and Persian languages has been added. With this, ECharts now supports 22 languages.
66 |
67 | ## Line Chart Performance Optimization
68 |
69 | In this version, we optimized the rendering performance of line charts, solving the problem of memory growth with time.
70 |
71 | ## Complete Changelog
72 |
73 | View the [changelog](${mainSitePath}changelog.html#v5-6-0)
74 |
75 | The next major version, Apache ECharts 6.0.0, is currently being actively developed and is expected to be released in the first quarter of 2025. Stay tuned for more updates.
76 |
--------------------------------------------------------------------------------
/contents/en/best-practices/canvas-vs-svg.md:
--------------------------------------------------------------------------------
1 | # Render with SVG or Canvas
2 |
3 | Most browser-side chart libraries use SVG or Canvas as the underlying renderer. Generally, both technologies are interchangeable and have a similar effect. However, the difference may be notable in some specific scenarios and cases. As a result, it's always a hard choice to decide which technology to render charts.
4 |
5 | Canvas has been used as the renderer of ECharts from the beginning. Since [v4.0](https://echarts.apache.org/en/changelog.html#v4-0-0), ECharts has provided the SVG renderer as an additional option. You can specify the [renderer parameter](${mainSitePath}api.html#echarts.init) as `'canvas'` or `'svg'` when initializing the chart.
6 |
7 | > SVG and Canvas have a significant difference in use. The uniform support for both technologies in ECharts is attributed to the abstraction and implementation of the underlying library [ZRender](https://github.com/ecomfe/zrender).
8 |
9 | ## How to Choose a Renderer
10 |
11 | Generally, Canvas is more suitable for charts with a large number of elements (heat map, large-scale line or scatter plot in geo or parallel coordinates, etc.), and with visual [effect](${mainSitePath}examples/editor.html?c=lines-bmap-effect). However, SVG has an important advantage: It has less memory usage (which is important for mobile devices) and won't be blurry when zooming in.
12 |
13 | The choice of renderer can be based on a combination of hardware and software environment, data volume and functional requirements.
14 |
15 | - In scenarios where the hardware and software environment is good and the amount of data is not too large, both renderers will work and there is not much need to agonize over them.
16 | - In scenarios where the environment is poor and performance issues arise that require optimization, experimentation can be used to determine which renderer to use. For example, there are these experiences.
17 | - In situations where many instances of ECharts have to be created and the browser is prone to crashing (probably because the number of Canvas is causing the memory footprint to exceed the phone's capacity), the SVG renderer can be used to make improvements. Roughly speaking, the SVG renderer may work better if the chart is running on a low-end Android, or if we are using specific charts such as the [LiquidFill chart](https://ecomfe.github.io/echarts-liquidfill/example/).
18 | - For larger amounts of data (>1k is an experience value), canvas renderer is always recommended.
19 |
20 | We strongly welcome [feedback](https://github.com/apache/echarts/issues/new) from developers on their experiences and scenarios to help us make better optimizations.
21 |
22 | Note: Currently, some special effects still relies on Canvas: e.g. [trail effect](${optionPath}series-lines.effect), [heatmap with blending effect](${mainSitePath}examples/editor.html?c=heatmap-bmap), etc.
23 |
24 | Since [v5.3.0](${lang}/basics/release-note/5-3-0/#new-svg-renderer), the SVG renderer got refactored using the Virtual DOM, the performance got improved by 2-10 times and it can even be dozens of times in some specific scenarios! Refer to [#836](https://github.com/ecomfe/zrender/pull/836) for more details.
25 |
26 | ## How to Use the Renderer
27 |
28 | If `echarts` is fully imported in the following way, it already automatically imported and registered the SVG renderer and the Canvas renderer.
29 |
30 | ```js
31 | import * as echarts from 'echarts';
32 | ```
33 |
34 | If you are using [tree-shakable import](${lang}/basics/import), you will need to import the required renderers manually.
35 |
36 | ```js
37 | import * as echarts from 'echarts/core';
38 | // You can use only the renderers you need
39 | import { SVGRenderer, CanvasRenderer } from 'echarts/renderers';
40 |
41 | echarts.use([SVGRenderer, CanvasRenderer]);
42 | ```
43 |
44 | Then you can set the [renderer parameter](${mainSitePath}api.html#echarts.init) when initializing the chart.
45 |
46 | ```js
47 | // Use the Canvas renderer (default)
48 | var chart = echarts.init(containerDom, null, { renderer: 'canvas' });
49 | // Equivalent to
50 | var chart = echarts.init(containerDom);
51 |
52 | // use the SVG renderer
53 | var chart = echarts.init(containerDom, null, { renderer: 'svg' });
54 | ```
55 |
--------------------------------------------------------------------------------
/contents/en/best-practices/mobile.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/echarts-handbook/ef08c758efac648e989f239ce91b12d1f7fcffd1/contents/en/best-practices/mobile.md
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/bar/basic-bar.md:
--------------------------------------------------------------------------------
1 | # Basic Bar Chart
2 |
3 | Bar Chart is a chart that presents the comparisons among discrete data. The length of the bars is proportional related to the categorical data.
4 |
5 |
8 |
9 | While the label of the series is long, or there are more than 10 categories in one chart, a horizontal column chart can not show all labels, or labels can only be shown tilted. It affects the appliance. Therefore, we use a vertical bar chart to get a better display effect.
10 |
11 |
14 |
15 | ## Suggestions for Using Bar Chart
16 |
17 | 1. Avoid using too many colors. One bar chart represents one set of metrics in general so that we suggest to use the same color or at least different shades of the same color. You can use a contrasting color to highlight meaningful data points.
18 |
19 |
22 |
23 | 2. The gap between bars should be appropriate. When they are too close, the attention of the user may be focused on the gap between bars. A reasonable width should be not less than twice the gap between the bars.
24 |
25 | 3. Data on Y-axis should be started from 0, to reflect the value appropriately. If the y-axis is incomplete, it will mislead the user to make wrong judgments. For instance, the chart on the left side shows that the income in 2017 is 4 times higher than in 2014. But the chart on the right side shows the truth that the income in 2017 only increased by 25% compared with 2014.
26 |
27 |
29 |
30 |
31 | 4. When sorting multiple data, if it is not related to some specific value like date, it is better to comply with a certain logic and guide the user to check the data in an intuitive way. In short, logical sorting can lead the user to read data better to a certain extent.
32 |
33 |
36 |
37 | We don't recommend using a 3D bar chart because the data transmission is not accurate. Users even have to guess which is the top of the bar.
38 |
39 |
41 |
42 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/bar/bi-directional-bar.md:
--------------------------------------------------------------------------------
1 | Bi-directional bar charts are mostly used to show values that included in two opposite meaning categories. One axis shows the name of categories being compared, while the other axis represents the scale value. As an example, Using a bi-directional bar chart to analyze the personal income (positive number) and outcome (negative number) in a week, you can easily find the value and fluctuation of income and outcome in a single series.
2 |
3 |
6 |
7 | The bi-directional bar can be classified into the vertical chart (above) and horizontal chart(below, also called positive negative bar chart). For example, you can use a positive negative bar chart if there are positive and negative comments in a customer satisfaction survey data analysis. All data align in the middle, the positive comments attribute on the right side while the negative comments on the left side.
8 |
9 |
12 |
13 | ## Suggestion for Using Bi-directional Bar Chart
14 |
15 | 1. The data on both sides in the bi-directional bar chart are comparative.
16 |
17 | 2. Don't define negative data on the right side of the bi-directional bar chart, to prevent misunderstanding caused by the violation of common sense.
18 |
19 |
21 |
22 |
23 | 3. A bi-directional bar chart always used to display data with the opposite meaning, so that you need to avoid misunderstanding caused by the use of data that does not have a positive or negative meaning. As the chart below, there is no antagonism between the data of male and female, so that it is a better choice to use a basic bar chart rather than a bi-directional bar chart.
24 |
25 |
27 |
28 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/bar/grouped-bar.md:
--------------------------------------------------------------------------------
1 | # Grouped Bar Chart
2 |
3 | A grouped bar chart is also called the gathered bar chart. When more than two data series placed one by one on the same axis, the chart will be grouped bar chart. It is equivalent to a basic bar chart combined with two or more charts.
4 |
5 |
8 |
9 | A grouped bar chart usually used to compare several groups of data that included the same kind of variables. Same as the bar chart, the length of the bars is proportional related to the categorical data. Every series have an individual color or different saturation of the same color system so that the user can distinguish and compare each set of data.
10 |
11 |
14 |
15 |
16 | ## Suggestion for Using Grouped Bar Chart
17 |
18 | 1. The difficulty of chart reading will be tremendous if there are many series in one group. Therefore, we suggest you use a stacked bar chart rather than a grouped bar chart in this situation.
19 |
20 | 2. The gap between the two groups should be bigger than the gap inside the group, to avoid visually incorrect classification.
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/bar/stacked-bar.md:
--------------------------------------------------------------------------------
1 | # Stacked Bar Chart
2 |
3 | The stacked bar chart is an extension of the bar chart. The difference is that the data in the bar chart is placed parallel while stacked together in the stacked bar chart. You can use a stacked bar chart to reflect the total amount of each category, as well as the proportional relationship of each data compared with the category. Therefore, it is very suitable for dealing with the relationship between part and whole.
4 |
5 | Compared with the pie chart, a stacked bar chart can display several groups of "part and whole" relationship. For instance, you can use a pie or bar chart to display the statistics of the number of people in each project in a physical education course. You can use a stacked bar chart when you want to distinguish boys and girls in each project. As shown in the chart, it included the info of the "part and whole" relationship of each group.
6 |
7 |
10 |
11 | ## Suggestion for Using Stacked Bar Chart
12 |
13 | 1. Follow the basic rule of bar charts. Please avoid using too many colors so that the chart can be easily understood. Don't deliberately display partly data to mislead the user.
14 |
15 | 2. A Stacked bar chart is not suitable for comparing data inside the group.
16 |
17 | 3. While there are 2 or 3 categories, a stacked bar chart will show the best effect. It is not recommended to include more than 6 categories. Too many data series will also make it very difficult to read and understand.
18 |
19 | 4. Try to avoid using a stacked bar chart with categories that included negative values. It will affect understanding or the proportion between part and whole.
20 |
21 | 5. Most of the stacked bar charts are vertically generated. However, if you have very long labels, try to use the horizontal stack method.
22 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/funnel.md:
--------------------------------------------------------------------------------
1 | # Funnel Chart
2 |
3 | Funnel chart (inverted triangle chart) present data into several stages, every stage is part of the whole. The overall percentage of all stages is 100%. Similar to the bar chart, the funnel chart shows no specific data but the proportion related to the whole. Therefore, a funnel chart doesn't have an axis.
4 |
5 | The funnel chart usually used to provide the simplified data which is used to analyze the change or difference in every link of the process. It is also useful to find out the problem and bottleneck during the business.
6 |
7 |
10 |
11 |
12 | ## Suggestion for Using Funnel Chart
13 |
14 | 1. Represented by an e-commerce website, the funnel chart can easily show the entire process from the website to placing order. It not only shows the final conversion rate but also the conversion rate of each step, which leads to the problem directly. You can improve the design for some specific steps.
15 |
16 | As shown below, the first three steps("show", "click", "visit") have only a little drain. The significant decrease happened from "visit" to "consult". As the result, the manager can mainly analyze what caused the reduction of consulting. For instance, it might because that the entrance for consult might not obvious enough.
17 |
18 |
21 |
22 | 2. Using two stacked funnel chart to compare between the prediction and outcome makes the deviation analyze easier.
23 |
24 |
27 |
28 | 3. Try to use two funnels in one chart to discuss the transforming circumstances. As the following chart shows, project B has a higher churn rate comparing with project A.
29 |
30 |
33 |
34 | 4. The funnel chart is more useful for displaying a logic flow which is different from the pie chart. If the data have no logical relevance, you should choose the pie chart.
35 |
36 | 5. Depending on the type of data, use gradually changed colors or contract colors. Arrange them from dark to light according to the size of the funnel chart. Please don't add too many layers or colors to increase reading difficulty.
37 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/gauge.md:
--------------------------------------------------------------------------------
1 | # Gauger Chart
2 |
3 | The Gauger Chart was also called a dial graph or speedometer graph. It is a form of a quasi-materialized display. It displays the data similar to the reading on a speedometer. The color of the gauger chart can be used to separate different categories of data. The gauger chart uses scale to mark data, pointers to indicating dimension, the angel of pointer to represent the value.
4 |
5 |
8 |
9 | ## Suggestion for Using Gauger Chart
10 |
11 | 1. The gauger chart is suitable for displaying single progress or measurement standard under quantitative conditions while it is not suitable for carpeting different variables or trends.
12 |
13 | 2. You can provide info in different dimensions. However, do not include more than 3 pointers in one dashboard. It is recommended to use multiple dashboards if there are indeed multiple data to be displayed.
14 |
15 |
18 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/line/area.md:
--------------------------------------------------------------------------------
1 | # Area Line Chart
2 | The area line chart is similar to the basic line chart. They both described the trend of data over time. The difference is that the fill color and texture of the area line chart created a surface that represents the data volume. For a line chart, the filling area can draw attention for users to the trend of the total value. Therefore, the area line chart is mostly used to convey the size of the trend but not single values.
3 |
4 |
6 |
7 |
8 | ## Suggestion for Using Area Line Chart
9 |
10 | 1. The area line chart uses the filling is to represent the data. While there are several layers in one chart, try to make sure that the data are not overlapping. If the overlapping is not avoidable, you define the color and opacity to an appropriate value to make the chart readable.
11 |
12 |
14 |
15 | 2. The area line chart is strong to display two or three categories of data. We suggest not to show more than 4 groups, or there will be too many data series to identify the data like the following chart. So, we need to avoid an area line chart that has more than three series in one chart.
16 |
17 |
19 |
20 | 3. You should not use the area line chart while there are no boundaries between data values. As shown below, it is familiar that there are 3 different colors at first glance.
21 |
22 |
24 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/line/basic-line.md:
--------------------------------------------------------------------------------
1 | # Basic Line Chart.
2 |
3 | The line chart is basically used to show the phase trend over time. The line chart is pretty useful to display a continuous 2D dataset like the fluctuation in the number of website visitors or sales prices.
4 |
5 |
8 |
9 | Except for displaying the trend of developing things, the line chart can be used to compare several different datasets. As shown below, we use a line chart to compare the sales of three different commodities and analyze which one is the best.
10 |
11 |
14 |
15 | A line chart is drawn by connecting data points with lines. For the beauty of special effects, you can also connect points with curves as shown in the chart above. This chart is also called a curve chart or spline chart. The usage of the spline chart is the same as the line chart. The only difference is that the connection between data points is a curve but not a straight line.
16 |
17 | ## Suggestion for Using Line Chart
18 |
19 | 1. To make sure the data readability, use solid lines in charts if you can separate the data line and axis.
20 |
21 | 2. Do not draw more than 4 lines in a chart. As shown below, lines are entangled together without obvious contrast that makes the whole chart confusing and difficult to read.
22 |
23 |
26 |
27 | 3. Don't use decorates to separate charts. The legend is helpful, but sometimes distracting users:
28 |
29 |
32 |
33 | 4. When displaying the data of the line chart, avoid deliberately distorting the trend. The meaningful volatility analysis chart should make the height of the item be two-thirds of the height of the y-axis.
34 |
35 |
37 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/line/stacked-area.md:
--------------------------------------------------------------------------------
1 | # Stacked Area Chart
2 | The stacked area chart is a special kind of area chart. It is used to compare several data series in the same interval. The main difference between the area chart and stacked area chart is that the base of every series is over the previous one. Therefore, every time a line is measured, the area between the lines will be filled with color.
3 |
4 | If there are several series and you want to analyze the part-to-whole relationship for every single one, which reflects the contribution of partial quantity to the total, you can use the stacked area chart. For instance, the contribution of one seller to the total sales.
5 |
6 |
9 |
10 | Here are two different kinds of stacked area chart:
11 |
12 | + Traditional stacked chart: Use the original value to stack, show the change in the whole process.
13 | + Percentage stacked chart: The percentage stacked chart shows how did the relationship between series changed with time. The cumulative total is not the focus as this kind of chart. The important is to show the series distribution as the whole.
14 |
15 |
18 |
19 | ## Suggestion for Using Stacked Area Chart
20 |
21 | 1. The area chart can't display data in many series that are closed to each others. It will make the chart hard to read:
22 |
23 |
26 |
27 | With the same series, stacked bar chart works better:
28 |
29 |
32 |
33 |
34 |
35 |
38 |
39 |
40 |
41 | 2. Although the stacked bar chart is good dealing with several series, try not to include more than 7 in one chart.
42 |
43 | 3. Because the stacked bar chart provides the relation between part and whole, you should not include negative value in series.
44 |
45 | 4. We suggest putting larger values on the top side of the chart, you will get a better display effect.
46 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/pie/basic-pie.md:
--------------------------------------------------------------------------------
1 | # Pie Chart
2 |
3 | The pie chart is mainly used to display the proportion of different categories compared with the total. The arc length of each sector in the figure means the proportion of the category. The sum of all categories is 100%.
4 |
5 |
8 |
9 | Even the pie chart can display the distribution radio of the data, and widely used in every field, there is still controversy around the pie chart and its deformation chart. Therefore, you should use the pie chart with caution and avoid misunderstanding.
10 |
11 | ## Suggestion for Using Pie Chart
12 |
13 | 1. The pie chart is preferred to show the proportion of data in the same dimension. It requests the data to be positive. Please also make sure the total of sectors is 100%.
14 |
15 | 2. It is hard to compare the data in the pie chart with too many pieces. We suggest to controlling the number of categories under five. While there are too many categories, we might merge some unimportant data together, and name as "other". If all categories cannot be omitted, you should try a bar chart or stacked bar chart as an alternative.
16 |
17 |
19 |
20 |
21 | 3. The pie chart is not appropriate for the comparison of precise data. The following graph (left below) shows that every sector has almost the same proportion. In this case, you should try a bar chart or rose chart (right below) to achieve a better effect.
22 |
23 |
25 |
26 |
27 | 4. Visual habits of most people are observing from top to bottom in clockwise. Therefore we recommend you put the largest sector in the first place in the clockwise direction to stress the importance.
28 |
29 | There are two advices for the rest of the data. Arrange sectors from big to small in clockwise or anti-clockwise follows the largest one:
30 |
31 |
33 |
34 |
35 | Order the sectors according to the size not only consistent with the visual habits but also easier for data's identify and comparison. Base on this principle, you can put the part that needs to emphasize (don't need to be the largest part) at the prominent position.
36 |
37 | 5. You can add some decorations like color, motion, style, position to stress some data in a chart. Please be moderate or it will distract the user.
38 |
39 |
42 |
43 | 6. 3D pie chart distorted the ratio between each sector, which will cause mistakes and confusion in understanding. Therefore,a 3D pie chart is not recommended.
44 |
45 |
47 |
48 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/radar.md:
--------------------------------------------------------------------------------
1 | # Radar Chart
2 |
3 | Radar Chart is suitable for display the data with more than three dimensions. The radar chart has more than two axes starting from the same point. The relative position and angle of the axis are usually meaningless.
4 |
5 | Every variable in the radar chart match one axis that starting from the center. Axes have the same scale index and included angle. Connect the scale between axis, and connect the item in each axis together to become a polygon.
6 |
7 |
10 |
11 | The radar chart is useful for indicating similar values and checking outliers in variables. The radar chart can also be used to reflect what variables have a higher or lower score in the dataset, which makes it a better way to display the performance (see below). Similarly, the radar chart is often used in displaying data such as rankings, evaluations and reviews.
12 |
13 |
16 |
17 | As shown below, the chart shows the comparison of the budgets and expenses in a kindergarten fund flow. The six areas involved are food, toys, picture books, medical care and clothing. Every axis has a range of 0 to 500. The toy is the only part that was overspent while the clothing is far below the budget. It becomes clear at a glance while using a radar chart to show which part is overspend or underspend.
18 |
19 |
22 |
23 | ## Suggestion for Using Radar Chart
24 |
25 | 1. The number of polygons in the radar chart should be limited. If there are more than 5 categories to be evaluated, both the outline and color block will be too confusing to read.
26 |
27 | 2. Including too many axes can also make the radar chart difficult to read. Therefore, try to keep the radar chart concisely and limit the number of variables.
28 |
29 | 3. Because the radial distance is hard to judge, it is still difficult to read the specific value although there are grid lines. We recommend you use a line graph if you need to compare specific values.
30 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/scatter/bubble.md:
--------------------------------------------------------------------------------
1 | # Bubble Chart
2 |
3 | The bubble chart shows the relevance between variables. Same as the scatter chart, data in bubble chart are set with points, it shows the relationship of data between two variables. The different part is that the scatter chart has several variables. It included the size of the bubble. A bigger bubble means a larger value. Users can analyze the law of data by the location and size of bubbles.
4 |
5 |
8 |
9 | ## Suggestion for Using Bubble Chart
10 |
11 | 1. It is a good choice to choose a bubble chart while there are three series, features and related values. As shown below, the bubbles' position shows the date and specific time when the code was submitted, the size explained the amount of code submitted.
12 |
13 |
16 |
17 | 2. You can also change the color of the bubbles. The chart below uses different colors to classify the air quality of three areas. Red is Beijing, yellow is Shanghai, and blue is Guangzhou. Users can visually compare and analyze the tire quality of the three places.
18 |
19 |
22 |
23 | 3. A bubble chart commonly used to combine with the map. X-axis and y-axis represent the longitude and latitude. The size of bubbles can be the magnitude of the value at that position.
24 |
25 |
28 |
--------------------------------------------------------------------------------
/contents/en/best-practices/specification/scatter/scatter.md:
--------------------------------------------------------------------------------
1 | # Scatter Chart
2 |
3 | The scatter chart shows the relation between the two variables. Data is embodied as a collection of points, which is appropriate to compare a large number of data without considering the time. The scatter chart can identify the relevant and relation of two variables thus find some trend. The scatter chart is also workable to find outliers or to understand data distribution. The chart above shows the distribution of the height and weight of students in a class.
4 |
5 |
8 |
9 | The scatter chart can reflect the correlation(relation between variables) of a different type. It can be positively correlated, negatively correlated and uncorrelated.
10 |
11 | - Positively Correlated: When one value increases, the other value increases.
12 |
13 | - Negatively Correlated: When one value increases, the other value decreases.
14 |
15 | - Uncorrelated: Two values have no obvious relation and have no influence on each other.
16 |
17 |
19 |
20 |
21 | To be mentioned, the scatter chart can effectively illustrate the correlation between the two variables. However, it cannot strongly prove there exist causality. For example, AD serving and Visits are positively correlated, but we cannot prove that more AD serving must lead to more Visits. However, we have enough reason to increase the AD serving and observe the outcome after we find out the positive correlation between them.
22 |
23 | ## Suggestion for Using Scatter Chart
24 |
25 | 1. If no correlation was shown in the scatter chart, then the scatter chart is not the best choice.
26 |
27 | 2. If the package included a different series, you can use different colors for each series. As an example, add the legend to mark male as blue, female as red. You can not only distinguish the height and weight of different genders but also add an auxiliary line for the average of each series to improve the understanding of the distribution. In this case, females have more amount higher than the average value than lower.
28 |
29 |
32 |
33 | The trend line is useful when observing the relationship between two variables. The shape of the trend line can explain the relation type of two variables as well as make a prediction. It is better to include only two trend lines to avoid interference with the reading.
34 |
35 | 3. The scatter points can present a good appearance only with adequate and relevant data. It is meaningless to draw a chart with very little and unrelated values.
36 |
--------------------------------------------------------------------------------
/contents/en/concepts/coordinate.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/echarts-handbook/ef08c758efac648e989f239ce91b12d1f7fcffd1/contents/en/concepts/coordinate.md
--------------------------------------------------------------------------------
/contents/en/concepts/legend.md:
--------------------------------------------------------------------------------
1 | # Legend
2 |
3 | Legends are used to annotate the content in the chart using different colors, shapes and texts to indicate different categories. By clicking the legends, the user can show or hide the corresponding categories. Legend is one of the key to understand the chart.
4 |
5 | ## Layout
6 |
7 | Legend is always placed at the upper right corner of the chart. All legends in the same page need to be consistent, align horizontally or vertically by considering the layout of the overall chart space. When the chart has little vertical space or the content area is crowded, it is also a good choice to put the legend on the bottom of the chart. Here are some layouts of legend:
8 |
9 | ```js live
10 | option = {
11 | legend: {
12 | // Try 'horizontal'
13 | orient: 'vertical',
14 | right: 10,
15 | top: 'center'
16 | },
17 | dataset: {
18 | source: [
19 | ['product', '2015', '2016', '2017'],
20 | ['Matcha Latte', 43.3, 85.8, 93.7],
21 | ['Milk Tea', 83.1, 73.4, 55.1],
22 | ['Cheese Cocoa', 86.4, 65.2, 82.5],
23 | ['Walnut Brownie', 72.4, 53.9, 39.1]
24 | ]
25 | },
26 | xAxis: { type: 'category' },
27 | yAxis: {},
28 | series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
29 | };
30 | ```
31 |
32 | Use scrollable control if there are many legends.
33 |
34 | ```js
35 | option = {
36 | legend: {
37 | type: 'scroll',
38 | orient: 'vertical',
39 | right: 10,
40 | top: 20,
41 | bottom: 20,
42 | data: ['Legend A', 'Legend B', 'Legend C' /* ... */, , 'Legend x']
43 | // ...
44 | }
45 | // ...
46 | };
47 | ```
48 |
49 | ## Style
50 |
51 | For dark color background, use a light color for the background layer and text while changing the background to translucent.
52 |
53 | ```js
54 | option = {
55 | legend: {
56 | data: ['Legend A', 'Legend B', 'Legend C'],
57 | backgroundColor: '#ccc',
58 | textStyle: {
59 | color: '#ccc'
60 | // ...
61 | }
62 | // ...
63 | }
64 | // ...
65 | };
66 | ```
67 |
68 | The color of legend has many ways to design. For different charts, the legend style can be different.
69 |
70 |
71 |
72 | ```js
73 | option = {
74 | legend: {
75 | data: ['Legend A', 'Legend B', 'Legend C'],
76 | icon: 'rect'
77 | // ...
78 | }
79 | // ...
80 | };
81 | ```
82 |
83 | ## Interactive
84 |
85 | Depend on the environmental demand, the legend can support interactive operation. Click the legend to show or hide corresponding categories:
86 |
87 | ```js
88 | option = {
89 | legend: {
90 | data: ['Legend A', 'Legend B', 'Legend C'],
91 | selected: {
92 | 'Legend A': true,
93 | 'Legend B': true,
94 | 'Legend C': false
95 | }
96 | // ...
97 | }
98 | // ...
99 | };
100 | ```
101 |
102 | ## Tips
103 |
104 | The legend should be used according to the situation. Some dual-axis charts include multiple chart types. Different kinds of legend stypes should be distinguished.
105 |
106 | ```js
107 | option = {
108 | legend: {
109 | data: [
110 | {
111 | name: 'Legend A',
112 | icon: 'rect'
113 | },
114 | {
115 | name: 'Legend B',
116 | icon: 'circle'
117 | },
118 | {
119 | name: 'Legend C',
120 | icon: 'pin'
121 | }
122 | ]
123 | // ...
124 | },
125 | series: [
126 | {
127 | name: 'Legend A'
128 | // ...
129 | },
130 | {
131 | name: 'Legend B'
132 | // ...
133 | },
134 | {
135 | name: 'Legend C'
136 | // ...
137 | }
138 | ]
139 | // ...
140 | };
141 | ```
142 |
143 | While there is only one kind of data in the chart, use the chart title rather than the legend to explain it.
144 |
--------------------------------------------------------------------------------
/contents/en/concepts/options.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/echarts-handbook/ef08c758efac648e989f239ce91b12d1f7fcffd1/contents/en/concepts/options.md
--------------------------------------------------------------------------------
/contents/en/concepts/series.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/echarts-handbook/ef08c758efac648e989f239ce91b12d1f7fcffd1/contents/en/concepts/series.md
--------------------------------------------------------------------------------
/contents/en/concepts/tooltip.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/echarts-handbook/ef08c758efac648e989f239ce91b12d1f7fcffd1/contents/en/concepts/tooltip.md
--------------------------------------------------------------------------------
/contents/en/get-started.md:
--------------------------------------------------------------------------------
1 | # Get Started
2 |
3 | ## Getting Apache ECharts
4 |
5 | Apache ECharts supports several download methods, which are further explained in the next tutorial [Installation](${lang}/basics/download). Here, we take the example of getting it from the [jsDelivr](https://www.jsdelivr.com/package/npm/echarts) CDN and explain how to install it quickly.
6 |
7 | At [https://www.jsdelivr.com/package/npm/echarts](https://www.jsdelivr.com/package/npm/echarts) select `dist/echarts.js`, click and save it as `echarts.js` file.
8 |
9 | > More information about these files can be found in the next tutorial [Installation](${lang}/basics/download).
10 |
11 | ## Including ECharts
12 |
13 | Create a new `index.html` file in the directory where you just saved `echarts.js`, with the following content:
14 |
15 | ```html
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | ```
25 |
26 | When you open this `index.html`, you will see an empty page. But don't worry. Open the console and make sure that no error message is reported, then you can proceed to the next step.
27 |
28 | ## Plotting a Simple Chart
29 |
30 | Before drawing we need to prepare a DOM container for ECharts with a defined height and width. Add the following code after the `` tag introduced earlier.
31 |
32 | ```html
33 |
34 |
35 |
36 |
37 | ```
38 |
39 | Then you can initialize an echarts instance with the [echarts.init](${mainSitePath}api.html#echarts.init) method and set the echarts instance with [setOption](${mainSitePath}api.html#echartsInstance.setOption) method to generate a simple bar chart. Here is the complete code.
40 |
41 | ```html
42 |
43 |
44 |
45 |
46 | ECharts
47 |
48 |
49 |
50 |
51 |
52 |
53 |
82 |
83 |
84 | ```
85 |
86 | And this is your first chart with Apache ECharts!
87 |
88 |
89 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/bar/bar-race.md:
--------------------------------------------------------------------------------
1 | # Dynamic Sorting Bar Chart
2 |
3 | ## Related Options
4 |
5 | Bar race is a chart that shows changes in the ranking of data over time and it is supported by default since ECharts 5.
6 |
7 | > Bar race charts usually use horizontal bars. If you want to use vertical bars, just take the X axis and Y axis in this tutorial to the opposite.
8 |
9 | 1. Set `realtimeSort` of the bar series to be `true` to enable bar race
10 | 2. Set `yAxis.inverse` to be `true` to display longer bars at top
11 | 3. `yAxis.animationDuration` is suggested to be set to be `300` for bar reordering animation for the first time
12 | 4. `yAxis.animationDurationUpdate` is suggested to be set to be `300` for bar reordering animation for later times
13 | 5. Set `yAxis.max` to be _n - 1_ where _n_ is the number of bars to be displayed; otherwise, all bars are displayed
14 | 6. `xAxis.max` is suggested to be set to be `'dataMax'` so that the maximum of data is used as X maximum.
15 | 7. If realtime label changing is required, set `series.label.valueAnimation` to be `true`
16 | 8. Set `animationDuration` to be `0` so that the first animation doesn't start from 0; if you wish otherwise, set it to be the same value as `animationDurationUpdate`
17 | 9. `animationDurationUpdate` is suggested to be set to be `3000` for animation update duration, which should be the same as the frequency of calling `setOption`
18 | 10. Call `setOption` to update data to be of next time with `setInterval` at the frequency of `animationDurationUpdate`
19 |
20 | ## Demo
21 |
22 | A complete demo:
23 |
24 | ```js live
25 | var data = [];
26 | for (let i = 0; i < 5; ++i) {
27 | data.push(Math.round(Math.random() * 200));
28 | }
29 |
30 | option = {
31 | xAxis: {
32 | max: 'dataMax'
33 | },
34 | yAxis: {
35 | type: 'category',
36 | data: ['A', 'B', 'C', 'D', 'E'],
37 | inverse: true,
38 | animationDuration: 300,
39 | animationDurationUpdate: 300,
40 | max: 2 // only the largest 3 bars will be displayed
41 | },
42 | series: [
43 | {
44 | realtimeSort: true,
45 | name: 'X',
46 | type: 'bar',
47 | data: data,
48 | label: {
49 | show: true,
50 | position: 'right',
51 | valueAnimation: true
52 | }
53 | }
54 | ],
55 | legend: {
56 | show: true
57 | },
58 | animationDuration: 0,
59 | animationDurationUpdate: 3000,
60 | animationEasing: 'linear',
61 | animationEasingUpdate: 'linear'
62 | };
63 |
64 | function run() {
65 | var data = option.series[0].data;
66 | for (var i = 0; i < data.length; ++i) {
67 | if (Math.random() > 0.9) {
68 | data[i] += Math.round(Math.random() * 2000);
69 | } else {
70 | data[i] += Math.round(Math.random() * 200);
71 | }
72 | }
73 | myChart.setOption(option);
74 | }
75 |
76 | setTimeout(function() {
77 | run();
78 | }, 0);
79 | setInterval(function() {
80 | run();
81 | }, 3000);
82 | ```
83 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/bar/polar-bar.md:
--------------------------------------------------------------------------------
1 | # Bar Chart in Polar Coordinate System
2 |
3 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/bar/stacked-bar.md:
--------------------------------------------------------------------------------
1 | # Stacked Bar Chart
2 |
3 | Sometimes, we hope to not only figure series separately but also the trend of the sum. It's a good choice to implement it by using the stacked bar chart. As the name suggests, in the stacked bar chart, data in the same category will be stacked up in one column. The overall height of the bar explained the change of total.
4 |
5 | There is a simple way to implement a stacked bar chart by ECharts. You need to set the same string type value for a group of series in `stack`. The series with the same `stack` value will be in the same category.
6 |
7 | ```js live
8 | option = {
9 | xAxis: {
10 | data: ['A', 'B', 'C', 'D', 'E']
11 | },
12 | yAxis: {},
13 | series: [
14 | {
15 | data: [10, 22, 28, 43, 49],
16 | type: 'bar',
17 | stack: 'x'
18 | },
19 | {
20 | data: [5, 4, 3, 5, 10],
21 | type: 'bar',
22 | stack: 'x'
23 | }
24 | ]
25 | };
26 | ```
27 |
28 | In this case, the position of the second series is based on the position of the first series, the height increased is corresponding to the first series' height. Therefore, from the position of the second series, you can find the changing trend of the sum of the two.
29 |
30 | > The value of `stack` explained what series will be stacked up together. Theoretically, the specific value of 'stack' is meaningless. However, we prefer some suggestive strings for the convenience of reading.
31 | >
32 | > For instance, here is a chart with 4 series that counted the amount of male and female. "adult male" and "boy" need to be stacked while "adult female" and "girl" need to be stacked. In this case, the suggestive value of `stack` is `'male'` and `'female'`. Although meaningless strings like `'a'` and `'b'` can achieve the same effect but the code will have worse readability.
33 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/bar/waterfall.md:
--------------------------------------------------------------------------------
1 | # Waterfall
2 |
3 | There is no waterfall series in Apache ECharts, but we can simulate the effect using a stacked bar chart.
4 |
5 | Assuming that the values in the data array represent an increase or decrease from the previous value.
6 |
7 | ```js
8 | var data = [900, 345, 393, -108, -154, 135, 178, 286, -119, -361, -203];
9 | ```
10 |
11 | That is, the first data is `900` and the second data `345` represents the addition of `345` to `900`, etc. When presenting this data as a stepped waterfall chart, we can use three series: the first is a non-interactive transparent series to implement the suspension bar effect, the second series is used to represent positive numbers, and the third series is used to represent negative numbers.
12 |
13 | ```js live
14 | var data = [900, 345, 393, -108, -154, 135, 178, 286, -119, -361, -203];
15 | var help = [];
16 | var positive = [];
17 | var negative = [];
18 | for (var i = 0, sum = 0; i < data.length; ++i) {
19 | if (data[i] >= 0) {
20 | positive.push(data[i]);
21 | negative.push('-');
22 | } else {
23 | positive.push('-');
24 | negative.push(-data[i]);
25 | }
26 |
27 | if (i === 0) {
28 | help.push(0);
29 | } else {
30 | sum += data[i - 1];
31 | if (data[i] < 0) {
32 | help.push(sum + data[i]);
33 | } else {
34 | help.push(sum);
35 | }
36 | }
37 | }
38 |
39 | option = {
40 | title: {
41 | text: 'Waterfall'
42 | },
43 | grid: {
44 | left: '3%',
45 | right: '4%',
46 | bottom: '3%',
47 | containLabel: true
48 | },
49 | xAxis: {
50 | type: 'category',
51 | splitLine: { show: false },
52 | data: (function() {
53 | var list = [];
54 | for (var i = 1; i <= 11; i++) {
55 | list.push('Oct/' + i);
56 | }
57 | return list;
58 | })()
59 | },
60 | yAxis: {
61 | type: 'value'
62 | },
63 | series: [
64 | {
65 | type: 'bar',
66 | stack: 'all',
67 | itemStyle: {
68 | normal: {
69 | barBorderColor: 'rgba(0,0,0,0)',
70 | color: 'rgba(0,0,0,0)'
71 | },
72 | emphasis: {
73 | barBorderColor: 'rgba(0,0,0,0)',
74 | color: 'rgba(0,0,0,0)'
75 | }
76 | },
77 | data: help
78 | },
79 | {
80 | name: 'positive',
81 | type: 'bar',
82 | stack: 'all',
83 | data: positive
84 | },
85 | {
86 | name: 'negative',
87 | type: 'bar',
88 | stack: 'all',
89 | data: negative,
90 | itemStyle: {
91 | color: '#f33'
92 | }
93 | }
94 | ]
95 | };
96 | ```
97 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/line/area-line.md:
--------------------------------------------------------------------------------
1 | # Area Chart
2 |
3 | The area chart fills the space between the line and axis with the background color, to express the data by the size of the area. Compared with the normal line chart, the area chart has more intuitive visual effects. It is especially suitable for the scenario with a few series.
4 |
5 | ```js live
6 | option = {
7 | xAxis: {
8 | data: ['A', 'B', 'C', 'D', 'E']
9 | },
10 | yAxis: {},
11 | series: [
12 | {
13 | data: [10, 22, 28, 23, 19],
14 | type: 'line',
15 | areaStyle: {}
16 | },
17 | {
18 | data: [25, 14, 23, 35, 10],
19 | type: 'line',
20 | areaStyle: {
21 | color: '#ff0',
22 | opacity: 0.5
23 | }
24 | }
25 | ]
26 | };
27 | ```
28 |
29 | If you want to change the area style of the line chart, try to use [`areaStyle`](${optionPath}series-line.areaStyle). Set `'areaStyle'` to `{}` to use the default type: use the color of series to fill the area in translucent. If you want to change the style, try to override the configuration items in `'areaStyle'`. For example, the color of the second series was changed to yellow with 50% opacity.
30 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/line/smooth-line.md:
--------------------------------------------------------------------------------
1 | # Smooth Line Chart
2 |
3 | The smooth line chart is also a variant of the basic line graph. It is a better choice for you to perform a comfort visual experience. While using the ECharts, you only need to change the `smooth` to `true` to achieve this effect.
4 |
5 | ```js live
6 | option = {
7 | xAxis: {
8 | data: ['A', 'B', 'C', 'D', 'E']
9 | },
10 | yAxis: {},
11 | series: [
12 | {
13 | data: [10, 22, 28, 23, 19],
14 | type: 'line',
15 | smooth: true
16 | }
17 | ]
18 | };
19 | ```
20 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/line/stacked-line.md:
--------------------------------------------------------------------------------
1 | # Stacked Line Chart
2 |
3 | Similar to the [Stacked Bar Chart](${lang}/how-to/chart-types/bar/stacked-bar), Stacked Line Chart use the `'stack'` in `series` to decide which series should be stacked together.
4 |
5 | ```js live
6 | option = {
7 | xAxis: {
8 | data: ['A', 'B', 'C', 'D', 'E']
9 | },
10 | yAxis: {},
11 | series: [
12 | {
13 | data: [10, 22, 28, 43, 49],
14 | type: 'line',
15 | stack: 'x'
16 | },
17 | {
18 | data: [5, 4, 3, 5, 10],
19 | type: 'line',
20 | stack: 'x'
21 | }
22 | ]
23 | };
24 | ```
25 |
26 | However, without clarification, it is hard for us to judge whether it is a stacked line chart or normal line chart. Therefore, filling color for the area under the line is recommended to indicate for a stacked line chart.
27 |
28 | ```js live
29 | option = {
30 | xAxis: {
31 | data: ['A', 'B', 'C', 'D', 'E']
32 | },
33 | yAxis: {},
34 | series: [
35 | {
36 | data: [10, 22, 28, 43, 49],
37 | type: 'line',
38 | stack: 'x',
39 | areaStyle: {}
40 | },
41 | {
42 | data: [5, 4, 3, 5, 10],
43 | type: 'line',
44 | stack: 'x',
45 | areaStyle: {}
46 | }
47 | ]
48 | };
49 | ```
50 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/line/step-line.md:
--------------------------------------------------------------------------------
1 | # Step Line Chart
2 |
3 | The normal line chart connects two points by straight line directly, while the step line chart, also known as square wave chart, uses only horizontal and vertical lines to connect the nearby items together. Compared with the normal line chart, the step line chart significantly shows the sudden changes of analyzed data.
4 |
5 | In ECharts, `step` is used to characterize the connection type of the step line chart. It has three available values: `'start'`, `'end'`, and `'middle'`. For item A and B, these values corresponded that the corner occurred at A, B, and mid-point between A and B.
6 |
7 | ```js live
8 | option = {
9 | legend: {},
10 | xAxis: {
11 | type: 'category',
12 | data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
13 | },
14 | yAxis: {
15 | type: 'value'
16 | },
17 | series: [
18 | {
19 | name: 'Step Start',
20 | type: 'line',
21 | step: 'start',
22 | data: [120, 132, 101, 134, 90, 230, 210]
23 | },
24 | {
25 | name: 'Step Middle',
26 | type: 'line',
27 | step: 'middle',
28 | data: [220, 282, 201, 234, 290, 430, 410]
29 | },
30 | {
31 | name: 'Step End',
32 | type: 'line',
33 | step: 'end',
34 | data: [450, 432, 401, 454, 590, 530, 510]
35 | }
36 | ]
37 | };
38 | ```
39 |
40 | > Please focus on the difference of line between three separate types.
41 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/pie/basic-pie.md:
--------------------------------------------------------------------------------
1 | # Basic Pie Chart
2 |
3 | Pie charts are mainly used to show the proportion of several categories compared with the total. The radians represent the proportion of each category.
4 |
5 | ## Simple Example
6 |
7 | The config of the pie chart is not completely the same as the line chart and bar chart. There is no need to configure the axis. The name and value of data need to be defined in the series. Let's begin with a basic pie chart:
8 |
9 | ```js live
10 | option = {
11 | series: [
12 | {
13 | type: 'pie',
14 | data: [
15 | {
16 | value: 335,
17 | name: 'Direct Visit'
18 | },
19 | {
20 | value: 234,
21 | name: 'Union Ad'
22 | },
23 | {
24 | value: 1548,
25 | name: 'Search Engine'
26 | }
27 | ]
28 | }
29 | ]
30 | };
31 | ```
32 |
33 | To be mentioned, the `value` here does not need to be percentage data. ECharts will proportionately distribute their corresponding radians in the pie chart depending on all the data.
34 |
35 | ## Customized Pie Chart
36 |
37 | ### Radius of Pie Chart
38 |
39 | The radius of pie chart can be defined by [`series.radius`](${optionPath}series-pie.radius). Both percent string(`'60%'`) and absolute pixel string(`'200'`) are available. While it is a percent string, it is proportional related to the shorter container(`'div'`) edge.
40 |
41 | ```js live
42 | option = {
43 | series: [
44 | {
45 | type: 'pie',
46 | data: [
47 | {
48 | value: 335,
49 | name: 'Direct Visit'
50 | },
51 | {
52 | value: 234,
53 | name: 'Union Ad'
54 | },
55 | {
56 | value: 1548,
57 | name: 'Search Engine'
58 | }
59 | ],
60 | radius: '50%'
61 | }
62 | ]
63 | };
64 | ```
65 |
66 | ## Hide Chart While Data Sum is 0
67 |
68 | By default, if the data sum is 0, the series will divide the shape equally. For instance, if you don't want to show any shape while all 4 series have value equals 0, you could define [`series.stillShowZeroSum`](${optionPath}series-pie.stillShowZeroSum) to `false`.
69 |
70 | ```js live
71 | option = {
72 | series: [
73 | {
74 | type: 'pie',
75 | stillShowZeroSum: false,
76 | data: [
77 | {
78 | value: 0,
79 | name: 'Direct Visit'
80 | },
81 | {
82 | value: 0,
83 | name: 'Union Ad'
84 | },
85 | {
86 | value: 0,
87 | name: 'Search Engine'
88 | }
89 | ]
90 | }
91 | ]
92 | };
93 | ```
94 |
95 | If you are willing to hide the label as well, define the [`series.label.show`](${optionPath}series-pie.label.show) to `false` as well.
96 |
97 | ```js live
98 | option = {
99 | series: [{
100 | type: 'pie',
101 | stillShowZeroSum: false,
102 | label: {
103 | show: false
104 | }
105 | data: [{
106 | value: 0,
107 | name: 'Direct Visit'
108 | }, {
109 | value: 0,
110 | name: 'Union Ad'
111 | }, {
112 | value: 0,
113 | name: 'Search Engine'
114 | }]
115 | }]
116 | };
117 | ```
118 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/pie/doughnut.md:
--------------------------------------------------------------------------------
1 | # Doughnut Chart
2 |
3 | Doughnut charts are also used to show the proportion of values compared with the total. Different from the pie chart, the blank in the middle of the chart can be used to provide some extra info. It makes a doughnut chart commonly used chart type.
4 |
5 | ## Basic Doughnut Chart
6 |
7 | In ECharts, the radius of the pie chart could also be an array with 2 elements. Every element in the array could be string or value. The first element represents the inner radius while the second one is the outer radius.
8 |
9 | The pie chart, from this perspective, is a subset of the doughnut chart that has inner radius equals to 0.
10 |
11 | ```js live
12 | option = {
13 | title: {
14 | text: 'A Case of Doughnut Chart',
15 | left: 'center',
16 | top: 'center'
17 | },
18 | series: [
19 | {
20 | type: 'pie',
21 | data: [
22 | {
23 | value: 335,
24 | name: 'A'
25 | },
26 | {
27 | value: 234,
28 | name: 'B'
29 | },
30 | {
31 | value: 1548,
32 | name: 'C'
33 | }
34 | ],
35 | radius: ['40%', '70%']
36 | }
37 | ]
38 | };
39 | ```
40 |
41 | If we set one radius to string of a percentage value, while the other to a value, the inner radius will be smaller than the outer radius in some resolution. ECharts will choose the smaller element for the inner radius automatically. However, it will still cause not an unexpected outcome.
42 |
43 | ## Show Text In Middle Of Doughnut From Highlighted Sector
44 |
45 | The previous case gives you a way to show fixed text in the middle of doughnut chart. The next case will show you how to display the corresponding text of the sector highlighted by the mouse. The general idea is to fix `label` in the middle of the chart while hiding `label` in default.
46 |
47 | ```js live
48 | option = {
49 | legend: {
50 | orient: 'vertical',
51 | x: 'left',
52 | data: ['A', 'B', 'C', 'D', 'E']
53 | },
54 | series: [
55 | {
56 | type: 'pie',
57 | radius: ['50%', '70%'],
58 | avoidLabelOverlap: false,
59 | label: {
60 | show: false,
61 | position: 'center'
62 | },
63 | labelLine: {
64 | show: false
65 | },
66 | emphasis: {
67 | label: {
68 | show: true,
69 | fontSize: '30',
70 | fontWeight: 'bold'
71 | }
72 | },
73 | data: [
74 | { value: 335, name: 'A' },
75 | { value: 310, name: 'B' },
76 | { value: 234, name: 'C' },
77 | { value: 135, name: 'D' },
78 | { value: 1548, name: 'E' }
79 | ]
80 | }
81 | ]
82 | };
83 | ```
84 |
85 | In this case, `avoidLabelOverlap` is used to control whether ECharts adjust the position of label to avoid overlaps. Default value of `avoidLabelOverlap` is `true`. We want the label to be fixed in the middle so that we need to define it as `false`.
86 |
87 | Therefore, the middle of doughnut chart will show the `name` of the highlighted sector.
88 |
--------------------------------------------------------------------------------
/contents/en/how-to/chart-types/pie/rose.md:
--------------------------------------------------------------------------------
1 | # Rose Chart(Nightingale Chart)
2 |
3 | Rose Chart, which was also called the nightingale chart, usually indicates categories by sector of the same radius but different radius.
4 |
5 | ECharts can implement Rose Chart by defining [`series.roseType`](${optionPath}series-pie.roseType) of pie chart to `'area'`. All other configs are the same as a basic pie chart.
6 |
7 | ```js live
8 | option = {
9 | series: [
10 | {
11 | type: 'pie',
12 | data: [
13 | {
14 | value: 100,
15 | name: 'A'
16 | },
17 | {
18 | value: 200,
19 | name: 'B'
20 | },
21 | {
22 | value: 300,
23 | name: 'C'
24 | },
25 | {
26 | value: 400,
27 | name: 'D'
28 | },
29 | {
30 | value: 500,
31 | name: 'E'
32 | }
33 | ],
34 | roseType: 'area'
35 | }
36 | ]
37 | };
38 | ```
39 |
--------------------------------------------------------------------------------
/contents/en/how-to/data/drilldown.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/echarts-handbook/ef08c758efac648e989f239ce91b12d1f7fcffd1/contents/en/how-to/data/drilldown.md
--------------------------------------------------------------------------------
/contents/en/how-to/data/dynamic-data.md:
--------------------------------------------------------------------------------
1 | # Asynchronous Data Loading and Dynamic Update
2 |
3 | ## Asynchronous Loading
4 |
5 | Data in [Getting Started Example](${lang}/get-started) is directly updated by using `setOption`. But in many cases, the data needs to be filled by asynchronous loading frequently. `ECharts` can implement asynchronous loading in a simple way. You can get data asynchronously through a function such as jQuery and use `setOption` to fill in data and configs after the chart initialized.
6 |
7 | ```js
8 | var myChart = echarts.init(document.getElementById('main'));
9 |
10 | $.get('data.json').done(function(data) {
11 | // Structure of data:
12 | // {
13 | // categories: ["Shirt","Wool sweater","Chiffon shirt","Pants","High-heeled shoes","socks"],
14 | // values: [5, 20, 36, 10, 10, 20]
15 | // }
16 | myChart.setOption({
17 | title: {
18 | text: 'Asynchronous Loading Example'
19 | },
20 | tooltip: {},
21 | legend: {},
22 | xAxis: {
23 | data: data.categories
24 | },
25 | yAxis: {},
26 | series: [
27 | {
28 | name: 'Sales',
29 | type: 'bar',
30 | data: data.values
31 | }
32 | ]
33 | });
34 | });
35 | ```
36 |
37 | Or display empty axes with all styles defined before fill in the data:
38 |
39 | ```js
40 | var myChart = echarts.init(document.getElementById('main'));
41 | // Show title, legends and empty axes
42 | myChart.setOption({
43 | title: {
44 | text: 'Asynchronous Loading Example'
45 | },
46 | tooltip: {},
47 | legend: {
48 | data: ['Sales']
49 | },
50 | xAxis: {
51 | data: []
52 | },
53 | yAxis: {},
54 | series: [
55 | {
56 | name: 'Sales',
57 | type: 'bar',
58 | data: []
59 | }
60 | ]
61 | });
62 |
63 | // Asynchronous Data Loading
64 | $.get('data.json').done(function(data) {
65 | // Fill in the data
66 | myChart.setOption({
67 | xAxis: {
68 | data: data.categories
69 | },
70 | series: [
71 | {
72 | // Find series by name
73 | name: 'Sales',
74 | data: data.data
75 | }
76 | ]
77 | });
78 | });
79 | ```
80 |
81 | For example:
82 |
83 |
84 |
85 | You need to use `name` to "navigate" ECharts when updating data. In the previous example, the chart can update normally depending on the order of series, but we recommend you to add the `name` data while updating data.
86 |
87 | ## loading Animation
88 |
89 | When it takes a long time to load the data, the user is facing the empty chart with only axes will wonder if there is a bug.
90 |
91 | ECharts have a simple loading animation by default. You can call [showLoading](${mainSitePath}/api.html#echartsInstance.showLoading) to display. When the data loading was completed, call [hideLoading](${mainSitePath}/api.html#echartsInstance.hideLoading) to hide the animation.
92 |
93 | ```js
94 | myChart.showLoading();
95 | $.get('data.json').done(function (data) {
96 | myChart.hideLoading();
97 | myChart.setOption(...);
98 | });
99 | ```
100 |
101 | Here is the effect:
102 |
103 |
104 |
105 | ## Dynamic Update
106 |
107 | ECharts was driven by data, change in data will drive changes in the presentation of the chart. Therefore, It's surprisingly simple to implement a dynamic update.
108 |
109 | All data's updates were implemented by [setOption](${mainSitePath}/api.html#echartsInstance.setOption). You only need to fetch the data periodically. ECharts will find the difference between two groups of data to use the proper way to choose the animation.
110 |
111 | Check the following example.
112 |
113 |
114 |
--------------------------------------------------------------------------------
/contents/en/how-to/interaction/coarse-pointer.md:
--------------------------------------------------------------------------------
1 | # Intelligent Pointer Snapping
2 |
3 | Some interactive elements may be relatively small in charts, so sometimes it is difficult for users to click and do other operations accurately, especially on the mobile. Therefore, in Apache EChartsTM 5.4.0, we introduced the concept of "intelligent pointer snapping".
4 |
5 | Starting from this version, by default, ECharts enables pointer snapping for mobile charts and disables it for non-mobile charts.
6 |
7 | > If it needs to be enabled for all platforms, it can be achieved by setting `opt.useCoarsePointer` to `true` in [init](${mainSitePath}api.html#echarts.init); set to `false` is turned off for all platforms.
8 |
9 | ## Snapping Algorithm
10 |
11 | When a mouse or touch event occurs, ECharts will determine whether it is intersecting with an interactive element based on the position of the mouse or touch. If it is, the element is the object to be interacted with, which is the same logic before this optimization. If not, find an element that is closest to the mouse or touch position within a certain range.
12 |
13 | > The default range is 44px (see [W3C standard](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html)), developers can set this value through `opt.pointerSize` when [init](${mainSitePath}api.html#echarts.init).
14 |
15 | More specifically, ECharts will loop through different angles and different radii (within `opt.pointerSize`) around the mouse or touch position until it finds an element that intersects it. If found, the element is considered to be the interactive object.
16 |
17 |
19 |
20 |
21 | That is, if an element is within the `opt.pointerSize` radius of the mouse or touch position, the closest intersected element is considered the interactive object.
22 |
23 | ## Performance
24 |
25 | As for the implementation, we first judge the intersection between the mouse or touch position and the AABB bounding box of all interactive elements, so as to quickly eliminate most of the elements that is not intersecting. Then, we perform an accurate path intersection judgment on the remaining elements. Therefore, from the perspective of user experience, there is hardly any perceivable performance loss.
26 |
27 | For chart series with large-scale data (that is, bar charts, scatter charts, etc. with `large: true` enabled), the snapping will not be enabled.
28 |
--------------------------------------------------------------------------------
/contents/zh/basics/download.md:
--------------------------------------------------------------------------------
1 | # 获取 Apache ECharts
2 |
3 | Apache ECharts 提供了多种安装方式,你可以根据项目的实际情况选择以下任意一种方式安装。
4 |
5 | - 从 GitHub 获取
6 | - 从 npm 获取
7 | - 从 CDN 获取
8 | - 在线定制
9 |
10 | 接下来我们将分别介绍这些安装方式,以及下载后的目录结构。
11 |
12 | ## 安装方式
13 |
14 | ### 从 npm 获取
15 |
16 | ```sh
17 | npm install echarts
18 | ```
19 |
20 | 详见[在项目中引入 Apache ECharts](${lang}/basics/import)。
21 |
22 | ### 从 CDN 获取
23 |
24 | 可以从以下免费 CDN 中获取和引用 ECharts。
25 |
26 | - [jsDelivr](https://www.jsdelivr.com/package/npm/echarts)
27 | - [unpkg](https://unpkg.com/browse/echarts/)
28 | - [cdnjs](https://cdnjs.com/libraries/echarts)
29 |
30 | ### 从 GitHub 获取
31 |
32 | [apache/echarts](https://github.com/apache/echarts) 项目的 [release](https://github.com/apache/echarts/releases) 页面可以找到各个版本的链接。点击下载页面下方 Assets 中的 Source code,解压后 `dist` 目录下的 `echarts.js` 即为包含完整 ECharts 功能的文件。
33 |
34 | ### 在线定制
35 |
36 | 如果只想引入部分模块以减少包体积,可以使用 [ECharts 在线定制](${mainSitePath}builder.html)功能。
37 |
--------------------------------------------------------------------------------
/contents/zh/basics/help.md:
--------------------------------------------------------------------------------
1 | # 寻求帮助
2 |
3 | ## 技术问题
4 |
5 | ### 确保现有文档等资料无法解决你的问题
6 |
7 | ECharts 有非常大量的用户,所以你遇到过的问题很可能别人在此之前也遇到并解决了。通过查看文档以及使用搜索引擎搜索关键字,可以帮助你自助地在第一时间解决问题,而不需要依赖社区的帮助。
8 |
9 | 因此,在做其他操作前,请确保现有文档等资料无法解决你的问题。可以尝试查看或搜索的资料包括:
10 |
11 | - [API](${mainSitePath}api.html)
12 | - [配置项手册](${mainSitePath}option.html):可以尝试使用搜索功能
13 | - 本手册的文章
14 | - [常见问题](${mainSitePath}faq.html)
15 | - 在 [GitHub issue](https://github.com/apache/echarts/issues) 中搜索关键字
16 | - 使用搜索引擎搜索关键字
17 |
18 | ### 创建一个最简单可复现的例子
19 |
20 | 使用[官方编辑器](${mainSitePath}examples/editor.html)、[CodePen](https://codepen.io/Ovilia/pen/dyYWXWM)、[CodeSandbox](https://codesandbox.io/s/echarts-basic-example-template-mpfz1s) 或 [JSFiddle](https://jsfiddle.net/plainheart/e46ozpqj/7/) 创建一个例子,这将使得他人更方便地复现你的问题。
21 |
22 | 例子应尽可能以最简单的方式复现你的问题,去除不必要的配置项和数据,可以让帮助你的人更快速地定位问题,从而让你的问题更快得到解决。更详细的介绍请参见 [如何创建一个最小的可复现代码示例](https://stackoverflow.com/help/minimal-reproducible-example)。
23 |
24 | ### 判断是否是 bug
25 |
26 | #### 报告 bug 或请求新功能
27 |
28 | 如果不符合文档描述或你的预期效果,这很有可能是 bug。如果是 bug,或者你有一个想请求实现的功能,请使用 [issue 模板](https://github.com/apache/echarts/issues/new/choose) 新建一个 issue 并按照提示详细描述。
29 |
30 | #### 咨询类问题
31 |
32 | 如果不是 bug,而是不知道如何实现某种效果,可以尝试在 stackoverflow.com、开源中国 或 SegmentFault 思否 等问答平台上提问。
33 |
34 | 如果没能得到答复,也可以发送邮件至邮件组 [dev@echarts.apache.org](mailto:dev@echarts.apache.org)。为了让更多人理解你的问题,并且在将来搜索的时候得到帮助,强烈建议使用英文发送邮件。
35 |
36 | ## 非技术类问题
37 |
38 | 其他问题可以发送英文邮件至邮件组 [dev@echarts.apache.org](mailto:dev@echarts.apache.org)。
39 |
--------------------------------------------------------------------------------
/contents/zh/basics/import.md:
--------------------------------------------------------------------------------
1 | # 在项目中引入 Apache ECharts
2 |
3 | 假如你的开发环境使用了 `npm` 或者 `yarn` 等包管理工具,并且使用 `webpack` 等打包工具进行构建,本文将会介绍如何引入 Apache EChartsTM 并通过 tree-shaking 特性只打包需要的模块以减少包体积。
4 |
5 | ## NPM 安装 ECharts
6 |
7 | 你可以使用如下命令通过 npm 安装 ECharts
8 |
9 | ```shell
10 | npm install echarts --save
11 | ```
12 |
13 | ## 引入 ECharts
14 |
15 | ```js
16 | import * as echarts from 'echarts';
17 |
18 | // 基于准备好的dom,初始化echarts实例
19 | var myChart = echarts.init(document.getElementById('main'));
20 | // 绘制图表
21 | myChart.setOption({
22 | title: {
23 | text: 'ECharts 入门示例'
24 | },
25 | tooltip: {},
26 | xAxis: {
27 | data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
28 | },
29 | yAxis: {},
30 | series: [
31 | {
32 | name: '销量',
33 | type: 'bar',
34 | data: [5, 20, 36, 10, 10, 20]
35 | }
36 | ]
37 | });
38 | ```
39 |
40 | ## 按需引入 ECharts 图表和组件
41 |
42 | 上面的代码会引入 ECharts 中所有的图表和组件,如果你不想引入所有组件,也可以使用 ECharts 提供的按需引入的接口来打包必须的组件。
43 |
44 | ```js
45 | // 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
46 | import * as echarts from 'echarts/core';
47 | // 引入柱状图图表,图表后缀都为 Chart
48 | import { BarChart } from 'echarts/charts';
49 | // 引入标题,提示框,直角坐标系,数据集,内置数据转换器组件,组件后缀都为 Component
50 | import {
51 | TitleComponent,
52 | TooltipComponent,
53 | GridComponent,
54 | DatasetComponent,
55 | TransformComponent
56 | } from 'echarts/components';
57 | // 标签自动布局、全局过渡动画等特性
58 | import { LabelLayout, UniversalTransition } from 'echarts/features';
59 | // 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
60 | import { CanvasRenderer } from 'echarts/renderers';
61 |
62 | // 注册必须的组件
63 | echarts.use([
64 | TitleComponent,
65 | TooltipComponent,
66 | GridComponent,
67 | DatasetComponent,
68 | TransformComponent,
69 | BarChart,
70 | LabelLayout,
71 | UniversalTransition,
72 | CanvasRenderer
73 | ]);
74 |
75 | // 接下来的使用就跟之前一样,初始化图表,设置配置项
76 | var myChart = echarts.init(document.getElementById('main'));
77 | myChart.setOption({
78 | // ...
79 | });
80 | ```
81 |
82 | > 需要注意的是为了保证打包的体积是最小的,ECharts 按需引入的时候不再提供任何渲染器,所以需要选择引入 `CanvasRenderer` 或者 `SVGRenderer` 作为渲染器。这样的好处是假如你只需要使用 svg 渲染模式,打包的结果中就不会再包含无需使用的 `CanvasRenderer` 模块。
83 |
84 | 我们在示例编辑页的“完整代码”标签提供了非常方便的生成按需引入代码的功能。这个功能会根据当前的配置项动态生成最小的按需引入的代码。你可以直接在你的项目中使用。
85 |
86 | > v5.5.0 版本开始使用 ESM 作为默认的模块规范,查看可能的 [Breaking Changes](https://github.com/apache/echarts/pull/19513#issuecomment-1916237700) 以及 [Pull Request](https://github.com/apache/echarts/pull/19513)。
87 |
88 | ## 在 TypeScript 中按需引入
89 |
90 | 对于使用了 TypeScript 来开发 ECharts 的开发者,我们提供了类型接口来组合出最小的 `EChartsOption` 类型。这个更严格的类型可以有效帮助你检查出是否少加载了组件或者图表。
91 |
92 | ```ts
93 | import * as echarts from 'echarts/core';
94 | import {
95 | BarChart,
96 | LineChart
97 | } from 'echarts/charts';
98 | import {
99 | TitleComponent,
100 | TooltipComponent,
101 | GridComponent,
102 | // 数据集组件
103 | DatasetComponent,
104 | // 内置数据转换器组件 (filter, sort)
105 | TransformComponent
106 | } from 'echarts/components';
107 | import { LabelLayout, UniversalTransition } from 'echarts/features';
108 | import { CanvasRenderer } from 'echarts/renderers';
109 | import type {
110 | // 系列类型的定义后缀都为 SeriesOption
111 | BarSeriesOption,
112 | LineSeriesOption
113 | } from 'echarts/charts';
114 | import type {
115 | // 组件类型的定义后缀都为 ComponentOption
116 | TitleComponentOption,
117 | TooltipComponentOption,
118 | GridComponentOption,
119 | DatasetComponentOption
120 | } from 'echarts/components';
121 | import type {
122 | ComposeOption,
123 | } from 'echarts/core';
124 |
125 | // 通过 ComposeOption 来组合出一个只有必须组件和图表的 Option 类型
126 | type ECOption = ComposeOption<
127 | | BarSeriesOption
128 | | LineSeriesOption
129 | | TitleComponentOption
130 | | TooltipComponentOption
131 | | GridComponentOption
132 | | DatasetComponentOption
133 | >;
134 |
135 | // 注册必须的组件
136 | echarts.use([
137 | TitleComponent,
138 | TooltipComponent,
139 | GridComponent,
140 | DatasetComponent,
141 | TransformComponent,
142 | BarChart,
143 | LineChart,
144 | LabelLayout,
145 | UniversalTransition,
146 | CanvasRenderer
147 | ]);
148 |
149 | const option: ECOption = {
150 | // ...
151 | };
152 | ```
153 |
--------------------------------------------------------------------------------
/contents/zh/basics/inspiration.md:
--------------------------------------------------------------------------------
1 | # 获取灵感
2 |
3 | 当你有“不知道图表应该设计成什么样”或者“不知道如何使用 ECharts 实现某种效果”的疑问的时候,以下列表可以提供一些思路。
4 |
5 | - [ECharts 官方实例](${mainSitePath}/examples)
6 | - 本手册的“应用篇 - 常用图表类型”
7 | - [makeapie.com](https://www.makeapie.com/) 社区用户的作品集
8 |
--------------------------------------------------------------------------------
/contents/zh/basics/release-note/5-4-0.md:
--------------------------------------------------------------------------------
1 | # Apache ECharts 5.4.0 特性介绍
2 |
3 | ## 智能指针吸附
4 |
5 | 在图表中,部分可交互元素可能比较小,有时候用户不易准确地进行点击等操作,移动端尤其如此。因此,在 Apache ECharts 5.4.0 中,我们引入了“智能指针吸附”的概念。
6 |
7 | 具体请参见[智能指针吸附](${lang}/how-to/interaction/coarse-pointer)。
8 |
9 | ## 在更多坐标系中使用饼图
10 |
11 | Apache ECharts 一个很强大的功能就是各种图表类型、坐标系、组件的组合。在这个版本中,我们为饼图增加了坐标系的配置项。
12 |
13 | 于是,饼图可以出现在直角坐标系:
14 |
15 | 
16 |
17 | 日历坐标系:
18 |
19 | 
20 |
21 | 地理坐标系:
22 |
23 | 
24 |
25 | 等等各种坐标系中,甚至可以和百度地图扩展联动,在地图上显示饼图:
26 |
27 | 
28 |
29 | 
30 |
31 | 这大大扩展了饼图的灵活性,让开发者可以使用 Apache ECharts 创作出更多图表的组合效果。
32 |
33 | ## 新增乌克兰语翻译
34 |
35 | 在这个版本中,我们支持了乌克兰语。**目前 Apache ECharts 已支持 17 种语言!**
36 |
37 | > 如果需要使用除中英文以外的语言,需要在初始化图表前,先调用 `echarts.registerLocale` 初始化,然后在 `init` 时候传入 `opts.locale` 修改图表语言。
38 |
39 | ## 仪表盘文字旋转
40 |
41 | 在这个版本中,我们支持了仪表盘的文字旋转。
42 |
43 |
44 |
45 | `axisLabel.rotate` 可以设为 `'tangential' | 'radial' | number`。如果是 `number` 类型,则表示标签的旋转角,从 -90 度到 90 度,正值是逆时针。除此之外,还可以是字符串 `'radial'` 表示径向旋转、`'tangential'` 表示切向旋转。
46 |
47 | ## 完整更新记录
48 |
49 | 查看[版本更新](${mainSitePath}/changelog.html#v5-4-0)
50 |
--------------------------------------------------------------------------------
/contents/zh/basics/release-note/5-6-0.md:
--------------------------------------------------------------------------------
1 | # Apache ECharts 5.6.0 特性介绍
2 |
3 | ## 在原始 GeoJSON 数据中定义区域样式
4 |
5 | ECharts 地图使用 GeoJson 格式定义数据。理论上出于“数据、样式分离的原则”,GeoJson 只负责定义数据,样式应该在 ECharts 中定义。但有些情况下,样式本身也是数据的一种表达(例如:对于争议国界使用虚线表示,这时候“虚线”是一种样式,但是它实际上表达的是数据的概念,所以在 GeoJson 中定义样式是合理的)。
6 |
7 | 在 ECharts 5.6.0 中,我们支持在原始 GeoJson 数据中定义区域样式,通过指定 `features[].properties.echartsStyle` 来定义样式,和 [data](${optionPath}series-map.data) 一样,支持配置 `itemStyle`、`label`、`tooltip` 等属性。示例:
8 |
9 | ```ts
10 | geoJSON.features[0].properties.echartsStyle = {
11 | itemStyle: {
12 | areaColor: 'green'
13 | }
14 | }
15 |
16 | geoJSON.features[1].properties.echartsStyle = {
17 | selected: true,
18 | label: {
19 | formatter: 'Default Selected:\n{b}'
20 | }
21 | }
22 |
23 | geoJSON.features[2].properties.echartsStyle = {
24 | itemStyle: {
25 | borderType: 'dotted',
26 | borderColor: 'blue'
27 | }
28 | }
29 |
30 | geoJSON.features[11].properties.echartsStyle = {
31 | itemStyle: {
32 | // This region will be overridden as `cyan` by the data item option
33 | areaColor: 'black'
34 | },
35 | tooltip: {
36 | formatter: function (params) {
37 | return 'This is a custom tooltip from GeoJSON: ' + params.name;
38 | }
39 | }
40 | }
41 | ```
42 |
43 | ## 坐标轴标签支持提示框
44 |
45 | 在有些情况下,坐标轴标签过长,或我们希望在坐标轴标签上显示更多信息,在 ECharts 5.6.0 中,我们支持在坐标轴标签上添加提示框。使用方法和 `tooltip` 的配置项一致,具体可以参考 [axis.tooltip 文档](${optionPath}xAxis.tooltip)。
46 |
47 | 
48 |
49 | ## 旭日图支持聚焦所有子孙和祖先节点
50 |
51 | 在之前版本的旭日图中,[emphasis.focus](${optionPath}series-sunburst.emphasis.focus) 支持以下几种值:
52 |
53 | - `'none'` 不淡出其它图形,默认使用该配置。
54 | - `'self'` 只聚焦(不淡出)当前高亮的数据的图形。
55 | - `'series'` 聚焦当前高亮的数据所在的系列的所有图形。
56 | - `'adjacency'` 聚焦关系图中的邻接点和边的图形。
57 |
58 | 在 ECharts 5.6.0 中,我们新增了 `'relative'` ,表示聚焦所有子孙和祖先节点。
59 |
60 | 
61 |
62 | ## 新增两种语言支持
63 |
64 | 在这个版本中,新增了瑞典语和波斯语的支持。至此,ECharts 已经支持 22 种语言。
65 |
66 | ## 折线图性能优化
67 |
68 | 在这个版本中,我们优化了折线图的渲染性能,解决了折线图内存随时间增长的问题。
69 |
70 | ## 完整更新记录
71 |
72 | 查看[版本更新](${mainSitePath}changelog.html#v5-6-0)
73 |
74 | 下一个大版本 Apache ECharts 6.0.0 正在火热开发中,预计于 2025 年一季度末发布,敬请期待。
75 |
--------------------------------------------------------------------------------
/contents/zh/basics/resource.md:
--------------------------------------------------------------------------------
1 | # 资源列表
2 |
3 | ## 官方
4 |
5 | - [API](${mainSitePath}api.html)
6 | - [配置项手册](${mainSitePath}option.html)
7 | - [官方实例](${mainSitePath}examples/zh/index.html)
8 | - [术语速查手册](${mainSitePath}cheat-sheet.html)
9 |
10 | ## 社区
11 |
12 | - [MakeAPie](https://www.makeapie.com):社区用户的作品集
13 | - [awesome-echarts](https://github.com/ecomfe/awesome-echarts):各种 ECharts 相关的资源,包括 AngularJS、Vue 等框架的支持,Java、Python、R 等语言的 ECharts 版本,ECharts VSCode 插件等工具
14 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/aria.md:
--------------------------------------------------------------------------------
1 | # 无障碍访问
2 |
3 | W3C 制定了无障碍富互联网应用规范集([WAI-ARIA](https://www.w3.org/WAI/intro/aria),the Accessible Rich Internet Applications Suite),致力于使得网页内容和网页应用能够被更多残障人士访问。
4 |
5 | Apache ECharts 4 遵从这一规范,支持自动根据图表配置项智能生成描述,使得盲人可以在朗读设备的帮助下了解图表内容,让图表可以被更多人群访问。Apache ECharts 5 新增了贴花功能,让图表数据除了可以用颜色区分之外,还能用贴花图案区分,提供了更好的无障碍访问体验。
6 |
7 | 无障碍访问功能默认关闭,需要通过将 [aria.show](${optionPath}aria.show) 设置为 `true` 开启。
8 |
9 | ## 图表描述
10 |
11 | 开启 [aria.show](${optionPath}aria.show) 后,会根据图表、数据、标题等情况,自动智能生成关于图表的描述,用户也可以通过配置项修改描述。
12 |
13 | 对于配置项:
14 |
15 | ```js
16 | option = {
17 | aria: {
18 | show: true
19 | },
20 | title: {
21 | text: '某站点用户访问来源',
22 | x: 'center'
23 | },
24 | series: [
25 | {
26 | name: '访问来源',
27 | type: 'pie',
28 | data: [
29 | { value: 335, name: '直接访问' },
30 | { value: 310, name: '邮件营销' },
31 | { value: 234, name: '联盟广告' },
32 | { value: 135, name: '视频广告' },
33 | { value: 1548, name: '搜索引擎' }
34 | ]
35 | }
36 | ]
37 | };
38 | ```
39 |
40 |
41 |
42 | 生成的图表 DOM 上,会有一个 `aria-label` 属性,在朗读设备的帮助下,盲人能够了解图表的内容。其值为:
43 |
44 | ```
45 | 这是一个关于“某站点用户访问来源”的图表。图表类型是饼图,表示访问来源。其数据是——直接访问的数据是335,邮件营销的数据是310,联盟广告的数据是234,视频广告的数据是135,搜索引擎的数据是1548。
46 | ```
47 |
48 | 默认语言会根据语言包(默认中文)选择,也可以使用配置项自定义模板。
49 |
50 | ### 整体修改描述
51 |
52 | 对于有些图表,默认生成的数据点的描述并不足以表现整体的信息。比如下图的散点图,默认生成的描述可以包含数据点的坐标值,但是知道几百几千个点的坐标并不能帮助我们有效地理解图表表达的信息。
53 |
54 | 这时候,用户可以通过 [aria.description](${optionPath}aria.description) 配置项指定图表的整体描述。
55 |
56 | ### 定制模板描述
57 |
58 | 除了整体性修改描述之外,我们还提供了生成描述的模板,可以方便地进行细粒度的修改。
59 |
60 | 生成描述的基本流程为,如果 [aria.show](${optionPath}aria.show) 设置为 `true`,则生成无障碍访问描述,否则不生成。如果定义了 [aria.description](${optionPath}aria.description),则将其作为图表的完整描述,否则根据模板拼接生成描述。我们提供了默认的生成描述的算法,仅当生成的描述不太合适时,才需要修改这些模板,甚至使用 `aria.description` 完全覆盖。
61 |
62 | 使用模板拼接时,先根据是否存在标题 [title.text](${optionPath}title.text) 决定使用 [aria.general.withTitle](${optionPath}aria.general.withTitle) 还是 [aria.general.withoutTitle](${optionPath}aria.general.withoutTitle) 作为整体性描述。其中,`aria.general.withTitle` 配置项包括模板变量 `'{title}'`,将会被替换成图表标题。也就是说,如果 `aria.general.withTitle` 被设置为 `'图表的标题是:{title}。'`,则如果包含标题 `'价格分布图'`,这部分的描述为 `'图表的标题是:价格分布图。'`。
63 |
64 | 拼接完标题之后,会依次拼接系列的描述([aria.series](${optionPath}aria.series)),和每个系列的数据的描述([aria.data](${optionPath}aria.data))。同样,每个模板都有可能包括模板变量,用以替换实际的值。
65 |
66 | 完整的描述生成流程请参见 [ARIA 文档](${optionPath}aria.label)。
67 |
68 | ## 贴花图案
69 |
70 | 除此之外,Apache ECharts 5 新增支持贴花纹理,作为颜色的辅助表达,进一步用以区分数据。在 `aria.enabled` 为 `true` 的前提下,将 `aria.decal.show` 设为 `true` 即可采用默认的贴花样式。
71 |
72 |
73 |
74 | 如果需要自定义贴花图案,可以使用 [aria.decal.decals](${optionPath}aria.decal.decals) 配置出灵活多变的图案。
75 |
76 | 更具体的信息请参见 [ARIA 文档](${optionPath}aria.decal)。
77 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/canvas-vs-svg.md:
--------------------------------------------------------------------------------
1 | # 使用 Canvas 或者 SVG 渲染
2 |
3 | 浏览器端图表库大多会选择 SVG 或者 Canvas 进行渲染。对于绘制图表来说,这两种技术往往是可替换的,效果相近。但是在一些场景中,他们的表现和能力又有一定差异。于是,对它们的选择取舍,就成为了一个一直存在的不易有标准答案的话题。
4 |
5 | ECharts 从初始一直使用 Canvas 绘制图表。而 [ECharts v4.0](https://echarts.apache.org/zh/changelog.html#v4-0-0) 发布了 SVG 渲染器,从而提供了一种新的选择。在初始化图表实例时,只需设置 [renderer 参数](${mainSitePath}api.html#echarts.init) 为 `'canvas'` 或 `'svg'` 即可指定渲染器,比较方便。
6 |
7 | > SVG 和 Canvas 这两种使用方式差异很大的技术,能够做到同时被透明支持,主要归功于 ECharts 底层库 [ZRender](https://github.com/ecomfe/zrender) 的抽象和实现,形成可互换的 SVG 渲染器和 Canvas 渲染器。
8 |
9 | ## 选择哪种渲染器
10 |
11 | 一般来说,Canvas 更适合绘制图形元素数量较多(这一般是由数据量大导致)的图表(如热力图、地理坐标系或平行坐标系上的大规模线图或散点图等),也利于实现某些视觉 [特效](${mainSitePath}examples/editor.html?c=lines-bmap-effect)。但是,在不少场景中,SVG 具有重要的优势:它的内存占用更低(这对移动端尤其重要)、并且用户使用浏览器内置的缩放功能时不会模糊。
12 |
13 | 选择哪种渲染器,我们可以根据软硬件环境、数据量、功能需求综合考虑。
14 |
15 | - 在软硬件环境较好,数据量不大的场景下,两种渲染器都可以适用,并不需要太多纠结。
16 | - 在环境较差,出现性能问题需要优化的场景下,可以通过试验来确定使用哪种渲染器。比如有这些经验:
17 | - 在需要创建很多 ECharts 实例且浏览器易崩溃的情况下(可能是因为 Canvas 数量多导致内存占用超出手机承受能力),可以使用 SVG 渲染器来进行改善。大略的说,如果图表运行在低端安卓机,或者我们在使用一些特定图表如 [水球图](https://ecomfe.github.io/echarts-liquidfill/example/) 等,SVG 渲染器可能效果更好。
18 | - 数据量较大(经验判断 > 1k)、较多交互时,建议选择 Canvas 渲染器。
19 |
20 | 我们强烈欢迎开发者们[反馈](https://github.com/apache/echarts/issues/new/choose)给我们使用的体验和场景,帮助我们更好的做优化。
21 |
22 | 注:当前某些特殊的渲染依然需要依赖 Canvas:如[炫光尾迹特效](${optionPath}series-lines.effect)、[带有混合效果的热力图](${mainSitePath}examples/editor.html?c=heatmap-bmap)等。
23 |
24 | 我们在 [v5.3.0](${lang}/basics/release-note/5-3-0/#全新的-svg-渲染器) 中使用虚拟 DOM 技术对 SVG 渲染器进行了重构,从而使其渲染性能提升了 2~10 倍,在某些特殊场景中甚至能有数十倍的提升!参见 [#836](https://github.com/ecomfe/zrender/pull/836)。
25 |
26 | ## 如何使用渲染器
27 |
28 | 如果是用如下的方式完整引入`echarts`,代码中已经包含了 SVG 渲染器和 Canvas 渲染器
29 |
30 | ```js
31 | import * as echarts from 'echarts';
32 | ```
33 |
34 | 如果你是按照 [在项目中引入 Apache ECharts](${lang}/basics/import) 一文中的介绍使用按需引入,则需要手动引入需要的渲染器
35 |
36 | ```js
37 | import * as echarts from 'echarts/core';
38 | // 可以根据需要选用只用到的渲染器
39 | import { SVGRenderer, CanvasRenderer } from 'echarts/renderers';
40 |
41 | echarts.use([SVGRenderer, CanvasRenderer]);
42 | ```
43 |
44 | 然后,我们就可以在代码中,初始化图表实例时,[传入参数](${mainSitePath}api.html#echarts.init) 选择渲染器类型:
45 |
46 | ```js
47 | // 使用 Canvas 渲染器(默认)
48 | var chart = echarts.init(containerDom, null, { renderer: 'canvas' });
49 | // 等价于:
50 | var chart = echarts.init(containerDom);
51 |
52 | // 使用 SVG 渲染器
53 | var chart = echarts.init(containerDom, null, { renderer: 'svg' });
54 | ```
55 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/design/color-enhance.md:
--------------------------------------------------------------------------------
1 | # 用颜色增强可视化效果
2 |
3 | 在数据可视化所有的视觉通道中,色彩作为视觉的第一感知因素,对数据进行的视觉编码和传达是很有效的。如果使用得当,颜色可以非常有效地增强可视化效果。接下来,我们来看看具体有哪些使用颜色来增强可视化效果的的技巧和方法。
4 |
5 | ## 颜色的情感共鸣
6 |
7 | 颜色感知是一个复杂的物理和心理相互作用的结果。为了证明了人们感知到的色彩有冷与暖之分,日本色彩学家大智浩曾做过一个实验,将一个工作场地涂灰青色,另一个工作场地涂红橙色,两个工作场地的客观温度劳动强度相同,在灰青色工作场地工作的员工相对更容易感觉到冷。人们进一步研究发现,除了冷与暖的不同感受,色彩还有轻与重、远与近、活泼与忧郁等区分。所以,色彩之所以强大之处在于不同的色彩会使人的心理与生理产生不同的感受,从而引起情感反应和影响人们的情绪。
8 |
9 | 在可视化的颜色选择上,如果我们选用的颜色与我们数据本身的特点以及想要传达的情绪吻合的话,就可以伴随着颜色的视觉传达而引起情感上的共鸣。
10 |
11 | 例如某个甜品店各类甜品的销售占比,数据如下:
12 |
13 |
14 |
15 | 针对这份数据,下面两个相同样式的图表,我们采用了两种不同配色方案,对比来看很明显,右图的配色更适合用来展示甜品数据。
16 |
17 |
18 |
19 | 因为相较于蓝色、紫色而言,橙色、黄色、粉色、绿色都是有利于提升食欲的颜色,而且更容易使人们产生温暖、幸福的情感,而这种情感与吃甜品时人们产生的感觉是一致的。另一方面,甜品本身的面向用户大多数是儿童和女性,针对这部分用户,比较明快、可爱的图表颜色也是更好的选择。而左侧的图表的配色更适合用于展示某种商务、男性群体的数据,因为左图的配色更容易使人产生理性和冷静的情感。
20 |
21 | ## 颜色的语义共鸣
22 |
23 | 不同的颜色可以帮助我们识别和区分不同的类别。我们已经习惯将颜色和各种事物或概念绑定在一起。当提到某些事物时我们经常会迅速的在心中匹配其对应的颜色,例如提到“云朵”会想到白色,“爱情”会想到粉红色。这些自然的、与语义一致的颜色被称为"语义共鸣色"。
24 |
25 | 研究表明,对于有固定颜色的词,匹配其具有语义共鸣的颜色,能有效的加速认知过程,反之则会阻碍认知,这种有趣的现象称为"斯特鲁普效应"。我们可以做个的对比试验,分别在上图两行文字中找到“黄”字。这个过程中,第一行的“黄”可以被快速定位到,因为对应使用了黄色。而在第二行寻找的时候,可能有人最早定位到的会是“紫”字,因为此处“紫”字使用了黄色,这就阻碍了我们寻找的速度和准确性。
26 |
27 |
28 |
29 | 有效地利用语义共鸣色,即采用与数据本身意义一致的颜色,也可以提高可视化的认知效率。例如可以使用蓝色的来显示"海洋"的数据、使用黄色来显示“沙漠”的数据。
30 |
31 | 视觉效果应该尽可能容易地解释,因此请尝试找到与观众的先入为主和文化联想相匹配的配色方案。如下示例中展示了猕猴桃、香蕉、橙子、草莓四种水果的销售数据,分别选择了与水果本身一致的颜色绿色、黄色、橙色、红色。这样,我们在辨别和记忆每个柱状所对应的水果时就轻而易举了。
32 |
33 | ```js live
34 | option = {
35 | color: ['#6E9D4E', '#EDDB4F', '#F7923A', '#F14747'],
36 | title: {
37 | text: '7月水果销量',
38 | x: '2%',
39 | y: '1%',
40 | textStyle: {
41 | color: '#fff',
42 | fontSize: '26'
43 | }
44 | },
45 | tooltip: {
46 | trigger: 'axis'
47 | },
48 | legend: {
49 | data: ['猕猴桃', '香蕉', '橙子', '草莓'],
50 | align: 'right'
51 | },
52 | grid: {
53 | left: '3%',
54 | right: '3%',
55 | top: '15%',
56 | bottom: '3%',
57 | containLabel: true
58 | },
59 | xAxis: [
60 | {
61 | type: 'category',
62 | data: ['第一周', '第二周', '第三周', '第四周']
63 | }
64 | ],
65 | yAxis: [
66 | {
67 | type: 'value',
68 | axisLabel: {
69 | formatter: '{value}'
70 | }
71 | }
72 | ],
73 | series: [
74 | {
75 | name: '猕猴桃',
76 | type: 'bar',
77 | data: [60, 110, 180, 100]
78 | },
79 | {
80 | name: '香蕉',
81 | type: 'bar',
82 | data: [90, 130, 170, 130]
83 | },
84 | {
85 | name: '橙子',
86 | type: 'bar',
87 | data: [120, 160, 140, 160]
88 | },
89 | {
90 | name: '草莓',
91 | type: 'bar',
92 | data: [110, 190, 90, 100]
93 | }
94 | ]
95 | };
96 | ```
97 |
98 | ## 图表颜色要吻合常识
99 |
100 | 在数据可视化的过程中,颜色的使用与图表的数据、展示环境、受众人群、社会背景等因素直接相关,我们不可以把颜色作为独立的因素去设计。在开始选择可视化作品的颜色时,请先克制住自由创作的热情,查看一下这是否是一份特殊的数据,再去选择对的颜色。例如一个股票数据的图表中,红色和绿色都有独特的含义。所以可视化图表颜色的选择吻合认知的常识,可以帮助我们更好地理解和区分数据。
101 |
102 |
105 |
106 | 再例如查看天气温度。蓝色和红色易于理解,无需任何解释,并且易于区分。
107 |
108 |
111 |
112 | ## 用颜色来区分数据
113 |
114 | 我们通常会使用折线图来分析趋势,但是有的时候有需要明确的知道某个数据是否在某个区间范围内,因此我们可以主动地去配置定义区域。例如我们设定 25%-75% 这个范围内为我们计划完成的销售额,那我们可以在这个定义区域的范围内,给每个区域设置成一个底色,这样就可以高效的识别出每个数据处于哪个区间范围内,未达到、达到、超额完成的值。
115 |
116 | 所以,颜色可以被用来作为提高图表的可阅读性和有效工具。
117 |
118 |
119 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/mobile.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/echarts-handbook/ef08c758efac648e989f239ce91b12d1f7fcffd1/contents/zh/best-practices/mobile.md
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/bar/basic-bar.md:
--------------------------------------------------------------------------------
1 | # 基础柱状图
2 |
3 | 柱状图是最常见的图表类型,通过使用水平或垂直方向 柱子的高度来显示不同类别的数值,其中柱状图的一个轴显示比较的类别,而另一个轴代表对应的数值。
4 |
5 |
8 |
9 | 纵向柱状图的柱是垂直方向的,横向柱状图的柱是水平方向的,又称条形图。条形图与横向柱状图表达数据的形式是一样的,不过,当图表的数据标签很长或者有超过 10 个项目进行比较时,横向柱状图会无法完全显示完标签,或者只能倾斜展示,影响美观。因此当数据标签过长时,选择用条形图可以获得更好的展示效果。
10 |
11 |
14 |
15 | ## 柱状图的使用建议
16 |
17 | 1、避免使用太多颜色,一般情况一个柱状图(条形图)表示一组相同的度量,所以建议使用相同的颜色或同一颜色的不同色调。如果需要强调某个数据时,可以使用对比色或者变化色调来突出显示有意义的数据点。
18 |
19 |
22 |
23 | 2、柱状图柱子间的宽度和间隙要适当。当柱子太窄时,用户的视觉可能会集中在两个柱中间的负空间,而这里是不承载任何数据的。合理的宽度和间隙应该是 单个柱子的宽度不小于柱间间隙的两倍。
24 |
25 | 3、Y 轴数据应该从 0 基线开始,以恰当地反映数值。如果展示的是被截断的数据,那很可能会误导观众做出错误的判断。例如左侧图表显示出的数据结果是 2017 年收入是 2014 年收入的五倍,而实际上如右侧图表完整显示的数据表明 2017 年收入相对于 2014 年其实只提升了 25%。
26 |
27 |
29 |
30 |
31 | 4、对多个数据系列排序时,如果不涉及到日期等特定数据,最好能符合一定的逻辑用直观的方式引导用户更好地查看数据。可以通过升序或降序排布,例如按照数量从多到少来对数据进行排序,也可以按照字母顺序等来排布。总之,按照逻辑排序可以一定程度上引导人们更好地阅读数据。
32 |
33 |
36 |
37 | 5、一般情况下不建议使用三维柱状图,与三维饼图一样,对于数据传达不太精准,甚至还不得不猜测哪个才是数据的顶端。
38 |
39 |
41 |
42 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/bar/bi-directional-bar.md:
--------------------------------------------------------------------------------
1 | # 双向柱状图
2 |
3 | 双向柱状图多用于展示包含相反含义的数据的对比。其中图表的一个轴显示正在比较的类别,而另一轴代表对应的刻度值。
4 |
5 | 双向柱状图一般用于正负两份相反数据的对比。例如一周内个人收入和支出的统计,其中收入为正数,支出为负数。使用双向柱状图可以很明确的对收入和支出做出对比,并能从单个系列中分析收入和支出的数值及波动。
6 |
7 |
10 |
11 | 双向柱状图可分为垂直方向的双向柱状图(如上图)和水平方向的双向柱状图(又叫正负条形图,如下图),例如一个客户满意度的调查数据分析中,有正面评价和负面评价,这很适合用正负条形图,所有数据在中间对齐,正面的评价数据分布在右侧,负面的评价数据分布在左侧。
12 |
13 |
16 |
17 | ## 双向柱状 图的使用建议
18 |
19 | 1、双向柱状图正向和负向的数据具有对比性,因此一般选用差值较大的具有对比性的颜色。
20 |
21 | 2、永远不要在 0 基线的右边画负值的水平条行图或在 0 基线的上边画负值的柱子,以免和常识违背造成误解。
22 |
23 |
25 |
26 |
27 | 3、双向柱状图多用于展示含相反含义的数据,因此要避免不具有正负含义的数据使用而造成的误解。 如下图人口统计图表中使用双向柱状图,一侧绘制男性的数据,另一侧绘制女性的数据,只是单纯的两类不同数据的对比,并不存在负数。那么,此时将两个数据序列绘制成一个分组柱状图是更合适的。
28 |
29 |
31 |
32 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/bar/grouped-bar.md:
--------------------------------------------------------------------------------
1 | # 分组柱状图
2 |
3 | 分组柱状图也被称为聚集柱状图。当两个或多个数据序列并排显示并在同一轴上的类别下分组时,将使用分组柱状图。相当于包含带有两个或更多图表的简单的条形图。
4 |
5 |
8 |
9 | 分组柱状图通常是用于将包含相同变量或类别的几个分组进行比较。像柱状图一样,每个柱的长度用于显示类别的数值,每个数据系列被分配一个单独的颜色或相同色系的不同饱和度,以区分它们,每组数据之间相互间隔并进行对比。
10 |
11 |
14 |
15 | ## 分组柱状 图的使用建议
16 |
17 | 1、如果每个分组中的系列过多,数据的阅读难度就会越增加。因此,不建议每个分组中包含过多的系列。在系列较多时,可考虑使用堆叠柱状图。
18 |
19 | 2、建议每两个分组之间的间距大于组内不同系列之间的间距,以免造成视觉上错误的归类和区分。
20 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/bar/stacked-bar.md:
--------------------------------------------------------------------------------
1 | # 堆叠柱状图
2 |
3 | 堆叠柱状图是柱状图的扩展。但区别在于,柱状图的数据值为并行排列,堆叠柱图则是一个个叠加起来的。它可以展示每一个分类的总量,以及该分类包含的每个小分类的大小及占比。因此,非常适合处理部分与整体的关系。
4 |
5 | 与饼图显示单个部分到整体的关系不同的是,堆叠柱状图可以显示多个部分到整体的关系。例如一个班级体育课选课的各项目人数统计,你可以用柱状图或饼图来展示。但是,当需要进一步区分男生和女生参与到不同项目中的人数分别是多少时,就需要把每个项目中包含的男生数和女生数都展示出来。如图选用堆叠柱状图,不仅能显示每个项目的总人数,还能展示出每个项目中的一部分与整体的关系。
6 |
7 |
10 |
11 | ## 堆叠柱状 图的使用建议
12 |
13 | 1、遵循基本的柱状图使用原则。为了使图表易于理解,请避免使用太多颜色,不要刻意展示被截断的数据误导读者。
14 |
15 | 2、堆叠柱状图不适合用于对比不同分组内同个分类之间的数据大小。
16 |
17 | 3、堆叠柱状图最好的展示效果是每个组只包含两到三个类别,最多不要超过 6 个,因为太多的数据系列会使数据的阅读和分辨变得非常困难。
18 |
19 | 4、由于要分析部分数据在整体中的占比,因此要避免用堆叠柱状图展示包含负数的数据。
20 |
21 | 5、大多数的堆叠柱状图都是垂直绘制的,但是如果你的数据标签特别长时,考虑更好地展示效果,可以选择使用水平堆叠的方式。
22 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/funnel.md:
--------------------------------------------------------------------------------
1 | # 漏斗图
2 |
3 | 漏斗图又叫倒三角图,漏斗图将数据呈现为几个阶段,每个阶段的数据都是整体的一部分,从一个阶段到另一个阶段数据自上而下逐渐下降,所有阶段的占比总计 100%。与饼图一样,漏斗图呈现的也不是具体的数据,而是该数据相对于总数的占比、漏斗图不需要使用任何数据轴。
4 |
5 | 漏斗图多用于显示简化的数据,可以用来单向分析业务各环节丢失或增加变化,也可用来直接表示某个环节与上一环节的差异。漏斗图对于确定组织的销售过程中可能存在的问题和瓶颈也很有用。
6 |
7 |
10 |
11 | ## 漏斗图的使用建议
12 |
13 | 1、以电商网站数据为代表,漏斗图能直观地展现从最初展现网站到最终下订单购买这整个流程中的转化状况。它不仅能展示用户从看到网站到实现购买的最终转化率,还可以展示每个步骤的转化率,能够直观地展示和说明问题所在,进而能针对性地通过各阶段的转化分析去改善设计。
14 |
15 | 如下图,「展现」「点击」「访问」三个环节基本并没有太大的流失,但是从「访问」到「咨询」环节数据明显减少,所以就可以重点分析为什么咨询量明显减少,例如是不是咨询的入口不够明显造成的。
16 |
17 |
20 |
21 | 2、可以对两个基于统一事情前后的两份数据使用叠加两个漏斗图进行对比,例如下图通过预期值和实现值的对比,可以分析每一项实现情况和预期指标的偏差。
22 |
23 |
26 |
27 | 3、还可以用左右对比的漏斗图同时分析两个项目的转化情况。如下图可见项目 B 从「访问」到「咨询」环节的流失率明显大于项目 A。
28 |
29 |
32 |
33 | 4、漏斗图不是表示各个分类的占比情况,而是展示数据变化的一个逻辑流程,如果数据是无逻辑顺序的占比比较,建议使用饼图更合适。
34 |
35 | 5、可以根据数据选择使用对比色或同一种颜色的色调渐变,从最暗到最浅来依照漏斗的尺寸排列。切记,不要添加许多图层和颜色造成漏斗图难以阅读。
36 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/gauge.md:
--------------------------------------------------------------------------------
1 | # 仪表盘
2 |
3 | 仪表盘也被称为拨号图表或速度表图。其显示类似于拨号/速度计上的读数的数据,是一种拟物化的展示形式。仪表盘的颜色可以用来划分指示值的类别,使用刻度标示数据,指针指示维度,指针角度表示数值。
4 |
5 |
8 |
9 | ## 仪表盘的使用建议
10 |
11 | 1、仪表盘非常适合在量化的情况下显示单一的价值和衡量标准,不适合用于比较不同变量或者趋势的分析。
12 |
13 | 2、仪表盘上可以同时展示不同纬度的数据,但是为了避免指针的重叠影响数据的查看,并且基于常识,仪表盘的指针数量建议最多不要超过 3 根。如果确实有多个数据需要展示,建议可使用多个仪表盘。
14 |
15 |
18 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/line/area.md:
--------------------------------------------------------------------------------
1 | # 区域面积折线图
2 |
3 | 面积图又叫区域图,与折线图很相近,都可以用来展示随着连续时间的推移数据的变化趋势。区别在于,面积图在折线与类别数据的水平轴(X 轴)之间填充颜色或者纹理,形成一个面表示数据体积。相对于折线而言,被填充的区域可以更好的引起人们对总值趋势的注意,所以面积图主要用于传达趋势的大小,而不是确切的单个数据值。
4 |
5 |
7 |
8 | ## 面积图的使用建议
9 |
10 | 1、面积图要用填充区域来展示数据,当图表上有多个图层时,要尽量确保数据不要重叠。如果无法避免重叠,可以通过将颜色和透明度设置为适当的值,使重叠的数据图可以变得可读。
11 |
12 |
14 |
15 | 2、面积图适合用来展示二到三组数据,建议最多不要展示超过四组数据系列,否则就如下方错误示例,数据系列过多而导致无法辨识数据,因此要避免在需要比较多个类别和确切的数据值的情况下使用面积图。超过三个系列的非堆叠面积图表是很难阅读的。
16 |
17 |
19 |
20 | 3、当数据值相距很远时,区域是模糊不清的,此时 不太适合使用面积图展示。如下方错误示例虽然仔细分析能确定只展示了两个类别,乍一看,很可能会误以为图表上显示三种不同的颜色。
21 |
22 |
24 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/line/basic-line.md:
--------------------------------------------------------------------------------
1 | # 基础折线图
2 |
3 | 折线图主要用来展示数据项随着时间推移的趋势或变化。折线图非常适合用于展示一个连续的二维数据,如某网站访问人数或商品销量价格的波动。
4 |
5 |
8 |
9 | 折线图除了展示某个事情发展的趋势,还可以用来比较多个不同的数据序列。如下图,可以通过对比同时间段的三种商品的销量,分析哪一种商品的销量最好。
10 |
11 |
14 |
15 | 折线图是将数据点之间用线连接起来绘制成的图表。为了追求美观或特殊的效果,还可以如上图将点与点之间用曲线连接,这种图又叫曲线图或样条图样条。样条图与折线图用法相同,区别是数据点之间的连线使用曲线绘制。
16 |
17 | ## 折线图的使用建议
18 |
19 | 1、使用实线绘制数据线,首先要保证能够的区分数据线和坐标轴线,并且要尽力要所有的数据清晰可识别。
20 |
21 | 2、建议不要绘制 4 条以上的折线,如下图错误的示例,线都折叠在一起并且又没有明显的对比,整张图表就会混乱并难以阅读。
22 |
23 |
26 |
27 | 3、不建议使用过多的装饰来区分图表,图例虽然可以帮助区分不同数据系列,但如下图使用过多种类的图例有时会让用户分心。
28 |
29 |
32 |
33 | 4、展示折线图的数据时,要避免刻意的歪曲趋势。如下图,左图过于扁平化掩盖了想传达的信息,右图过于夸大趋势。要根据展示数据波动的参考单位,做有意义的波动分析。正确的数据高度是线约占 Y 轴高度的 2/3。
34 |
35 |
36 |
--------------------------------------------------------------------------------
/contents/zh/best-practices/specification/line/stacked-area.md:
--------------------------------------------------------------------------------
1 | # 堆叠面积图
2 |
3 | 堆积面积图是一种特殊的面积图,可以用来比较在一个区间内的多个变量。堆叠面积图和面积图的区别在于,堆叠面积图每个数据系列的起点都是基于前一个数据系列绘制的,也就是每度量一行就要填满行与行之间的区域。
4 |
5 | 如果有多个数据系列,并想分析每个类别的部分到整体的关系,并展现部分量对于总量的贡献时,使用堆积面积图是非常合适的选择。例如下图显示某个销售员对总销售额的贡献。
6 |
7 |
10 |
11 | 有两种不同的堆积面积图类型:
12 |
13 | - 传统的堆积面积图:直接使用原始值堆叠,显示整个过程如何变化。
14 | - 百分比堆积面积图:百分比堆积显示不同部分之间的关 系如何随时间而变化。其中累积的总数不重要,重要的是显示出类别分布在整体中的作用。
15 |
16 |
19 |
20 | ## 堆叠面积图的使用建议
21 |
22 | 1、图表有重叠的数据时,类别数量越多,重叠越多,因此可见度越低。如果使用面积图(如下示例)时会因为系列的重叠而无法阅读。
23 |
24 |
27 |
28 | 那同样的数据,换成使用堆叠面积图展示,则相对更容易阅读。
29 |
30 |
33 |
34 |