|
|
@ -1,6 +1,6 @@ |
|
|
|
import { GaugeTimeSerie, GaugeOptions, Stat, Stop, IconConfig, IconPosition } from './types'; |
|
|
|
import { GaugeTimeSerie, GaugeOptions, Stat, Stop, IconConfig, IconPosition } from './types'; |
|
|
|
|
|
|
|
|
|
|
|
import { ChartwerkPod, VueChartwerkPodMixin, AxisFormat } from '@chartwerk/core'; |
|
|
|
import { ChartwerkPod, VueChartwerkPodMixin, AxisFormat, CrosshairOrientation } from '@chartwerk/core'; |
|
|
|
|
|
|
|
|
|
|
|
import { findClosest } from './utils'; |
|
|
|
import { findClosest } from './utils'; |
|
|
|
|
|
|
|
|
|
|
@ -43,6 +43,7 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = { |
|
|
|
axis: { |
|
|
|
axis: { |
|
|
|
x: { isActive: false, format: AxisFormat.NUMERIC }, |
|
|
|
x: { isActive: false, format: AxisFormat.NUMERIC }, |
|
|
|
y: { isActive: false, format: AxisFormat.NUMERIC }, |
|
|
|
y: { isActive: false, format: AxisFormat.NUMERIC }, |
|
|
|
|
|
|
|
y1: { isActive: false, format: AxisFormat.NUMERIC }, |
|
|
|
}, |
|
|
|
}, |
|
|
|
margin: { |
|
|
|
margin: { |
|
|
|
top: 0, bottom: 0, |
|
|
|
top: 0, bottom: 0, |
|
|
@ -58,6 +59,10 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = { |
|
|
|
value: 20 |
|
|
|
value: 20 |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
], |
|
|
|
|
|
|
|
crosshair: { |
|
|
|
|
|
|
|
orientation: CrosshairOrientation.VERTICAL, |
|
|
|
|
|
|
|
color: 'red' |
|
|
|
|
|
|
|
}, |
|
|
|
defaultColor: 'red', |
|
|
|
defaultColor: 'red', |
|
|
|
stat: Stat.CURRENT, |
|
|
|
stat: Stat.CURRENT, |
|
|
|
innerRadius: DEFAULT_INNER_RADIUS, |
|
|
|
innerRadius: DEFAULT_INNER_RADIUS, |
|
|
@ -88,6 +93,15 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions |
|
|
|
this._renderIcons(); |
|
|
|
this._renderIcons(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected updateOptions(newOptions: GaugeOptions): void { |
|
|
|
|
|
|
|
if(newOptions === undefined) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let options = _.cloneDeep(newOptions); |
|
|
|
|
|
|
|
_.defaultsDeep(options, DEFAULT_GAUGE_OPTIONS); |
|
|
|
|
|
|
|
this.options = options; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get _gaugeTransform(): string { |
|
|
|
get _gaugeTransform(): string { |
|
|
|
return `translate(${this.width / 2},${0.8 * this.height})`; |
|
|
|
return `translate(${this.width / 2},${0.8 * this.height})`; |
|
|
|
} |
|
|
|
} |
|
|
|