forked from naikus/svg-gauge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svg-gauge.d.ts
69 lines (66 loc) · 1.9 KB
/
svg-gauge.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
declare module 'svg-gauge' {
export interface GaugeInstance {
setMaxValue: (max: number) => void
setValue: (val: number) => void
setValueAnimated: (val: number, duration: number) => void
getValue: () => number
}
export interface GaugeOptions {
/** The angle in degrees to start the dial
* @default 135
*/
dialStartAngle?: number
/** The angle in degrees to end the dial. This MUST be less than dialStartAngle
* @default 45
*/
dialEndAngle?: number
/** The radius of the gauge
* @default 40
*/
dialRadius?: number
/** The minimum value for the gauge. This can be a negative value
* @default 0
*/
min?: number
/** The maximum value for the gauge
* @default 100
*/
max?: number
/** Getter for the label that will be rendered in the center. */
label?: (currentValue: number) => string
/** Whether to show the value at the center of the gauge
* @default true
*/
showValue?: boolean
/** The CSS class of the gauge
* @default 'gauge'
*/
gaugeClass?: string
/** The CSS class of the gauge's dial
* @default 'dial'
*/
dialClass?: string
/** The CSS class of the gauge's fill
* @default 'value'
*/
valueDialClass?: string
/** The CSS class of the gauge's text
* @default '(value-text)'
*/
valueClass?: string
/** An optional function that can return a color for current value
*/
color?: (currentValue: number) => string
/** An optional string that specifies the crop region
* @default '(0 0 100 100)'
*/
viewBox?: string
}
/**
* Creates a Gauge instance.
* @param {Element} element The DOM into which to render the gauge
* @param {GaugeOptions} options The gauge options
*/
const createInstance: (element: Element, options?: GaugeOptions) => GaugeInstance
export default createInstance
}