import { Axis , AxisOrientation , TickValue , FontWeight , } from '@chart-parts/interfaces' ; import { Subject } from 'rxjs' ; import { AxisSpec } from '../spec/AxisSpec' ; category export class AxisBuilder { public readonly onChange = new Subject < any > ( ) ; public readonly spec : AxisSpec ; public constructor ( scale , orient ) { if ( ! scale ) { throw new Error ( 'scale must be defined' ) ; } if ( ! orient ) { throw new Error ( 'orient must be defined' ) ; } this . spec = new AxisSpec ( scale , orient ) ; } public domain ( value ) { this . spec . domain = value ; this . onChange . next ( 'axis domain changed' ) ; return this ; } public domainWidth ( value ) { this . spec . domainWidth = value ; this . onChange . next ( 'axis domain width changed' ) ; return this ; } public domainColor ( value ) { this . spec . domainColor = value ; this . onChange . next ( 'axis domain color changed' ) ; return this ; } public ticks ( value ) { this . spec . ticks = value ; this . onChange . next ( 'axis ticks changed' ) ; return this ; } public tickColor ( value ) { this . spec . tickColor = value ; this . onChange . next ( 'axis tick color changed' ) ; return this ; } public tickCount ( value ) { this . spec . tickCount = value ; this . onChange . next ( 'axis tick count changed' ) ; return this ; } public tickOffset ( value ) { this . spec . tickOffset = value ; this . onChange . next ( 'axis tick offset changed' ) ; return this ; } public tickRound ( value ) { this . spec . tickRound = value ; this . onChange . next ( 'axis tickRound changed' ) ; return this ; } public tickSize ( value ) { this . spec . tickSize = value ; this . onChange . next ( 'axis tickSize changed' ) ; return this ; } public tickWidth ( value ) { this . spec . tickWidth = value ; this . onChange . next ( 'axis tickWidth changed' ) ; return this ; } public bandPosition ( value ) { this . spec . bandPosition = value ; this . onChange . next ( 'axis bandPosition changed' ) ; return this ; } public values ( values ) { this . spec . values = values ; this . onChange . next ( 'axis values changed' ) ; return this ; } public labels ( value ) { this . spec . labels = value ; this . onChange . next ( 'axis labels changed' ) ; return this ; } public labelFont ( value ) { this . spec . labelFont = value ; this . onChange . next ( 'axis labelFont changed' ) ; return this ; } public labelFontSize ( value ) { this . spec . labelFontSize = value ; this . onChange . next ( 'axis labelFontSize changed' ) ; return this ; } public labelColor ( value ) { this . spec . labelColor = value ; this . onChange . next ( 'axis labelColor changed' ) ; return this ; } public labelPadding ( value ) { this . spec . labelPadding = value ; this . onChange . next ( 'axis labelPadding changed' ) ; return this ; } public labelFontWeight ( value ) { this . spec . labelFontWeight = value ; this . onChange . next ( 'axis labelFontWeight changed' ) ; return this ; } public labelAngle ( value ) { this . spec . labelAngle = value ; this . onChange . next ( 'axis labelAngel changed' ) ; return this ; } public labelFormat ( value ) { this . spec . labelFormat = value ; this . onChange . next ( 'axis labelFormat changed' ) ; return this ; } public thickness ( value ) { this . spec . thickness = value ; this . onChange . next ( 'axis thickness changed' ) ; return this ; } public build ( ) { return this . spec ; } }