@apia/charts 1.0.2 → 2.0.0

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.
Files changed (81) hide show
  1. package/dist/charts/ChartContext.js +6 -0
  2. package/dist/charts/ChartContext.js.map +1 -0
  3. package/dist/charts/ChartRenderer.d.ts +17 -0
  4. package/dist/charts/ChartRenderer.d.ts.map +1 -0
  5. package/dist/charts/ChartRenderer.js +175 -0
  6. package/dist/charts/ChartRenderer.js.map +1 -0
  7. package/dist/charts/horizontalBars/Bar.js +226 -0
  8. package/dist/charts/horizontalBars/Bar.js.map +1 -0
  9. package/dist/charts/horizontalBars/HorizontalBars.js +374 -0
  10. package/dist/charts/horizontalBars/HorizontalBars.js.map +1 -0
  11. package/dist/charts/linear/LineChart.js +528 -0
  12. package/dist/charts/linear/LineChart.js.map +1 -0
  13. package/dist/charts/linear/Node.js +56 -0
  14. package/dist/charts/linear/Node.js.map +1 -0
  15. package/dist/charts/pie/Pie.js +184 -0
  16. package/dist/charts/pie/Pie.js.map +1 -0
  17. package/dist/charts/pie/Slice.js +96 -0
  18. package/dist/charts/pie/Slice.js.map +1 -0
  19. package/dist/charts/pie/usePieAnimation.js +123 -0
  20. package/dist/charts/pie/usePieAnimation.js.map +1 -0
  21. package/dist/charts/types.d.ts +188 -0
  22. package/dist/charts/types.d.ts.map +1 -0
  23. package/dist/charts/util/ChartSelector.js +36 -0
  24. package/dist/charts/util/ChartSelector.js.map +1 -0
  25. package/dist/charts/util/ColoredLegendItem.js +46 -0
  26. package/dist/charts/util/ColoredLegendItem.js.map +1 -0
  27. package/dist/charts/util/EmptyGrid.d.ts +8 -0
  28. package/dist/charts/util/EmptyGrid.d.ts.map +1 -0
  29. package/dist/charts/util/EmptyGrid.js +51 -0
  30. package/dist/charts/util/EmptyGrid.js.map +1 -0
  31. package/dist/charts/util/LegendContainer.js +53 -0
  32. package/dist/charts/util/LegendContainer.js.map +1 -0
  33. package/dist/charts/util/NumberedLegendItem.js +45 -0
  34. package/dist/charts/util/NumberedLegendItem.js.map +1 -0
  35. package/dist/charts/util/getBarColor.js +29 -0
  36. package/dist/charts/util/getBarColor.js.map +1 -0
  37. package/dist/charts/util/parseMargin.js +11 -0
  38. package/dist/charts/util/parseMargin.js.map +1 -0
  39. package/dist/charts/util/useChartStyles.js +35 -0
  40. package/dist/charts/util/useChartStyles.js.map +1 -0
  41. package/dist/charts/verticalBars/Bar.js +239 -0
  42. package/dist/charts/verticalBars/Bar.js.map +1 -0
  43. package/dist/charts/verticalBars/VerticalBars.js +394 -0
  44. package/dist/charts/verticalBars/VerticalBars.js.map +1 -0
  45. package/dist/charts/waterfallBars/WaterfallBar.js +84 -0
  46. package/dist/charts/waterfallBars/WaterfallBar.js.map +1 -0
  47. package/dist/charts/waterfallBars/WaterfallBars.js +289 -0
  48. package/dist/charts/waterfallBars/WaterfallBars.js.map +1 -0
  49. package/dist/index.d.ts +6 -250
  50. package/dist/index.js +4 -4263
  51. package/dist/index.js.map +1 -1
  52. package/dist/widgets/WidgetContainer.d.ts +10 -0
  53. package/dist/widgets/WidgetContainer.d.ts.map +1 -0
  54. package/dist/widgets/WidgetContainer.js +68 -0
  55. package/dist/widgets/WidgetContainer.js.map +1 -0
  56. package/dist/widgets/counter/Counter.js +108 -0
  57. package/dist/widgets/counter/Counter.js.map +1 -0
  58. package/dist/widgets/custom/useCustomWidget.js +64 -0
  59. package/dist/widgets/custom/useCustomWidget.js.map +1 -0
  60. package/dist/widgets/custom/util.js +9 -0
  61. package/dist/widgets/custom/util.js.map +1 -0
  62. package/dist/widgets/oxford/Oxford.js +241 -0
  63. package/dist/widgets/oxford/Oxford.js.map +1 -0
  64. package/dist/widgets/ring/Ring.js +123 -0
  65. package/dist/widgets/ring/Ring.js.map +1 -0
  66. package/dist/widgets/scale/Scale.js +145 -0
  67. package/dist/widgets/scale/Scale.js.map +1 -0
  68. package/dist/widgets/speedMeter/SpeedMeter.js +187 -0
  69. package/dist/widgets/speedMeter/SpeedMeter.js.map +1 -0
  70. package/dist/widgets/tLight/TLight.js +134 -0
  71. package/dist/widgets/tLight/TLight.js.map +1 -0
  72. package/dist/widgets/thermometer/Thermometer.js +144 -0
  73. package/dist/widgets/thermometer/Thermometer.js.map +1 -0
  74. package/dist/widgets/thermometer/util.js +31 -0
  75. package/dist/widgets/thermometer/util.js.map +1 -0
  76. package/dist/widgets/types.d.ts +41 -0
  77. package/dist/widgets/types.d.ts.map +1 -0
  78. package/package.json +30 -43
  79. package/LICENSE.md +0 -21
  80. package/README.md +0 -1
  81. package/cleanDist.json +0 -3
package/dist/index.d.ts CHANGED
@@ -1,250 +1,6 @@
1
- import * as _apia_util from '@apia/util';
2
- import * as React$1 from 'react';
3
- import React__default from 'react';
4
-
5
- type TApiaChartCoordinate = {
6
- /**
7
- * Value shown in the X axis.
8
- * In the case of pie charts, it defines the name of each slice.
9
- */
10
- key: string;
11
- /**
12
- * Value shown in the Y axis, or to determine the size and value of slices of
13
- * a pie chart.
14
- */
15
- value: string;
16
- /**
17
- * Optional value shown only on the slices of pie charts
18
- */
19
- percentage?: string;
20
- color?: string;
21
- };
22
- type TApiaChartColumn = {
23
- /**
24
- * Specific color of a column, does not work on pie charts
25
- */
26
- color: string;
27
- /**
28
- * Values of each element
29
- */
30
- sets: TApiaChartCoordinate | TApiaChartCoordinate[];
31
- /**
32
- * Name of each column.
33
- *
34
- * On bars and line based charts, the legend will show this value.
35
- *
36
- * On the pie and waterfall charts, a chart will be created for each column.
37
- */
38
- name: string;
39
- };
40
- type TApiaChartDefinition = {
41
- chartType?: 'barH2D' | 'barV2D' | 'linear' | 'waterfall' | 'pie2D';
42
- axisXTitle?: string;
43
- axisYTitle?: string;
44
- hideSelector?: boolean;
45
- /**
46
- * The colors of the waterfall chart are defined by the bars with positive
47
- * values and the bars with negative values. So in order to mantain cohesion
48
- * in the color schema of the chart, this prop establishes the required colors
49
- * for the chart
50
- */
51
- waterfallColors?: {
52
- positive: string;
53
- negative: string;
54
- total: string;
55
- stepConnector: string;
56
- };
57
- /**
58
- * Name of the schema of colors shown in the chart. Pie charts must always include a schema
59
- */
60
- colorSchema?: string;
61
- /**
62
- * Main data to be parsed and shown in the chart.
63
- * Depending on the ```chartType``` and the amount of ```column``` objects,
64
- * the data can be considered differently.
65
- *
66
- * Examples:
67
- * ```
68
- * const columnsWithSingleColumnObject = columns: {
69
- * column: {
70
- * color: 'red',
71
- * coordinate: [
72
- * { xValue: '1', yValue: '1' },
73
- * ...,
74
- * ],
75
- * name: 'col1',
76
- * }
77
- * };
78
- * ```
79
- * ```
80
- * const columnsWithMultipleColumnObject = columns: {
81
- * column: [
82
- * {
83
- * color: 'red',
84
- * coordinate: [
85
- * { xValue: '1', yValue: '1' },
86
- * ...,
87
- * ],
88
- * name: 'col1',
89
- * },
90
- * ...,
91
- * ]
92
- * };
93
- *```
94
- *
95
- *
96
- * ***Horizontal and Vertical bars***:
97
- *
98
- * ```1 column object```:
99
- *
100
- * Each ```coordinate``` is considered an individual separate 'column bar',
101
- * and the ```colorSchema``` is separated between each ```coordinate``` made
102
- * 'column bar'.
103
- *
104
- *
105
- * ```Multiple column objects```:
106
- *
107
- * Each ```column``` object should have the same amount of coordinates and
108
- * the coordinates in the same index of the array should have the same
109
- * ```xValue```
110
- *
111
- * Each ```coordinate``` is considered an individual separate 'column bar',
112
- * but the coordinates of each column are re-accommodated based on their
113
- * ```xValue``` in order to make groups of columns with the same value on the
114
- * X axis.
115
- *
116
- * In this case there will be 6 groups of columns (based on the length of the
117
- * coordinate array), each group containing 3 'column bars' (based on the
118
- * amount of column objects) and the ```colorSchema``` will be distributed
119
- * inside each group, meaning each column having one single color.
120
- *
121
- *
122
- * ***Linear***:
123
- *
124
- * ```N column objects```:
125
-
126
- *
127
- * Each ```column``` object is considered a line path, the coordinates being
128
- * the nodes of said line.
129
- *
130
- * ***Pie charts***:
131
- *
132
- * ```N column objects```:
133
- *
134
- * Each ```column``` object is considered a unique Pie chart, the coordinates
135
- * being the slices of said pie.
136
- *
137
- * ***Waterfall***:
138
- *
139
- * ```N column objects```:
140
- *
141
- * Each ```column``` object is considered a unique Waterfall chart, the coordinates
142
- * being bars with the ```yValue``` determining if it goes up or down. Only this
143
- * type of chart admits negative values on its coordinates.
144
- *
145
- */
146
- dataSets: {
147
- data: TApiaChartColumn | TApiaChartColumn[];
148
- };
149
- margin?: {
150
- top: number;
151
- left: number;
152
- bottom: number;
153
- right: number;
154
- } | number;
155
- pnl_id?: string;
156
- showAxisXTitle?: boolean;
157
- showAxisYTitle?: boolean;
158
- showGrid?: boolean;
159
- showLegend?: boolean;
160
- showValues?: boolean;
161
- /**
162
- * Specific for waterfall charts to show the total sum of the values of the
163
- * chart at the end while each column shows its value. Otherwise the values
164
- * shown on each bar will represent the current sum of values
165
- */
166
- showTotal?: boolean;
167
- title: string;
168
- ratio: {
169
- height: number;
170
- width: number;
171
- maxWidth: number;
172
- };
173
- };
174
- type TChartMargin = {
175
- top: number;
176
- bottom: number;
177
- left: number;
178
- right: number;
179
- };
180
- type TChartRendererProps = {
181
- chart: TApiaChartDefinition;
182
- margin?: number | TChartMargin;
183
- disableEvents?: boolean;
184
- className?: string;
185
- chartId: string;
186
- parentRef?: React.MutableRefObject<HTMLElement>;
187
- outerClassName?: string;
188
- allowZoom?: boolean;
189
- };
190
-
191
- declare const ChartRenderer: React__default.FC<{
192
- currentChart: TApiaChartDefinition;
193
- chartConfig?: Partial<Omit<TApiaChartDefinition, "columns">> | undefined;
194
- chartProps?: Partial<TChartRendererProps> | undefined;
195
- allowScaleChange?: boolean | undefined;
196
- chartId: string;
197
- allowZoom?: boolean | undefined;
198
- } & React__default.RefAttributes<HTMLElement> & {
199
- id: _apia_util.TId;
200
- }>;
201
-
202
- declare const EmptyGrid: ({ width }: {
203
- width?: number | undefined;
204
- }) => React$1.JSX.Element;
205
-
206
- type TWidgetZone = {
207
- minimum: number;
208
- maximum: number;
209
- transparency: number;
210
- color: string;
211
- };
212
- type TWidgetData = {
213
- border: boolean;
214
- backgroundColor: string;
215
- currentValue: number;
216
- forceProp?: Record<string, unknown>;
217
- height: number;
218
- maxValue: number;
219
- minValue: number;
220
- noValueColor: string;
221
- pointerColor: string;
222
- ringAnchor: number;
223
- scaleFontSize: string | number;
224
- valueColor: string;
225
- valueDecimals: number;
226
- valueFontSize: string | number;
227
- valueType: string | number;
228
- viewBtnDshAssociated: boolean;
229
- viewBtnHistory: boolean;
230
- viewBtnInfo: boolean;
231
- viewBtnComments: boolean;
232
- viewBtnUpdate: boolean;
233
- viewBtnOpenCbe: boolean;
234
- viewBtnOpenQry: boolean;
235
- viewBtnOpenOtherQry: boolean;
236
- viewBtnOpenOtherQbe: boolean;
237
- viewWidName: boolean;
238
- widKpiType: string | number;
239
- width: number;
240
- zones: {
241
- Zone: TWidgetZone | TWidgetZone[];
242
- };
243
- };
244
-
245
- declare const WidgetContainer: ({ data, id, }: {
246
- data: TWidgetData;
247
- id: string;
248
- }) => React$1.JSX.Element;
249
-
250
- export { ChartRenderer, EmptyGrid, TApiaChartColumn, TApiaChartDefinition, TWidgetData, WidgetContainer };
1
+ export { ChartRenderer } from './charts/ChartRenderer.js';
2
+ export { TApiaChartColumn, TApiaChartDefinition } from './charts/types.js';
3
+ export { EmptyGrid } from './charts/util/EmptyGrid.js';
4
+ export { TWidgetData } from './widgets/types.js';
5
+ export { WidgetContainer } from './widgets/WidgetContainer.js';
6
+ //# sourceMappingURL=index.d.ts.map