forked from emeryberger/CSrankings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd3pie.d.ts
146 lines (139 loc) · 3.69 KB
/
d3pie.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Type definitions for d3pie 0.1.9
// Project: https://github.com/benkeen/d3pie
// Definitions by: Petryshyn Sergii <https://github.com/mc-petry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace d3pie {
interface ID3PieChart {
redraw(): void
openSegment(index: number): void
closeSegment(index: void): void
getOpenSegment(): any
updateProp(propKey: string, value: any): void
destroy(): void
}
interface ID3PieStyleOptions {
color?: string
fontSize?: number
font?: string
}
interface ID3PieTextOptions extends ID3PieStyleOptions {
text?: string
}
interface ID3PieLabelsOptions {
format?: 'label' | 'value' | 'percentage' | 'label-value1' | 'label-value2' | 'label-percentage1' | 'label-percentage2'
hideWhenLessThanPercentage?: number
}
interface ID3PieOptions {
header?: {
title?: ID3PieTextOptions
subtitle?: ID3PieTextOptions
location?: 'top-center' | 'top-left' | 'pie-center'
titleSubtitlePadding?: number
}
footer?: { location?: 'left' } & ID3PieTextOptions
size?: {
canvasHeight?: number
canvasWidth?: number
pieOuterRadius?: string | number
pieInnerRadius?: string | number
}
data: {
sortOrder?: 'none' | 'random' | 'value-asc' | 'value-desc' | 'label-asc' | 'label-desc'
smallSegmentGrouping?: {
enabled?: boolean
value?: number
valueType?: 'percentage' | 'value'
label?: string
color?: string
}
content: {
label: string
value: number
color?: string
}[]
}
labels?: {
outer?: { pieDistance?: number } & ID3PieLabelsOptions
inner?: ID3PieLabelsOptions
mainLabel?: ID3PieStyleOptions
percentage?: { decimalPlaces?: number } & ID3PieStyleOptions
value?: ID3PieStyleOptions
lines?: {
enabled?: boolean
style?: 'curved' | 'straight'
color?: string
}
truncation?: {
enabled?: boolean
truncateLength?: number
}
formatter?: (context: {
section: 'outer' | 'inner'
value: number
label: string
}) => string
}
effects?: {
load?: {
effect?: 'none' | 'default'
speed?: number
}
pullOutSegmentOnClick?: {
effect?: 'none' | 'linear' | 'bounce' | 'elastic' | 'back'
speed?: number
size?: number
}
highlightSegmentOnMouseover?: boolean
highlightLuminosity?: number
}
tooltips?: {
enabled?: boolean
type?: 'placeholder' | 'caption'
string?: string
placeholderParser?: (index: number, data: { label?: string, percentage?: number, value?: number }) => void
styles?: {
fadeInSpeed?: number
backgroundColor?: string
backgroundOpacity?: number
color?: string
borderRadius?: number
font?: string
fontSize?: number
padding?: number
}
}
misc?: {
colors?: {
background?: string
segments?: string[]
segmentStroke?: string
}
gradient?: {
enabled?: boolean
percentage?: number
color?: string
}
canvasPadding?: {
top?: number
right?: number
bottom?: number
left?: number
}
pieCenterOffset?: {
x?: number
y?: number
}
cssPrefix?: string
}
callbacks?: {
onload?: Function
onMouseoverSegment?: Function
onMouseoutSegment?: Function
onClickSegment?: Function
}
}
interface ID3PieClass {
new (id: string | HTMLElement, options: ID3PieOptions): ID3PieChart
}
}
declare const d3pie: d3pie.ID3PieClass