|
|
@ -2,8 +2,6 @@ import VueChartwerkPodMixin from './VueChartwerkPodMixin'; |
|
|
|
import { PodState } from './state'; |
|
|
|
import { PodState } from './state'; |
|
|
|
import { Grid } from './components/grid'; |
|
|
|
import { Grid } from './components/grid'; |
|
|
|
|
|
|
|
|
|
|
|
import styles from './css/style.css'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
import { |
|
|
|
Margin, |
|
|
|
Margin, |
|
|
|
TimeSerie, |
|
|
|
TimeSerie, |
|
|
@ -98,6 +96,9 @@ const DEFAULT_OPTIONS: Options = { |
|
|
|
format: AxisFormat.NUMERIC |
|
|
|
format: AxisFormat.NUMERIC |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
background: { |
|
|
|
|
|
|
|
color: 'none', |
|
|
|
|
|
|
|
}, |
|
|
|
crosshair: { |
|
|
|
crosshair: { |
|
|
|
orientation: CrosshairOrientation.VERTICAL, |
|
|
|
orientation: CrosshairOrientation.VERTICAL, |
|
|
|
color: 'red' |
|
|
|
color: 'red' |
|
|
@ -146,9 +147,6 @@ abstract class ChartwerkPod<T extends TimeSerie, O extends Options> { |
|
|
|
_series: T[] = [], |
|
|
|
_series: T[] = [], |
|
|
|
_options: O |
|
|
|
_options: O |
|
|
|
) { |
|
|
|
) { |
|
|
|
// TODO: test if it's necessary
|
|
|
|
|
|
|
|
styles.use(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let options = cloneDeep(_options); |
|
|
|
let options = cloneDeep(_options); |
|
|
|
defaultsDeep(options, DEFAULT_OPTIONS); |
|
|
|
defaultsDeep(options, DEFAULT_OPTIONS); |
|
|
|
this.options = options; |
|
|
|
this.options = options; |
|
|
@ -172,11 +170,11 @@ abstract class ChartwerkPod<T extends TimeSerie, O extends Options> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public render(): void { |
|
|
|
public render(): void { |
|
|
|
this.renderAxes(); |
|
|
|
|
|
|
|
this.renderGrid(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.renderClipPath(); |
|
|
|
this.renderClipPath(); |
|
|
|
this.addEvents(); |
|
|
|
this.addEvents(); |
|
|
|
|
|
|
|
this.updateBackground(); |
|
|
|
|
|
|
|
this.renderAxes(); |
|
|
|
|
|
|
|
this.renderGrid(); |
|
|
|
|
|
|
|
|
|
|
|
this.renderCrosshair(); |
|
|
|
this.renderCrosshair(); |
|
|
|
this.renderMetricsContainer(); |
|
|
|
this.renderMetricsContainer(); |
|
|
@ -395,6 +393,12 @@ abstract class ChartwerkPod<T extends TimeSerie, O extends Options> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateBackground(): void { |
|
|
|
|
|
|
|
// TODO: background should be a separate component
|
|
|
|
|
|
|
|
const background = this.chartContainer.select('.overlay') || this.chartContainer.select('.custom-overlay'); |
|
|
|
|
|
|
|
background.attr('fill', this.options.background.color); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected addEvents(): void { |
|
|
|
protected addEvents(): void { |
|
|
|
// TODO: refactor for a new mouse/scroll events
|
|
|
|
// TODO: refactor for a new mouse/scroll events
|
|
|
|
const panKeyEvent = this.options.zoomEvents.mouse.pan.keyEvent; |
|
|
|
const panKeyEvent = this.options.zoomEvents.mouse.pan.keyEvent; |
|
|
|