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
Copy file name to clipboardExpand all lines: docs/axes/cartesian/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ All of the included cartesian axes support a number of common options.
15
15
| ---- | ---- | ------- | -----------
16
16
| `type` | `string` | | Type of scale being employed. Custom scales can be created and registered with a string key. This allows changing the type of an axis for a chart.
17
17
| `position` | `string` | | Position of the axis in the chart. Possible values are: `'top'`, `'left'`, `'bottom'`, `'right'`
18
-
| `offset` | `boolean` | `false` | If true, extra space is added to the both edges and the axis is scaled to fit into the chart area. This is set to `true` for a category scale in a bar chart by default.
18
+
| `offset` | `boolean` | `false` | If true, extra space is added to the both edges and the axis is scaled to fit into the chart area. This is set to `true` for a bar chart by default.
19
19
| `id` | `string` | | The ID is used to link datasets and scale axes together. [more...](#axis-id)
20
20
| `gridLines` | `object` | | Grid line configuration. [more...](../styling.md#grid-line-configuration)
21
21
| `scaleLabel` | `object` | | Scale title configuration. [more...](../labelling.md#scale-title-configuration)
Copy file name to clipboardExpand all lines: docs/axes/styling.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ The grid line configuration is nested under the scale configuration in the `grid
22
22
| `zeroLineColor` | `Color` | `'rgba(0, 0, 0, 0.25)'` | Stroke color of the grid line for the first index (index 0).
23
23
| `zeroLineBorderDash` | `number[]` | `[]` | Length and spacing of dashes of the grid line for the first index (index 0). See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash).
24
24
| `zeroLineBorderDashOffset` | `number` | `0.0` | Offset for line dashes of the grid line for the first index (index 0). See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineDashOffset).
25
-
| `offsetGridLines` | `boolean` | `false` | If true, grid lines will be shifted to be between labels. This is set to `true` for a category scale in a bar chart by default.
25
+
| `offsetGridLines` | `boolean` | `false` | If true, grid lines will be shifted to be between labels. This is set to `true` for a bar chart by default.
26
26
| `z` | `number` | `0` | z-index of gridline layer. Values <= 0 are drawn under datasets, > 0 on top.
Copy file name to clipboardExpand all lines: docs/charts/bar.md
+29-12Lines changed: 29 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -134,8 +134,8 @@ The interaction with each bar can be controlled with the following properties:
134
134
135
135
All these values, if `undefined`, fallback to the associated [`elements.rectangle.*`](../configuration/elements.md#rectangle-configuration) options.
136
136
137
-
## Scale Configuration
138
-
The bar chart accepts the following configuration from the associated `scale` options:
137
+
## Dataset Configuration
138
+
The bar chart accepts the following configuration from the associated dataset options:
139
139
140
140
| Name | Type | Default | Description
141
141
| ---- | ---- | ------- | -----------
@@ -144,6 +144,33 @@ The bar chart accepts the following configuration from the associated `scale` op
144
144
| `barThickness` | <code>number|string</code> | | Manually set width of each bar in pixels. If set to `'flex'`, it computes "optimal" sample widths that globally arrange bars side by side. If not set (default), bars are equally sized based on the smallest interval. [more...](#barthickness)
145
145
| `maxBarThickness` | `number` | | Set this to ensure that bars are not sized thicker than this.
146
146
| `minBarLength` | `number` | | Set this to ensure that bars have a minimum length in pixels.
147
+
148
+
### Example Usage
149
+
150
+
```javascript
151
+
data: {
152
+
datasets: [{
153
+
barPercentage:0.5,
154
+
barThickness:6,
155
+
maxBarThickness:8,
156
+
minBarLength:2,
157
+
data: [10, 20, 30, 40, 50, 60, 70]
158
+
}]
159
+
};
160
+
```
161
+
### barThickness
162
+
If this value is a number, it is applied to the width of each bar, in pixels. When this is enforced, `barPercentage` and `categoryPercentage` are ignored.
163
+
164
+
If set to `'flex'`, the base sample widths are calculated automatically based on the previous and following samples so that they take the full available widths without overlap. Then, bars are sized using `barPercentage` and `categoryPercentage`. There is no gap when the percentage options are 1. This mode generates bars with different widths when data are not evenly spaced.
165
+
166
+
If not set (default), the base sample widths are calculated using the smallest interval that prevents bar overlapping, and bars are sized using `barPercentage` and `categoryPercentage`. This mode always generates bars equally sized.
167
+
168
+
## Scale Configuration
169
+
The bar chart sets unique default values for the following configuration from the associated `scale` options:
170
+
171
+
| Name | Type | Default | Description
172
+
| ---- | ---- | ------- | -----------
173
+
| `offset` | `boolean` | `true` | If true, extra space is added to the both edges and the axis is scaled to fit into the chart area.
147
174
| `gridLines.offsetGridLines` | `boolean` | `true` | If true, the bars for a particular data point fall between the grid lines. The grid line will move to the left by one half of the tick interval. If false, the grid line will go right down the middle of the bars. [more...](#offsetgridlines)
148
175
149
176
### Example Usage
@@ -152,23 +179,13 @@ The bar chart accepts the following configuration from the associated `scale` op
152
179
options = {
153
180
scales: {
154
181
xAxes: [{
155
-
barPercentage:0.5,
156
-
barThickness:6,
157
-
maxBarThickness:8,
158
-
minBarLength:2,
159
182
gridLines: {
160
183
offsetGridLines:true
161
184
}
162
185
}]
163
186
}
164
187
};
165
188
```
166
-
### barThickness
167
-
If this value is a number, it is applied to the width of each bar, in pixels. When this is enforced, `barPercentage` and `categoryPercentage` are ignored.
168
-
169
-
If set to `'flex'`, the base sample widths are calculated automatically based on the previous and following samples so that they take the full available widths without overlap. Then, bars are sized using `barPercentage` and `categoryPercentage`. There is no gap when the percentage options are 1. This mode generates bars with different widths when data are not evenly spaced.
170
-
171
-
If not set (default), the base sample widths are calculated using the smallest interval that prevents bar overlapping, and bars are sized using `barPercentage` and `categoryPercentage`. This mode always generates bars equally sized.
172
189
173
190
### offsetGridLines
174
191
If true, the bars for a particular data point fall between the grid lines. The grid line will move to the left by one half of the tick interval, which is the space between the grid lines. If false, the grid line will go right down the middle of the bars. This is set to true for a category scale in a bar chart while false for other scales or chart types by default.
0 commit comments