|
|
|
@ -7,13 +7,13 @@ import * as d3 from 'd3';
|
|
|
|
|
import defaultsDeep from 'lodash/defaultsDeep'; |
|
|
|
|
|
|
|
|
|
const DEFAULT_GRID_TICK_COUNT = 5; |
|
|
|
|
const DEFAULT_GRID_OPTIONS = { |
|
|
|
|
const DEFAULT_GRID_OPTIONS: GridOptions = { |
|
|
|
|
x: { |
|
|
|
|
isActive: true, |
|
|
|
|
enabled: true, |
|
|
|
|
ticksCount: DEFAULT_GRID_TICK_COUNT, |
|
|
|
|
}, |
|
|
|
|
y: { |
|
|
|
|
isActive: true, |
|
|
|
|
enabled: true, |
|
|
|
|
ticksCount: DEFAULT_GRID_TICK_COUNT, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
@ -22,6 +22,7 @@ const DEFAULT_GRID_OPTIONS = {
|
|
|
|
|
// Grid Class - is a core component, which can be a separate Pod in the future. (but not in current Pod terminology)
|
|
|
|
|
// All components have construcor with required args: svg element which will be filled with this component and options for it.
|
|
|
|
|
// All compoтents have a reqiured method "render", which will be called in core costructor. <- this solution is temporary.
|
|
|
|
|
// Each component has its own default options.
|
|
|
|
|
// svgElement should be a separate class with its own height, width, xScale, yScale params to avoid SvgElOptions as argument.
|
|
|
|
|
// We have a general problem with passing d3 as argument everywhere. Fix it, and remove from arg in constructor here.
|
|
|
|
|
export class Grid { |
|
|
|
@ -50,7 +51,7 @@ export class Grid {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderGridLinesX(): void { |
|
|
|
|
if(!this.gridOptions.x.isActive) { |
|
|
|
|
if(!this.gridOptions.x.enabled) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this._svgEl |
|
|
|
@ -67,7 +68,7 @@ export class Grid {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderGridLinesY(): void { |
|
|
|
|
if(!this.gridOptions.y.isActive) { |
|
|
|
|
if(!this.gridOptions.y.enabled) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this._svgEl |
|
|
|
|