Skip to content

Commit

Permalink
Add opacity and dash to configurable grid line options
Browse files Browse the repository at this point in the history
  • Loading branch information
emmacunningham committed Jan 30, 2019
1 parent ba154de commit ac9d86c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/axes/axis_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ export function mergeWithDefaultGridLineConfig(config: GridLineConfig): GridLine
return {
stroke: config.stroke || DEFAULT_GRID_LINE_CONFIG.stroke,
strokeWidth: config.strokeWidth || DEFAULT_GRID_LINE_CONFIG.strokeWidth,
opacity: config.opacity || DEFAULT_GRID_LINE_CONFIG.opacity,
dash: config.dash || DEFAULT_GRID_LINE_CONFIG.dash,
};
}

Expand Down
3 changes: 3 additions & 0 deletions src/lib/themes/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface AxisConfig {
export interface GridLineConfig {
stroke?: string;
strokeWidth?: number;
opacity?: number;
dash?: number[];
}
export interface ScalesConfig {
ordinal: {
Expand Down Expand Up @@ -86,6 +88,7 @@ export interface PartialTheme {
export const DEFAULT_GRID_LINE_CONFIG: GridLineConfig = {
stroke: 'red',
strokeWidth: 1,
opacity: 1,
};

export const DEFAULT_THEME: Theme = {
Expand Down
20 changes: 20 additions & 0 deletions src/stories/styling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ storiesOf('Stylings', module)
max: 10,
step: 1,
}),
opacity: number('left axis grid line stroke opacity', 1, {
range: true,
min: 0,
max: 1,
step: 0.01,
}),
dash: [
number('left axis grid line dash length', 1, {
range: true,
min: 0,
max: 10,
step: 1,
}),
number('left axis grid line dash spacing', 1, {
range: true,
min: 0,
max: 10,
step: 1,
}),
],
};

return (
Expand Down

0 comments on commit ac9d86c

Please sign in to comment.