@apia/charts 2.0.11 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +336 -4
- package/dist/index.js +1552 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -6
- package/dist/charts/chartJsRenderer/ChartComponent.d.ts +0 -22
- package/dist/charts/chartJsRenderer/ChartComponent.d.ts.map +0 -1
- package/dist/charts/chartJsRenderer/ChartComponent.js +0 -274
- package/dist/charts/chartJsRenderer/ChartComponent.js.map +0 -1
- package/dist/charts/types.d.ts +0 -173
- package/dist/charts/types.d.ts.map +0 -1
- package/dist/widgets/WidgetComponent.d.ts +0 -10
- package/dist/widgets/WidgetComponent.d.ts.map +0 -1
- package/dist/widgets/WidgetComponent.js +0 -54
- package/dist/widgets/WidgetComponent.js.map +0 -1
- package/dist/widgets/counter/Counter.js +0 -117
- package/dist/widgets/counter/Counter.js.map +0 -1
- package/dist/widgets/custom/useCustomWidget.js +0 -64
- package/dist/widgets/custom/useCustomWidget.js.map +0 -1
- package/dist/widgets/custom/util.js +0 -9
- package/dist/widgets/custom/util.js.map +0 -1
- package/dist/widgets/oxford/Oxford.js +0 -248
- package/dist/widgets/oxford/Oxford.js.map +0 -1
- package/dist/widgets/ring/Ring.js +0 -133
- package/dist/widgets/ring/Ring.js.map +0 -1
- package/dist/widgets/scale/Scale.js +0 -150
- package/dist/widgets/scale/Scale.js.map +0 -1
- package/dist/widgets/speedMeter/SpeedMeter.js +0 -194
- package/dist/widgets/speedMeter/SpeedMeter.js.map +0 -1
- package/dist/widgets/tLight/TLight.js +0 -143
- package/dist/widgets/tLight/TLight.js.map +0 -1
- package/dist/widgets/thermometer/Thermometer.js +0 -151
- package/dist/widgets/thermometer/Thermometer.js.map +0 -1
- package/dist/widgets/thermometer/util.js +0 -38
- package/dist/widgets/thermometer/util.js.map +0 -1
- package/dist/widgets/types.d.ts +0 -108
- package/dist/widgets/types.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,337 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ChartData } from 'chart.js';
|
|
3
|
+
import { PivotTableUIProps } from '@imc-trading/react-pivottable';
|
|
4
|
+
export { PivotTableUIProps, TQuerySort } from '@imc-trading/react-pivottable';
|
|
5
|
+
|
|
6
|
+
type TApiaChartCoordinate = {
|
|
7
|
+
/**
|
|
8
|
+
* Value shown in the X axis.
|
|
9
|
+
* In the case of pie charts, it defines the name of each slice.
|
|
10
|
+
*/
|
|
11
|
+
key: string;
|
|
12
|
+
/**
|
|
13
|
+
* Value shown in the Y axis, or to determine the size and value of slices of
|
|
14
|
+
* a pie chart.
|
|
15
|
+
*/
|
|
16
|
+
value: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional value shown only on the slices of pie charts
|
|
19
|
+
*/
|
|
20
|
+
percentage?: string;
|
|
21
|
+
color?: string;
|
|
22
|
+
};
|
|
23
|
+
type TApiaChartColumn = {
|
|
24
|
+
/**
|
|
25
|
+
* Specific color of a column, does not work on pie charts
|
|
26
|
+
*/
|
|
27
|
+
color: string;
|
|
28
|
+
/**
|
|
29
|
+
* Values of each element
|
|
30
|
+
*/
|
|
31
|
+
sets: TApiaChartCoordinate | TApiaChartCoordinate[];
|
|
32
|
+
/**
|
|
33
|
+
* Name of each column.
|
|
34
|
+
*
|
|
35
|
+
* On bars and line based charts, the legend will show this value.
|
|
36
|
+
*
|
|
37
|
+
* On the pie and waterfall charts, a chart will be created for each column.
|
|
38
|
+
*/
|
|
39
|
+
name: string;
|
|
40
|
+
};
|
|
41
|
+
type TApiaChartDefinition = {
|
|
42
|
+
chartType?: 'barH2D' | 'barV2D' | 'linear' | 'waterfall' | 'pie2D';
|
|
43
|
+
aspectRatio?: number;
|
|
44
|
+
axisXTitle?: string;
|
|
45
|
+
axisYTitle?: string;
|
|
46
|
+
hideSelector?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The colors of the waterfall chart are defined by the bars with positive
|
|
49
|
+
* values and the bars with negative values. So in order to mantain cohesion
|
|
50
|
+
* in the color schema of the chart, this prop establishes the required colors
|
|
51
|
+
* for the chart
|
|
52
|
+
*/
|
|
53
|
+
waterfallColors?: {
|
|
54
|
+
positive: string;
|
|
55
|
+
negative: string;
|
|
56
|
+
total: string;
|
|
57
|
+
stepConnector: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Name of the schema of colors shown in the chart. Pie charts must always include a schema
|
|
61
|
+
*/
|
|
62
|
+
colorSchema?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Main data to be parsed and shown in the chart.
|
|
65
|
+
* Depending on the ```chartType``` and the amount of ```column``` objects,
|
|
66
|
+
* the data can be considered differently.
|
|
67
|
+
*
|
|
68
|
+
* Examples:
|
|
69
|
+
* ```
|
|
70
|
+
* const columnsWithSingleColumnObject = columns: {
|
|
71
|
+
* column: {
|
|
72
|
+
* color: 'red',
|
|
73
|
+
* coordinate: [
|
|
74
|
+
* { xValue: '1', yValue: '1' },
|
|
75
|
+
* ...,
|
|
76
|
+
* ],
|
|
77
|
+
* name: 'col1',
|
|
78
|
+
* }
|
|
79
|
+
* };
|
|
80
|
+
* ```
|
|
81
|
+
* ```
|
|
82
|
+
* const columnsWithMultipleColumnObject = columns: {
|
|
83
|
+
* column: [
|
|
84
|
+
* {
|
|
85
|
+
* color: 'red',
|
|
86
|
+
* coordinate: [
|
|
87
|
+
* { xValue: '1', yValue: '1' },
|
|
88
|
+
* ...,
|
|
89
|
+
* ],
|
|
90
|
+
* name: 'col1',
|
|
91
|
+
* },
|
|
92
|
+
* ...,
|
|
93
|
+
* ]
|
|
94
|
+
* };
|
|
95
|
+
*```
|
|
96
|
+
*
|
|
97
|
+
*
|
|
98
|
+
* ***Horizontal and Vertical bars***:
|
|
99
|
+
*
|
|
100
|
+
* ```1 column object```:
|
|
101
|
+
*
|
|
102
|
+
* Each ```coordinate``` is considered an individual separate 'column bar',
|
|
103
|
+
* and the ```colorSchema``` is separated between each ```coordinate``` made
|
|
104
|
+
* 'column bar'.
|
|
105
|
+
*
|
|
106
|
+
*
|
|
107
|
+
* ```Multiple column objects```:
|
|
108
|
+
*
|
|
109
|
+
* Each ```column``` object should have the same amount of coordinates and
|
|
110
|
+
* the coordinates in the same index of the array should have the same
|
|
111
|
+
* ```xValue```
|
|
112
|
+
*
|
|
113
|
+
* Each ```coordinate``` is considered an individual separate 'column bar',
|
|
114
|
+
* but the coordinates of each column are re-accommodated based on their
|
|
115
|
+
* ```xValue``` in order to make groups of columns with the same value on the
|
|
116
|
+
* X axis.
|
|
117
|
+
*
|
|
118
|
+
* In this case there will be 6 groups of columns (based on the length of the
|
|
119
|
+
* coordinate array), each group containing 3 'column bars' (based on the
|
|
120
|
+
* amount of column objects) and the ```colorSchema``` will be distributed
|
|
121
|
+
* inside each group, meaning each column having one single color.
|
|
122
|
+
*
|
|
123
|
+
*
|
|
124
|
+
* ***Linear***:
|
|
125
|
+
*
|
|
126
|
+
* ```N column objects```:
|
|
127
|
+
|
|
128
|
+
*
|
|
129
|
+
* Each ```column``` object is considered a line path, the coordinates being
|
|
130
|
+
* the nodes of said line.
|
|
131
|
+
*
|
|
132
|
+
* ***Pie charts***:
|
|
133
|
+
*
|
|
134
|
+
* ```N column objects```:
|
|
135
|
+
*
|
|
136
|
+
* Each ```column``` object is considered a unique Pie chart, the coordinates
|
|
137
|
+
* being the slices of said pie.
|
|
138
|
+
*
|
|
139
|
+
* ***Waterfall***:
|
|
140
|
+
*
|
|
141
|
+
* ```N column objects```:
|
|
142
|
+
*
|
|
143
|
+
* Each ```column``` object is considered a unique Waterfall chart, the coordinates
|
|
144
|
+
* being bars with the ```yValue``` determining if it goes up or down. Only this
|
|
145
|
+
* type of chart admits negative values on its coordinates.
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
dataSets: {
|
|
149
|
+
data: TApiaChartColumn | TApiaChartColumn[];
|
|
150
|
+
};
|
|
151
|
+
margin?: {
|
|
152
|
+
top: number;
|
|
153
|
+
left: number;
|
|
154
|
+
bottom: number;
|
|
155
|
+
right: number;
|
|
156
|
+
} | number;
|
|
157
|
+
pnl_id?: string;
|
|
158
|
+
showAxisXTitle?: boolean;
|
|
159
|
+
showAxisYTitle?: boolean;
|
|
160
|
+
showGrid?: boolean;
|
|
161
|
+
showLegend?: boolean;
|
|
162
|
+
showValues?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Specific for waterfall charts to show the total sum of the values of the
|
|
165
|
+
* chart at the end while each column shows its value. Otherwise the values
|
|
166
|
+
* shown on each bar will represent the current sum of values
|
|
167
|
+
*/
|
|
168
|
+
showTotal?: boolean;
|
|
169
|
+
title: string;
|
|
170
|
+
ratio: {
|
|
171
|
+
height: number;
|
|
172
|
+
width: number;
|
|
173
|
+
maxWidth: number;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
type TWidgetZone = {
|
|
178
|
+
minimum: number;
|
|
179
|
+
maximum: number;
|
|
180
|
+
transparency: number;
|
|
181
|
+
color: string;
|
|
182
|
+
};
|
|
183
|
+
type TWidgetData = {
|
|
184
|
+
border: boolean;
|
|
185
|
+
backgroundColor: string;
|
|
186
|
+
currentValue: number;
|
|
187
|
+
forceProp?: Record<string, unknown>;
|
|
188
|
+
height: number;
|
|
189
|
+
maxValue: number;
|
|
190
|
+
minValue: number;
|
|
191
|
+
noValueColor: string;
|
|
192
|
+
pointerColor: string;
|
|
193
|
+
ringAnchor: number;
|
|
194
|
+
scaleFontSize: string | number;
|
|
195
|
+
valueColor: string;
|
|
196
|
+
valueDecimals: number;
|
|
197
|
+
valueFontSize: string | number;
|
|
198
|
+
valueType: string | number;
|
|
199
|
+
viewBtnDshAssociated: boolean;
|
|
200
|
+
viewBtnHistory: boolean;
|
|
201
|
+
viewBtnInfo: boolean;
|
|
202
|
+
viewBtnComments: boolean;
|
|
203
|
+
viewBtnUpdate: boolean;
|
|
204
|
+
viewBtnOpenCbe: boolean;
|
|
205
|
+
viewBtnOpenQry: boolean;
|
|
206
|
+
viewBtnOpenOtherQry: boolean;
|
|
207
|
+
viewBtnOpenOtherQbe: boolean;
|
|
208
|
+
viewWidName: boolean;
|
|
209
|
+
widKpiType: string | number;
|
|
210
|
+
width: number;
|
|
211
|
+
zones: {
|
|
212
|
+
Zone: TWidgetZone | TWidgetZone[];
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
type TApiaWidgetProps = {
|
|
216
|
+
colorRanges: string[];
|
|
217
|
+
currentValue: number;
|
|
218
|
+
height: number;
|
|
219
|
+
valueRanges: number[];
|
|
220
|
+
width: number;
|
|
221
|
+
decimals?: number;
|
|
222
|
+
addBorder?: boolean;
|
|
223
|
+
addInnerWhiteBorder?: boolean;
|
|
224
|
+
backgroundColor?: string;
|
|
225
|
+
currentValueColor?: string;
|
|
226
|
+
currentValueFontSize?: string | number;
|
|
227
|
+
forceProp?: Record<string, unknown>;
|
|
228
|
+
minValue?: number;
|
|
229
|
+
maxValue?: number;
|
|
230
|
+
pointerColor?: string;
|
|
231
|
+
scaleValuesSize?: string | number;
|
|
232
|
+
ringWidth?: number;
|
|
233
|
+
ringEmptyColor?: string;
|
|
234
|
+
};
|
|
235
|
+
type TApiaWidgetBaseProps<T> = {
|
|
236
|
+
currentValue: number;
|
|
237
|
+
currentValueFontSize?: string | number;
|
|
238
|
+
height: number;
|
|
239
|
+
maxValue?: number;
|
|
240
|
+
minValue?: number;
|
|
241
|
+
valueDecimals: number;
|
|
242
|
+
valueType: string | number;
|
|
243
|
+
valueRanges: number[];
|
|
244
|
+
width: number;
|
|
245
|
+
} & T;
|
|
246
|
+
type TApiaWidgetThermometerProps = {
|
|
247
|
+
colorRanges: string[];
|
|
248
|
+
};
|
|
249
|
+
type TApiaWidgetTLightProps = {
|
|
250
|
+
addBorder: boolean;
|
|
251
|
+
colorRanges: string[];
|
|
252
|
+
currentValueColor?: string;
|
|
253
|
+
};
|
|
254
|
+
type TApiaWidgetSpeedMeterProps = {
|
|
255
|
+
backgroundColor: string;
|
|
256
|
+
colorRanges: string[];
|
|
257
|
+
currentValueColor: string;
|
|
258
|
+
pointerColor: string;
|
|
259
|
+
scaleValuesSize: string | number;
|
|
260
|
+
};
|
|
261
|
+
type TApiaWidgetScaleProps = {
|
|
262
|
+
pointerColor: string;
|
|
263
|
+
scaleValuesSize: string | number;
|
|
264
|
+
};
|
|
265
|
+
type TApiaWidgetRingProps = {
|
|
266
|
+
colorRanges: string[];
|
|
267
|
+
currentValueColor: string;
|
|
268
|
+
ringEmptyColor: string;
|
|
269
|
+
ringWidth: number;
|
|
270
|
+
};
|
|
271
|
+
type TApiaWidgetOxfordProps = {
|
|
272
|
+
backgroundColor: string;
|
|
273
|
+
colorRanges: string[];
|
|
274
|
+
currentValueColor: string;
|
|
275
|
+
pointerColor: string;
|
|
276
|
+
scaleValuesSize: string | number;
|
|
277
|
+
};
|
|
278
|
+
type TApiaWidgetCounterProps = {
|
|
279
|
+
addBorder: boolean;
|
|
280
|
+
colorRanges: string[];
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
declare const WidgetComponent: ({ data, type, }: {
|
|
284
|
+
data: TApiaWidgetBaseProps<any>;
|
|
285
|
+
type: 'SpeedMeter' | 'Oxford' | 'Counter' | 'TLight' | 'Thermometer' | 'Scale' | 'Ring';
|
|
286
|
+
}) => react.JSX.Element;
|
|
287
|
+
|
|
288
|
+
type TChartData = {
|
|
289
|
+
chartData: ChartData;
|
|
290
|
+
showLegend?: boolean;
|
|
291
|
+
showValues?: boolean;
|
|
292
|
+
showXAxisValues?: boolean;
|
|
293
|
+
showYAxisValues?: boolean;
|
|
294
|
+
showTable?: boolean;
|
|
295
|
+
type: 'bar' | 'line' | 'scatter' | 'bubble' | 'pie' | 'doughnut' | 'polarArea' | 'radar' | 'waterfall';
|
|
296
|
+
indexAxis?: 'x' | 'y';
|
|
297
|
+
xAxisTitle?: string;
|
|
298
|
+
yAxisTitle?: string;
|
|
299
|
+
id?: string;
|
|
300
|
+
chartId?: string;
|
|
301
|
+
aspectRatio?: number;
|
|
302
|
+
};
|
|
303
|
+
declare const ChartComponent: (props: TChartData) => react.JSX.Element;
|
|
304
|
+
|
|
305
|
+
declare const PivotTableComponent: react.MemoExoticComponent<(props: Omit<PivotTableUIProps, 'onChange'>) => react.JSX.Element>;
|
|
306
|
+
|
|
307
|
+
type ColumnSort = 'label_asc' | 'value_asc' | 'value_desc';
|
|
308
|
+
type RowSort = 'label_asc' | 'value_asc' | 'value_desc';
|
|
309
|
+
type Renderer = 'Table' | 'Table Heatmap' | 'Table Col Heatmap' | 'Table Row Heatmap' | 'Exportable TSV' | 'Grouped Column Chart' | 'Stacked Column Chart' | 'Grouped Bar Chart' | 'Stacked Bar Chart' | 'Line Chart' | 'Dot Chart' | 'Area Chart' | 'Scatter Chart' | 'Multiple Pie Chart';
|
|
310
|
+
type Aggregator = 'Count' | 'Count Unique Values' | 'List Unique Values' | 'Sum' | 'Integer Sum' | 'Average' | 'Median' | 'Sample Variance' | 'Sample Standard Deviation' | 'Minimum' | 'Maximum' | 'First' | 'Last' | 'Sum over Sum' | 'Sum as Fraction of Total' | 'Sum as Fraction of Rows' | 'Sum as Fraction of Columns' | 'Count as Fraction of Total' | 'Count as Fraction of Rows' | 'Count as Fraction of Columns';
|
|
311
|
+
type ShowAs = 'row' | 'column' | 'none';
|
|
312
|
+
interface Column {
|
|
313
|
+
title: string;
|
|
314
|
+
showAs: ShowAs;
|
|
315
|
+
}
|
|
316
|
+
interface Row {
|
|
317
|
+
cell: string[];
|
|
318
|
+
}
|
|
319
|
+
interface Pivot {
|
|
320
|
+
title: string;
|
|
321
|
+
description: string;
|
|
322
|
+
mainPivot: boolean;
|
|
323
|
+
columnSort: ColumnSort;
|
|
324
|
+
rowSort: RowSort;
|
|
325
|
+
renderer: Renderer;
|
|
326
|
+
aggregator: Aggregator;
|
|
327
|
+
columns: Column[];
|
|
328
|
+
rows: Row[];
|
|
329
|
+
}
|
|
330
|
+
interface TPivotTableData {
|
|
331
|
+
load: {
|
|
332
|
+
pivots: Pivot[];
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export { ChartComponent, type ColumnSort, PivotTableComponent, type TApiaChartColumn, type TApiaChartDefinition, type TApiaWidgetBaseProps, type TApiaWidgetCounterProps, type TApiaWidgetOxfordProps, type TApiaWidgetProps, type TApiaWidgetRingProps, type TApiaWidgetScaleProps, type TApiaWidgetSpeedMeterProps, type TApiaWidgetTLightProps, type TApiaWidgetThermometerProps, type TPivotTableData, type TWidgetData, type TWidgetZone, WidgetComponent };
|
|
5
337
|
//# sourceMappingURL=index.d.ts.map
|