Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/axes/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Namespace: `options.scales[scaleId].grid`, it defines options for the grid lines
| `drawTicks` | `boolean` | | | `true` | If true, draw lines beside the ticks in the axis area beside the chart.
| `lineWidth` | `number` | Yes | Yes | `1` | Stroke width of grid lines.
| `offset` | `boolean` | | | `false` | If true, grid lines will be shifted to be between labels. This is set to `true` for a bar chart by default.
| `step` | `number` | | | 1 | Setting higher value allows skipping ticks before the next grid line.
| `tickBorderDash` | `number[]` | Yes | Yes | `[]` | Length and spacing of the tick mark line. If not set, defaults to the grid line `borderDash` value.
| `tickBorderDashOffset` | `number` | Yes | Yes | | Offset for the line dash of the tick mark. If unset, defaults to the grid line `borderDashOffset` value
| `tickColor` | [`Color`](../general/colors.md) | Yes | Yes | | Color of the tick line. If unset, defaults to the grid line color.
Expand Down
1 change: 1 addition & 0 deletions src/core/core.scale.defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function applyScaleDefaults(defaults) {
lineWidth: 1,
drawOnChartArea: true,
drawTicks: true,
step: 1,
tickLength: 8,
tickWidth: (_ctx, options) => options.lineWidth,
tickColor: (_ctx, options) => options.color,
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ export default class Scale extends Element {
};

if (grid.display) {
for (i = 0, ilen = items.length; i < ilen; ++i) {
for (i = 0, ilen = items.length; i < ilen; i += (grid.step || 1)) {
const item = items[i];

if (grid.drawOnChartArea) {
Expand Down
4 changes: 4 additions & 0 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2989,6 +2989,10 @@ export interface GridLineOptions {
* @default true
*/
drawTicks: boolean;
/**
* @default 1
*/
step: number;
/**
* @default []
*/
Expand Down
Loading