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