Skip to content

Commit

Permalink
Improve bar documentation for field "seriesField". (#555)
Browse files Browse the repository at this point in the history
* Improve bar documentation for field "seriesField".

Explain how to avoid issues with stacked bars order.
Example added.

* Fix: improve text understanding.

Use word "xField" instead of "value" to avoid confusion.
  • Loading branch information
Lechevallier authored Apr 7, 2021
1 parent f655804 commit 76bff2f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/.g2plot-plot-api/bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,42 @@ The name of the data field corresponding to the graph in the y direction, usuall

Grouping field. It is the same meaning as groupField、colorField in Grouped Bar, and the same as stackField、colorField in Stacked Bar.

To avoid issues related to stacked bars order, make sure each `yField` gets a bar defined for each possible value of `seriesField`, even if `xField` is 0.

Example:

```ts
config = {
data: [
{
x: 0,
y: "bar",
color: "red"
},
{
x: 40,
y: "bar",
color: "yellow"
},
{
x: 2,
y: "foo",
color: "red"
},
{
x: 40,
y: "foo",
color: "yellow"
}
].reverse(),
isStack: true,
xField: "x",
yField: "y",
seriesField: "color",
color: _ref => _ref.color
};
```

#### groupField

<description>**optional** *string*</description>
Expand Down

0 comments on commit 76bff2f

Please sign in to comment.