You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,7 +15,7 @@ This project is part of the source of [The Apache ECharts Official Website](http
15
15
16
16
## Development
17
17
18
-
### Document content development
18
+
### Document Content Development
19
19
20
20
Do not need other project.
21
21
@@ -28,46 +28,59 @@ It will:
28
28
+ Watch doc site src change and rebuild.
29
29
+ Watch doc markdown change and rebuild.
30
30
31
+
### Local Config
31
32
32
-
## Tips about writing doc
33
+
To customize the links of `echarts-examples` and other configurations, you can create a local config file `echarts-doc/config/env.dev-local.js`, which is not tracked by git. The content can be copied from `echarts-doc/config/env.dev.js`, and then modify it as needed. `npm run dev` will use this local config file, if it exists, to replace `echarts-doc/config/env.dev.js`.
33
34
34
-
### "Since version" is necessary in doc
35
+
36
+
## Tips About Writing Doc
37
+
38
+
### "Since Version"
39
+
"Since Version" is necessary in doc.
35
40
Marking "since version" indicates when a new feature was introduced.
36
41
For example,
37
42
```
38
43
{{ use: partial-version(version = "6.0.0") }}
39
44
```
40
45
41
-
### Global variables can be used in doc
46
+
### Global Variables
47
+
48
+
These global variables can be used in doc:
49
+
+`${galleryViewPath}`
50
+
+`${galleryEditorPath}`
51
+
+`${websitePath}`
42
52
43
-
+ galleryViewPath
44
-
+ galleryEditorPath
45
-
+ websitePath
53
+
See samples in "Reference of echarts-examples or other links"
A `~` can be used to refer to a option item in the same doc. For example:
64
-
65
77
```md
66
78
[xAxis.name](~xAxis.name)
67
79
```
68
80
69
81
If intending to reference an anchor in different doc, it can be:
70
82
```md
83
+
In api.html, reference
71
84
[itemStyle](option.html#series.itemStyle)
72
85
```
73
86
@@ -112,6 +125,60 @@ It indicates the range of saturation (color alpha) {{ if: ${prefix} !== '#' }}fo
112
125
113
126
```
114
127
128
+
### Doc Structure
129
+
130
+
+ Entries:
131
+
+ the entry in source code is like `en/api/api.md`, `en/api/option.md`, they will be compiled to webpage like `api.html`, `option.html`
132
+
133
+
+ Shared targets (text blocks):
134
+
+ All of the shared targets should be put into the `partial` folder, such as, `en/api/partial/xxx`, `en/optino/partial/xxx`, and named with a prefix `partial-`.
+ Can only be `number`, `string`, `boolean`, `Object`, `Array`, `Function`
152
+
+ Can be an union, such as `number|string`.
153
+
+ `= xxx` is the default value in that subtitle:
154
+
+ Can be omitted.
155
+
+ Typically be `null`, `undefined`, `true`, `false`, `90` (a literal number), `some literal string`, `[0, 90]` (an literal array).
156
+
+ The default value can be specified by a template variable, such as, `= ${someVar}`, `= ${someVar|default(123)}`, `= ${someVar|default("'auto'")}`.
157
+
+ The top level subtitles:
158
+
+ For example, `# series.bar(Object)`, the dot symbol represents a special meaning: the component main type is `'series'` and the component sub-type is `'bar'`.
159
+
+ The variable `${prefix}`
160
+
+ It is commonly used in "target: partial-xxx", which serves different subtitle levels. The value of `${prefix}` is like `'#'`, `'##'`, `'###'`, ...
161
+
+ Typical usage:
162
+
```tpl
163
+
When we define a "target"
164
+
{{ target: partial-abc-1 }}
165
+
#${prefix} propLayout(Object)
166
+
All of the subtitles should uses that prefix variable.
167
+
##${prefix} x(number)
168
+
some desc
169
+
##${prefix} y(number)
170
+
some desc
171
+
{{ /target }}
172
+
{{ target: partial-target-2 }}
173
+
```
174
+
```tpl
175
+
When we use that "partial-abc-1"
176
+
{{ target: partial-def-2 }}
177
+
#${prefix|default('#')} somePropA(Object)
178
+
{{ use: partial-abc-1(
179
+
prefix: ${prefix} + '#'
180
+
) }}
181
+
```
115
182
116
183
### Template Syntax
117
184
@@ -120,11 +187,22 @@ The template syntax follows [etpl](https://github.com/ecomfe/etpl/blob/master/do
120
187
121
188
Summary of the commonly used syntax:
122
189
```template
123
-
VARIABLE:
124
-
some text ${someVariable} some text
125
-
126
-
127
-
IF ELSE:
190
+
--- TEMPLATE VARIABLE ---
191
+
Use a variable:
192
+
some text ${someVariable} some text
193
+
Variable scope:
194
+
The scope of any variable is "target" (see below).
195
+
Variable filter:
196
+
Some predefined filters can be used in the template variable, e.g.,
197
+
${someVariable|default("'auto'")} means using the string "'auto'"
198
+
as the default if ${someVariable} is '' or null or undefined.
199
+
Declaration or assignment of a target-local variable:
200
+
{{ var: myVar = 'some' }}
201
+
{{ var: myVar = 123 }}
202
+
{{ var: myVar = ${someOtherStr} + 'some_str' }}
203
+
204
+
205
+
--- IF ELSE ---
128
206
{{ if: ${number1} > 0 }}
129
207
some text xxx
130
208
{{ elif: ${string1} === 'abc' }}
@@ -134,34 +212,40 @@ some text zzz
134
212
{{ /if }}
135
213
136
214
137
-
FOR LOOP:
215
+
--- FOR LOOP ---
138
216
{{ for: ${persons} as ${person}, ${index} }}
139
217
some text ${index}: ${person.name}
140
218
{{ /for }}
141
219
142
220
143
-
TARGET (DEFINE A BLOCK):
221
+
--- TARGET (DEFINE A TEXT BLOCK) ---
144
222
{{ target: a_predefined_block_name_1 }}
145
223
The input varA is ${varA}
146
224
The input varB is ${varB}
147
225
The input varC is ${varC}
148
-
some other text xxx
149
-
(The close target can be omitted, but not recommended.)
226
+
Notice:
227
+
- The scope of the "target name" is the entire webpage (such as, `option.html`, `api.html`), so name conflicts should be avoided.
228
+
- "target" is not shared across webpage (such as, `option.html`, `api.html`).
229
+
- The close tag of "target" can be omitted, but not recommended.
150
230
{{ /target }}
151
231
152
232
153
-
USE (USE A BLOCK):
154
-
{{ use: a_predefined_block_name_1(
233
+
--- USE (USE A PREDEFINED TEXT BLOCK) ---
234
+
{{ use: a_predefined_block_name_1 }}
235
+
{{ use: a_predefined_block_name_2(
155
236
varA = ${myVarX},
156
237
varB = 123,
157
-
varC = 'some string'
158
-
)}}
159
-
{{ use: a_predefined_block_name_2 }}
238
+
varC = 'some string',
239
+
prefix: ${prefix} + '##'
240
+
) }}
241
+
Concatenation operator `+` can be used in that string.
160
242
```
161
243
162
244
163
245
### Document Embedded Examples
164
246
247
+
This is the embedded example that can be opened by clicking "try it" and then appears on the right side of the doc page.
248
+
165
249
Declare the base echarts options (`ExampleBaseOption`), whose scope is each echarts component or series. A `ExampleBaseOption` can be shared by multiple options. e.g.,
166
250
```md
167
251
<ExampleBaseOptionname="cartesian-bar"title="直角坐标系上的柱状图"title-en="Bar on Cartesian">
@@ -199,7 +283,7 @@ npm run format
199
283
200
284
Make sure have a double review on the git diff after formatted.
201
285
202
-
## Sync docs between different languages.
286
+
## Sync Docs Between Different Languages
203
287
204
288
After you finished editing doc of one language. You can use following script to sync it to another language.
Whether the grid region contains [axis tick label](~yAxis.axisLabel).
37
38
38
39
+ When containLabel is `false`:
@@ -42,6 +43,68 @@ Whether the grid region contains [axis tick label](~yAxis.axisLabel).
42
43
+`grid.left``grid.right``grid.top``grid.bottom``grid.width``grid.height` decide the location and size of the rectangle that contains the axes, and the labels of the axes.
43
44
+ Setting to `true` will help when the length of axis labels is dynamic and is hard to approximate. This will avoid labels from overflowing the container or overlapping other components.
44
45
46
+
## outerBoundsMode(string) = 'auto'
47
+
{{ use: partial-version(version = "6.0.0") }}
48
+
49
+
The "outer bounds" is a constraint rectangle used to prevent axis labels and axis names from overflowing. `outerBoundsMode` defines the strategy for determining the "outer bounds".
50
+
51
+
In most cases, we do not need to specify [grid.outerBoundsMode](~grid.outerBoundsMode), [grid.outerBounds](~grid.outerBounds), [grid.outerBoundsContain](~grid.outerBoundsContain) and [grid.containLabel](~grid.containLabel), as the default settings can prevent axis labels and axis names from overflowing the canvas.
52
+
53
+
The grid component (Cartesian) layout strategy:
54
+
+ First, lay out axis lines based on the rect defined by [grid.left](~grid.left)/[right](~grid.right)/[top](~grid.top)/[bottom](~grid.bottom)/[width](~grid.width)/[height](~grid.height). This can meet the requirement of aligning axis lines across multiple grids.
55
+
+ Then, if axis labels and/or axis names overflow the "outer bounds", shrink the rectangle to prevent that overflow. [grid.outerBoundsContain](~grid.outerBoundsContain) determines whether axis label and axis name is confined by the "outer bounds".
56
+
57
+
Options of `outerBoundsMode`:
58
+
-`'auto'`/`null`/`undefined` (default):
59
+
- Behave the same as `outerBoundsMode: 'same'` when `grid.containLabel: true`.
60
+
- Otherwise, the "outer bounds" is determined by [grid.outerBounds](~grid.outerBounds) if specified.
61
+
- Otherwise, automatically determine the "outer bounds" - typically defaulting to the current canvas, or a assigned layout rectangle if this `grid` is laid out in another coordinate system (see [grid.coordinateSystem](~grid.coordinateSystem)).
62
+
-`'none'`: Force the "outer bounds" to be infinity (i.e., no constraint), regardless of the specified [grid.outerBounds](~grid.outerBounds).
63
+
-`'same'`: Force the "outer bounds" to be the same as the layout rectangle defined by [grid.left](~grid.left)/[right](~grid.right)/[top](~grid.top)/[bottom](~grid.bottom)/[width](~grid.width)/[height](~grid.height), regardless of the specified [grid.outerBounds](~grid.outerBounds).
64
+
65
+
> The "outer bounds" encompasses the functionality of [grid.containLabel](~grid.containLabel); therefore, [grid.containLabel](~grid.containLabel) is deprecated. `grid.containLabel: true` is equivalent to `grid: {outerBoundsMode: 'same', outerBoundsContain: 'axisLabel'}`.
66
+
> The effect might be slightly different, but usually indiscernible. You can use the code below to enforce the previous effect, though it's unnecessary in most cases.
See details in [grid.outerBoundsMode](~grid.outerBoundsMode).
80
+
81
+
See also [outerBounds example](${galleryEditorPath}doc-example/grid-outerBounds&edit=1&reset=1).
82
+
83
+
{{ use: partial-rect-layout-width-height(
84
+
hostName = "`outerBounds`",
85
+
noZ = true,
86
+
prefix = '##',
87
+
defaultLeft = 0,
88
+
defaultTop = 0,
89
+
defaultRight = 0,
90
+
defaultBottom = 0
91
+
) }}
92
+
93
+
## outerBoundsContain(boolean) = 'auto'
94
+
{{ use: partial-version(version = "6.0.0") }}
95
+
96
+
Options:
97
+
- `'auto'`/`null`/`undefined` (default):
98
+
- Behave the same as `outerBoundsContain:'axisLabel'` if `containLabel:true`.
99
+
- Otherwise, behave the same as `outerBoundsContain:'all'`.
100
+
- `'all'`: The "outer bounds" constrain the grid (Cartesian) rectangle (determined by the x-axis and y-axis lines) and axis labels and axis names.
101
+
- `'axisLabel'`: The "outer bounds" constrain the grid (Cartesian) rectangle (determined by the x-axis and y-axis lines) and axis labels, but exclude axis names.
102
+
103
+
For more details, see [grid.outerBoundsMode](~grid.outerBoundsMode).
104
+
105
+
See also [outerBounds example](${galleryEditorPath}doc-example/grid-outerBounds&edit=1&reset=1).
0 commit comments