@j2inn/fin5-ui-utils 5.2.2-beta.0 → 5.2.2-beta.10
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 +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/react/components/charts/QRCode.d.ts +2 -2
- package/dist/react/components/charts/QRCode.js +2 -1
- package/dist/react/components/charts/QRCode.js.map +1 -1
- package/dist/react/components/charts/line-bar/Chart.d.ts +166 -0
- package/dist/react/components/charts/line-bar/Chart.js +443 -0
- package/dist/react/components/charts/line-bar/Chart.js.map +1 -0
- package/dist/react/components/charts/line-bar/HGridChart.d.ts +58 -0
- package/dist/react/components/charts/line-bar/HGridChart.js +289 -0
- package/dist/react/components/charts/line-bar/HGridChart.js.map +1 -0
- package/dist/react/components/charts/line-bar/ZincGridChart.d.ts +12 -0
- package/dist/react/components/charts/line-bar/ZincGridChart.js +24 -0
- package/dist/react/components/charts/line-bar/ZincGridChart.js.map +1 -0
- package/dist/react/components/makeCustomElement.d.ts +6 -2
- package/dist/react/components/makeCustomElement.js +22 -14
- package/dist/react/components/makeCustomElement.js.map +1 -1
- package/dist/react/hooks/useScreenSize.d.ts +8 -0
- package/dist/react/hooks/useScreenSize.js +31 -0
- package/dist/react/hooks/useScreenSize.js.map +1 -0
- package/dist_es/index.d.ts +4 -0
- package/dist_es/index.js +4 -0
- package/dist_es/index.js.map +1 -1
- package/dist_es/react/components/charts/QRCode.d.ts +2 -2
- package/dist_es/react/components/charts/QRCode.js +1 -2
- package/dist_es/react/components/charts/QRCode.js.map +1 -1
- package/dist_es/react/components/charts/line-bar/Chart.d.ts +166 -0
- package/dist_es/react/components/charts/line-bar/Chart.js +416 -0
- package/dist_es/react/components/charts/line-bar/Chart.js.map +1 -0
- package/dist_es/react/components/charts/line-bar/HGridChart.d.ts +58 -0
- package/dist_es/react/components/charts/line-bar/HGridChart.js +251 -0
- package/dist_es/react/components/charts/line-bar/HGridChart.js.map +1 -0
- package/dist_es/react/components/charts/line-bar/ZincGridChart.d.ts +12 -0
- package/dist_es/react/components/charts/line-bar/ZincGridChart.js +17 -0
- package/dist_es/react/components/charts/line-bar/ZincGridChart.js.map +1 -0
- package/dist_es/react/components/makeCustomElement.d.ts +6 -2
- package/dist_es/react/components/makeCustomElement.js +22 -14
- package/dist_es/react/components/makeCustomElement.js.map +1 -1
- package/dist_es/react/hooks/useScreenSize.d.ts +8 -0
- package/dist_es/react/hooks/useScreenSize.js +29 -0
- package/dist_es/react/hooks/useScreenSize.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import * as am5 from '@amcharts/amcharts5';
|
|
2
|
+
import { ITimeInterval } from '@amcharts/amcharts5/.internal/core/util/Time';
|
|
3
|
+
import * as am5xy from '@amcharts/amcharts5/xy';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export declare type StackedColumnChartInterfaceColors = {
|
|
6
|
+
[Property in keyof am5.IInterfaceColorsSettings]: string;
|
|
7
|
+
};
|
|
8
|
+
export interface StackedColumnChartColorPalette {
|
|
9
|
+
interfaceColors?: Partial<StackedColumnChartInterfaceColors>;
|
|
10
|
+
series?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare enum UnitPlacement {
|
|
13
|
+
none = "none",
|
|
14
|
+
top = "top",
|
|
15
|
+
axis = "axis"
|
|
16
|
+
}
|
|
17
|
+
export declare enum AxisPlacement {
|
|
18
|
+
left = "left",
|
|
19
|
+
right = "right"
|
|
20
|
+
}
|
|
21
|
+
export declare enum LegendPlacement {
|
|
22
|
+
top = "top",
|
|
23
|
+
bottom = "bottom",
|
|
24
|
+
left = "left",
|
|
25
|
+
right = "right",
|
|
26
|
+
hidden = "hidden"
|
|
27
|
+
}
|
|
28
|
+
interface BaseChartSeriesProps {
|
|
29
|
+
seriesName: string;
|
|
30
|
+
dis?: string;
|
|
31
|
+
unit?: string;
|
|
32
|
+
axisPlacement?: AxisPlacement;
|
|
33
|
+
hideAxis?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface BarChartSeriesData extends BaseChartSeriesProps {
|
|
36
|
+
stroke?: am5.Color;
|
|
37
|
+
data: LineChartSeriesPoint[];
|
|
38
|
+
}
|
|
39
|
+
export interface LineChartSeriesPoint {
|
|
40
|
+
ts: number;
|
|
41
|
+
value: number | undefined | null;
|
|
42
|
+
}
|
|
43
|
+
export interface LineChartSeriesData extends BaseChartSeriesProps {
|
|
44
|
+
strokeSettings?: {
|
|
45
|
+
stroke?: am5.Color;
|
|
46
|
+
strokeDasharray?: number[];
|
|
47
|
+
strokeWidth?: number;
|
|
48
|
+
};
|
|
49
|
+
data: LineChartSeriesPoint[];
|
|
50
|
+
}
|
|
51
|
+
export interface ChartAxisRangeData {
|
|
52
|
+
startValue?: number;
|
|
53
|
+
endValue?: number;
|
|
54
|
+
foreground?: am5.Color;
|
|
55
|
+
color?: am5.Color;
|
|
56
|
+
opacity?: number;
|
|
57
|
+
text?: string;
|
|
58
|
+
html?: string;
|
|
59
|
+
tooltip?: string;
|
|
60
|
+
showText?: boolean;
|
|
61
|
+
placeBelow?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ChartProps {
|
|
64
|
+
/**
|
|
65
|
+
* Data used to populate the chart with columns
|
|
66
|
+
*/
|
|
67
|
+
barSeriesData?: BarChartSeriesData[];
|
|
68
|
+
/**
|
|
69
|
+
* Data used to populate the chart with stacked columns
|
|
70
|
+
*/
|
|
71
|
+
stackedBarSeriesData?: BarChartSeriesData[];
|
|
72
|
+
/**
|
|
73
|
+
* Data used to populate the chart with line series
|
|
74
|
+
*/
|
|
75
|
+
lineSeriesData?: LineChartSeriesData[];
|
|
76
|
+
rangesData?: ChartAxisRangeData[];
|
|
77
|
+
/**
|
|
78
|
+
* The name of the prop in the data that contains the timestamp
|
|
79
|
+
*/
|
|
80
|
+
dateField: string;
|
|
81
|
+
/**
|
|
82
|
+
* True to activate the cursor
|
|
83
|
+
*/
|
|
84
|
+
cursor?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* The time interval for the Date Axis @see https://www.amcharts.com/docs/v5/charts/xy-chart/axes/date-axis/#data-granularity
|
|
87
|
+
*/
|
|
88
|
+
baseInterval: ITimeInterval;
|
|
89
|
+
/**
|
|
90
|
+
* Color palette for the chart slices and interface colors @see https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/#Interface_colors
|
|
91
|
+
*/
|
|
92
|
+
colorPalette?: Partial<StackedColumnChartColorPalette>;
|
|
93
|
+
/**
|
|
94
|
+
* Number formatting options @see https://www.amcharts.com/docs/v5/tutorials/formatting-date-time-and-numbers-using-intl-object/#Formatting_numbers
|
|
95
|
+
*/
|
|
96
|
+
numberFormat?: Intl.NumberFormatOptions;
|
|
97
|
+
/**
|
|
98
|
+
* amcharts5 theme classes to be used by the chart @see https://www.amcharts.com/docs/v5/concepts/themes/
|
|
99
|
+
*/
|
|
100
|
+
chartThemes?: typeof am5.Theme[];
|
|
101
|
+
/**
|
|
102
|
+
* Settings for chart customization @see https://www.amcharts.com/docs/v5/reference/xychart/#Settings
|
|
103
|
+
*/
|
|
104
|
+
chartSettings?: am5xy.IXYChartSettings;
|
|
105
|
+
/**
|
|
106
|
+
* Settings for legend customization @see https://www.amcharts.com/docs/v5/reference/legend/#Settings
|
|
107
|
+
*/
|
|
108
|
+
legendSettings?: am5.ILegendSettings;
|
|
109
|
+
/**
|
|
110
|
+
* Settings for legend labels customization @see https://www.amcharts.com/docs/v5/concepts/legend/#labels
|
|
111
|
+
*/
|
|
112
|
+
legendLabelsSettings?: am5.ILabelSettings;
|
|
113
|
+
/**
|
|
114
|
+
* Settings for legend markers customization @see https://www.amcharts.com/docs/v5/concepts/legend/#labels
|
|
115
|
+
*/
|
|
116
|
+
legendMarkersSettings?: am5.ILabelSettings & {
|
|
117
|
+
rounded?: boolean;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Settings for date axis @see https://www.amcharts.com/docs/v5/reference/dateaxis/#Settings
|
|
121
|
+
*/
|
|
122
|
+
dateAxisSettings?: Omit<am5xy.IDateAxisSettings<am5xy.AxisRenderer>, 'baseInterval' | 'renderer'>;
|
|
123
|
+
/**
|
|
124
|
+
* Settings for date axis renderer @see https://www.amcharts.com/docs/v5/reference/iaxisrendererxsettings/
|
|
125
|
+
*/
|
|
126
|
+
dateAxisRendererSettings?: am5xy.IAxisRendererXSettings;
|
|
127
|
+
/**
|
|
128
|
+
* Settings for category axis @see https://www.amcharts.com/docs/v5/reference/valueaxis/#Settings
|
|
129
|
+
*/
|
|
130
|
+
valueAxisSettings?: Omit<am5xy.IValueAxisSettings<am5xy.AxisRenderer>, 'renderer'>;
|
|
131
|
+
/**
|
|
132
|
+
* Settings for chart series customization @see https://www.amcharts.com/docs/v5/reference/grid/#Settings
|
|
133
|
+
*/
|
|
134
|
+
gridSettings?: Partial<am5xy.IGridSettings>;
|
|
135
|
+
/**
|
|
136
|
+
* Settings for chart column series customization @see https://www.amcharts.com/docs/v5/reference/columnseries/#Settings
|
|
137
|
+
*/
|
|
138
|
+
barSeriesSettings?: am5xy.IColumnSeriesSettings;
|
|
139
|
+
/**
|
|
140
|
+
* Settings for chart line series customization @see https://www.amcharts.com/docs/v5/reference/lineseries/#Settings
|
|
141
|
+
*/
|
|
142
|
+
lineSeriesSettings?: Partial<am5xy.ILineSeriesSettings>;
|
|
143
|
+
/**
|
|
144
|
+
* Settings for series column customization @see https://www.amcharts.com/docs/v5/reference/roundedrectangle/#Settings
|
|
145
|
+
*/
|
|
146
|
+
columnSettings?: Partial<am5.IRoundedRectangleSettings>;
|
|
147
|
+
/**
|
|
148
|
+
* Settings for tooltips label customization @see https://www.amcharts.com/docs/v5/reference/ilabelsettings/
|
|
149
|
+
*/
|
|
150
|
+
tooltipSettings?: Partial<am5.ILabelSettings>;
|
|
151
|
+
unitPlacement?: UnitPlacement;
|
|
152
|
+
legendPlacement?: LegendPlacement;
|
|
153
|
+
translateLabel?: (name: string) => string;
|
|
154
|
+
/**
|
|
155
|
+
* Optional DOM id for the chart container, if not specified it will be automatically generated.
|
|
156
|
+
* It can also be an HTMLElement, in that case the element will be used as a parent.
|
|
157
|
+
*/
|
|
158
|
+
DOMtargetId?: string | HTMLElement;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Customizable stacked column and line chart component based on amcharts5
|
|
162
|
+
*
|
|
163
|
+
* This component wraps some of the chart configuration trying to make it more react-friendly
|
|
164
|
+
*/
|
|
165
|
+
export declare const Chart: React.FC<ChartProps>;
|
|
166
|
+
export {};
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, J2 Innovations. All Rights Reserved
|
|
3
|
+
*/
|
|
4
|
+
import * as am5 from '@amcharts/amcharts5';
|
|
5
|
+
import * as am5xy from '@amcharts/amcharts5/xy';
|
|
6
|
+
import { debounce } from 'lodash';
|
|
7
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
8
|
+
import { createUseStyles, useTheme } from 'react-jss';
|
|
9
|
+
const useStyles = createUseStyles({
|
|
10
|
+
root: {
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100%',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Returns a color palette selecting some colors from the theme.
|
|
17
|
+
* @param theme The theme
|
|
18
|
+
* @returns An array of colors
|
|
19
|
+
*/
|
|
20
|
+
const getDefaultChartColors = (theme) => {
|
|
21
|
+
return {
|
|
22
|
+
interfaceColors: {
|
|
23
|
+
text: theme.textColor,
|
|
24
|
+
},
|
|
25
|
+
series: [
|
|
26
|
+
theme.palette.lime,
|
|
27
|
+
theme.palette.cyan,
|
|
28
|
+
theme.palette.orange,
|
|
29
|
+
theme.palette.blue,
|
|
30
|
+
theme.palette.volcano,
|
|
31
|
+
theme.palette.green,
|
|
32
|
+
theme.palette.purple,
|
|
33
|
+
theme.palette.magenta,
|
|
34
|
+
theme.palette.grey,
|
|
35
|
+
theme.palette.gold,
|
|
36
|
+
theme.palette.red,
|
|
37
|
+
theme.palette.yellow,
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const buildYRenderer = (root, opposite = false, gridSettings) => {
|
|
42
|
+
const yRenderer = am5xy.AxisRendererY.new(root, {
|
|
43
|
+
strokeOpacity: 0,
|
|
44
|
+
forceHidden: true,
|
|
45
|
+
opposite,
|
|
46
|
+
});
|
|
47
|
+
yRenderer.grid.template.setAll({
|
|
48
|
+
strokeOpacity: 1,
|
|
49
|
+
...gridSettings,
|
|
50
|
+
});
|
|
51
|
+
yRenderer.labels.template.setAll({
|
|
52
|
+
fontSize: '0.7rem',
|
|
53
|
+
});
|
|
54
|
+
return yRenderer;
|
|
55
|
+
};
|
|
56
|
+
const buildValueAxis = (root, chart, axes, chartSeriesProps, unitPlacement, gridSettings, valueAxisSettings) => {
|
|
57
|
+
const unit = chartSeriesProps.unit ?? '';
|
|
58
|
+
const cachedAxis = axes.get(unit);
|
|
59
|
+
if (cachedAxis) {
|
|
60
|
+
return cachedAxis;
|
|
61
|
+
}
|
|
62
|
+
const opposite = (chartSeriesProps.axisPlacement ?? AxisPlacement.left) ==
|
|
63
|
+
AxisPlacement.right;
|
|
64
|
+
const renderer = buildYRenderer(root, opposite, gridSettings);
|
|
65
|
+
const axisToSync = axes.values().next()?.value;
|
|
66
|
+
const axis = chart.yAxes.push(am5xy.ValueAxis.new(root, {
|
|
67
|
+
renderer: renderer,
|
|
68
|
+
numberFormat: unitPlacement == UnitPlacement.axis && unit
|
|
69
|
+
? `#' ${unit}'`
|
|
70
|
+
: undefined,
|
|
71
|
+
marginTop: unitPlacement == UnitPlacement.top ? 15 : 0,
|
|
72
|
+
syncWithAxis: axisToSync,
|
|
73
|
+
visible: chartSeriesProps.hideAxis
|
|
74
|
+
? !chartSeriesProps.hideAxis
|
|
75
|
+
: true,
|
|
76
|
+
...valueAxisSettings,
|
|
77
|
+
}));
|
|
78
|
+
if (unitPlacement == UnitPlacement.top) {
|
|
79
|
+
addUnitTextLabels(root, chart, unit, opposite);
|
|
80
|
+
}
|
|
81
|
+
axes.set(unit, axis);
|
|
82
|
+
return axis;
|
|
83
|
+
};
|
|
84
|
+
const addUnitTextLabels = (root, chart, unit, opposite) => {
|
|
85
|
+
if (unit) {
|
|
86
|
+
const unitTextStyle = {
|
|
87
|
+
ignoreFormatting: true,
|
|
88
|
+
fontSize: '0.7rem',
|
|
89
|
+
height: 18,
|
|
90
|
+
marginBottom: 15,
|
|
91
|
+
position: 'absolute',
|
|
92
|
+
};
|
|
93
|
+
const x = am5.percent(!opposite ? 0 : 100);
|
|
94
|
+
const centerX = am5.percent(!opposite ? 0 : 100);
|
|
95
|
+
chart.children.unshift(am5.Label.new(root, {
|
|
96
|
+
text: `[${unit}]`,
|
|
97
|
+
x: x,
|
|
98
|
+
centerX: centerX,
|
|
99
|
+
...unitTextStyle,
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const buildLabelText = (unit, numberFormat) => `[bold]{name}[/]: {valueY.formatNumber(${numberFormat ? `"${numberFormat}"` : ''})}${unit ? ` ${unit}` : ''}\n{valueX.formatDate("d MMM HH:mm")}`;
|
|
104
|
+
const addLineSeries = (data, root, chart, xAxis, yAxes, dateField, unitPlacement, legendRef, gridSettings, valueAxisSettings, translateLabel, lineSeriesSettings, tooltipSettings) => {
|
|
105
|
+
data.forEach((lineSeries) => {
|
|
106
|
+
const lineYAxis = buildValueAxis(root, chart, yAxes, lineSeries, unitPlacement, gridSettings, valueAxisSettings);
|
|
107
|
+
const series = chart.series.push(am5xy.LineSeries.new(root, {
|
|
108
|
+
name: lineSeries.dis ??
|
|
109
|
+
translateLabel?.(lineSeries.seriesName) ??
|
|
110
|
+
lineSeries.seriesName,
|
|
111
|
+
xAxis: xAxis,
|
|
112
|
+
yAxis: lineYAxis,
|
|
113
|
+
valueYField: 'value',
|
|
114
|
+
valueXField: dateField,
|
|
115
|
+
fill: lineSeries.strokeSettings?.stroke,
|
|
116
|
+
tooltip: am5.Tooltip.new(root, {
|
|
117
|
+
labelText: buildLabelText(lineSeries.unit, '#.##'),
|
|
118
|
+
}),
|
|
119
|
+
...lineSeriesSettings,
|
|
120
|
+
...lineSeries.strokeSettings,
|
|
121
|
+
}));
|
|
122
|
+
if (tooltipSettings) {
|
|
123
|
+
series.get('tooltip')?.label.setAll(tooltipSettings);
|
|
124
|
+
}
|
|
125
|
+
if (lineSeries.strokeSettings) {
|
|
126
|
+
series.strokes.template.setAll(lineSeries.strokeSettings);
|
|
127
|
+
series.fills.template.setAll(lineSeries.strokeSettings);
|
|
128
|
+
}
|
|
129
|
+
series.data.setAll(lineSeries.data);
|
|
130
|
+
legendRef.current?.data.push(series);
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const addBarSeries = (data, root, chart, xAxis, yAxes, dateField, unitPlacement, stacked = false, legendRef, gridSettings, valueAxisSettings, translateLabel, barSeriesSettings, columnSettings, tooltipSettings) => {
|
|
134
|
+
data.forEach((barSeries) => {
|
|
135
|
+
const seriesName = barSeries.seriesName;
|
|
136
|
+
// Setup Y axes, one on the left and one on the right
|
|
137
|
+
const barYAxis = buildValueAxis(root, chart, yAxes, barSeries, unitPlacement, gridSettings, valueAxisSettings);
|
|
138
|
+
const seriesOptions = {
|
|
139
|
+
name: translateLabel?.(seriesName) ?? barSeries.dis ?? seriesName,
|
|
140
|
+
xAxis: xAxis,
|
|
141
|
+
yAxis: barYAxis,
|
|
142
|
+
stacked: stacked,
|
|
143
|
+
tooltip: am5.Tooltip.new(root, {
|
|
144
|
+
labelText: buildLabelText(barSeries.unit),
|
|
145
|
+
}),
|
|
146
|
+
valueYField: 'value',
|
|
147
|
+
valueXField: dateField,
|
|
148
|
+
};
|
|
149
|
+
if (barSeries.stroke) {
|
|
150
|
+
seriesOptions.fill = barSeries.stroke;
|
|
151
|
+
}
|
|
152
|
+
const series = chart.series.push(am5xy.ColumnSeries.new(root, {
|
|
153
|
+
...seriesOptions,
|
|
154
|
+
...barSeriesSettings,
|
|
155
|
+
}));
|
|
156
|
+
series.columns.template.setAll({
|
|
157
|
+
...columnSettings,
|
|
158
|
+
});
|
|
159
|
+
if (tooltipSettings) {
|
|
160
|
+
series.columns.template
|
|
161
|
+
.get('tooltip')
|
|
162
|
+
?.label.setAll(tooltipSettings);
|
|
163
|
+
}
|
|
164
|
+
series.data.setAll(barSeries.data);
|
|
165
|
+
legendRef.current?.data.push(series);
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
const addRanges = (root, axis, rangesData) => {
|
|
169
|
+
rangesData?.forEach((rangeData) => {
|
|
170
|
+
addRange(root, axis, rangeData, rangeData.placeBelow);
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
const addRange = (root, axis, rangeData, shifted = false) => {
|
|
174
|
+
const rangeDataItem = axis.makeDataItem({
|
|
175
|
+
value: rangeData.startValue,
|
|
176
|
+
endValue: rangeData.endValue,
|
|
177
|
+
isRange: true,
|
|
178
|
+
});
|
|
179
|
+
axis.createAxisRange(rangeDataItem);
|
|
180
|
+
const axisFill = rangeDataItem.get('axisFill');
|
|
181
|
+
axisFill?.setAll({
|
|
182
|
+
fill: rangeData.color,
|
|
183
|
+
fillOpacity: 0,
|
|
184
|
+
visible: true,
|
|
185
|
+
});
|
|
186
|
+
const label = rangeDataItem.get('label');
|
|
187
|
+
label?.setAll({
|
|
188
|
+
text: rangeData.showText ? rangeData.text : '',
|
|
189
|
+
fill: rangeData.foreground,
|
|
190
|
+
html: rangeData.html,
|
|
191
|
+
fontSize: '0.8rem',
|
|
192
|
+
height: 24,
|
|
193
|
+
location: 0,
|
|
194
|
+
centerX: 0,
|
|
195
|
+
tooltipText: rangeData.tooltip,
|
|
196
|
+
layer: -1,
|
|
197
|
+
background: am5.Rectangle.new(root, {
|
|
198
|
+
fill: rangeData.color,
|
|
199
|
+
fillOpacity: rangeData.opacity ?? 0.2,
|
|
200
|
+
strokeWidth: 1,
|
|
201
|
+
stroke: rangeData.foreground,
|
|
202
|
+
}),
|
|
203
|
+
});
|
|
204
|
+
axisFill?.events.on('boundschanged', (e) => {
|
|
205
|
+
label?.setAll({
|
|
206
|
+
width: e.target.width(),
|
|
207
|
+
maxWidth: e.target.width(),
|
|
208
|
+
oversizedBehavior: 'truncate',
|
|
209
|
+
y: shifted ? 24 : 0,
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
const setupLegend = (root, chart, legendPlacement, legendSettings, legendLabelsSettings, legendMarkersSettings) => {
|
|
214
|
+
const legendItem = am5.Legend.new(root, {
|
|
215
|
+
paddingTop: legendPlacement == LegendPlacement.bottom ? 20 : 0,
|
|
216
|
+
paddingBottom: legendPlacement == LegendPlacement.top ? 20 : 0,
|
|
217
|
+
forceHidden: legendPlacement == LegendPlacement.hidden,
|
|
218
|
+
layout: legendPlacement == LegendPlacement.left ||
|
|
219
|
+
legendPlacement == LegendPlacement.right
|
|
220
|
+
? root.verticalLayout
|
|
221
|
+
: root.gridLayout,
|
|
222
|
+
...legendSettings,
|
|
223
|
+
});
|
|
224
|
+
// Setup legend
|
|
225
|
+
const legend = legendPlacement == LegendPlacement.left ||
|
|
226
|
+
legendPlacement == LegendPlacement.top
|
|
227
|
+
? chart.children.unshift(legendItem)
|
|
228
|
+
: chart.children.push(legendItem);
|
|
229
|
+
legend.labels.template.setAll({
|
|
230
|
+
fontSize: '0.8rem',
|
|
231
|
+
...legendLabelsSettings,
|
|
232
|
+
});
|
|
233
|
+
legend.valueLabels.template.setAll({
|
|
234
|
+
forceHidden: true,
|
|
235
|
+
});
|
|
236
|
+
legend.markers.template.setAll({
|
|
237
|
+
width: 12,
|
|
238
|
+
height: 12,
|
|
239
|
+
...legendMarkersSettings,
|
|
240
|
+
});
|
|
241
|
+
if (legendMarkersSettings?.rounded) {
|
|
242
|
+
legend.markerRectangles.template.setAll({
|
|
243
|
+
cornerRadiusTL: 100,
|
|
244
|
+
cornerRadiusTR: 100,
|
|
245
|
+
cornerRadiusBL: 100,
|
|
246
|
+
cornerRadiusBR: 100,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
return legend;
|
|
250
|
+
};
|
|
251
|
+
export var UnitPlacement;
|
|
252
|
+
(function (UnitPlacement) {
|
|
253
|
+
UnitPlacement["none"] = "none";
|
|
254
|
+
UnitPlacement["top"] = "top";
|
|
255
|
+
UnitPlacement["axis"] = "axis";
|
|
256
|
+
})(UnitPlacement || (UnitPlacement = {}));
|
|
257
|
+
export var AxisPlacement;
|
|
258
|
+
(function (AxisPlacement) {
|
|
259
|
+
AxisPlacement["left"] = "left";
|
|
260
|
+
AxisPlacement["right"] = "right";
|
|
261
|
+
})(AxisPlacement || (AxisPlacement = {}));
|
|
262
|
+
export var LegendPlacement;
|
|
263
|
+
(function (LegendPlacement) {
|
|
264
|
+
LegendPlacement["top"] = "top";
|
|
265
|
+
LegendPlacement["bottom"] = "bottom";
|
|
266
|
+
LegendPlacement["left"] = "left";
|
|
267
|
+
LegendPlacement["right"] = "right";
|
|
268
|
+
LegendPlacement["hidden"] = "hidden";
|
|
269
|
+
})(LegendPlacement || (LegendPlacement = {}));
|
|
270
|
+
/**
|
|
271
|
+
* Customizable stacked column and line chart component based on amcharts5
|
|
272
|
+
*
|
|
273
|
+
* This component wraps some of the chart configuration trying to make it more react-friendly
|
|
274
|
+
*/
|
|
275
|
+
export const Chart = ({ DOMtargetId, baseInterval, barSeriesData, stackedBarSeriesData, lineSeriesData, rangesData, dateField, colorPalette, numberFormat, chartThemes, chartSettings, legendSettings, legendLabelsSettings, legendMarkersSettings, dateAxisSettings, dateAxisRendererSettings, valueAxisSettings, gridSettings, barSeriesSettings, lineSeriesSettings, columnSettings, tooltipSettings, cursor = false, unitPlacement = UnitPlacement.none, legendPlacement = LegendPlacement.bottom, translateLabel, }) => {
|
|
276
|
+
// Colors configuration
|
|
277
|
+
const theme = useTheme();
|
|
278
|
+
const colors = { ...getDefaultChartColors(theme), ...colorPalette };
|
|
279
|
+
// Chart lifecycle
|
|
280
|
+
const [id, setId] = useState(DOMtargetId ?? `amchart-${Math.random()}`);
|
|
281
|
+
const containerRef = useRef(null);
|
|
282
|
+
const rootRef = useRef(null);
|
|
283
|
+
const chartRef = useRef(null);
|
|
284
|
+
const legendRef = useRef(null);
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
if (DOMtargetId && DOMtargetId !== id) {
|
|
287
|
+
setId(DOMtargetId);
|
|
288
|
+
}
|
|
289
|
+
}, [DOMtargetId]);
|
|
290
|
+
// Chart setup
|
|
291
|
+
useLayoutEffect(() => {
|
|
292
|
+
const root = am5.Root.new(id);
|
|
293
|
+
root.autoResize = false;
|
|
294
|
+
// Setup amcharts theme
|
|
295
|
+
if (chartThemes) {
|
|
296
|
+
root.setThemes(chartThemes.map((t) => t.new(root)));
|
|
297
|
+
}
|
|
298
|
+
// Setup interface colors, see https://www.amcharts.com/docs/v5/concepts/colors-gradients-and-patterns/#Interface_colors
|
|
299
|
+
if (colors.interfaceColors) {
|
|
300
|
+
// Remap settings to use amcharts Color objects
|
|
301
|
+
for (const setting in colors.interfaceColors) {
|
|
302
|
+
const color = colors.interfaceColors[setting];
|
|
303
|
+
// Apply defined interfaceColor on the chart
|
|
304
|
+
root.interfaceColors.set(setting, am5.color(color));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// Setup chart settings
|
|
308
|
+
const chart = root.container.children.push(am5xy.XYChart.new(root, {
|
|
309
|
+
layout: legendPlacement == LegendPlacement.left ||
|
|
310
|
+
legendPlacement == LegendPlacement.right
|
|
311
|
+
? root.horizontalLayout
|
|
312
|
+
: root.verticalLayout,
|
|
313
|
+
paddingLeft: 0,
|
|
314
|
+
paddingRight: 0,
|
|
315
|
+
paddingBottom: 0,
|
|
316
|
+
paddingTop: legendPlacement == LegendPlacement.top ||
|
|
317
|
+
unitPlacement == UnitPlacement.top
|
|
318
|
+
? 35
|
|
319
|
+
: 10,
|
|
320
|
+
...chartSettings,
|
|
321
|
+
}));
|
|
322
|
+
// Setup cursor
|
|
323
|
+
if (cursor) {
|
|
324
|
+
chart.set('cursor', am5xy.XYCursor.new(root, {}));
|
|
325
|
+
}
|
|
326
|
+
// Setup series colors
|
|
327
|
+
if (colors?.series) {
|
|
328
|
+
chart.get('colors')?.set('colors', colors.series.map((c) => am5.color(c)));
|
|
329
|
+
}
|
|
330
|
+
const legend = setupLegend(root, chart, legendPlacement, legendSettings, legendLabelsSettings, legendMarkersSettings);
|
|
331
|
+
rootRef.current = root;
|
|
332
|
+
chartRef.current = chart;
|
|
333
|
+
legendRef.current = legend;
|
|
334
|
+
// Clean up before component removal from the DOM
|
|
335
|
+
return () => {
|
|
336
|
+
legendRef.current?.dispose();
|
|
337
|
+
legendRef.current = null;
|
|
338
|
+
chartRef.current?.dispose();
|
|
339
|
+
chartRef.current = null;
|
|
340
|
+
root?.dispose();
|
|
341
|
+
rootRef.current = null;
|
|
342
|
+
};
|
|
343
|
+
}, [id, colors, chartThemes, chartSettings, legendSettings]);
|
|
344
|
+
// Set data
|
|
345
|
+
useEffect(() => {
|
|
346
|
+
const root = rootRef.current;
|
|
347
|
+
const chart = chartRef.current;
|
|
348
|
+
if (chart && root) {
|
|
349
|
+
chart.series.clear();
|
|
350
|
+
if (barSeriesData?.length == 0 &&
|
|
351
|
+
stackedBarSeriesData?.length == 0 &&
|
|
352
|
+
lineSeriesData?.length == 0) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
// Setup axes
|
|
356
|
+
const xRenderer = am5xy.AxisRendererX.new(root, {
|
|
357
|
+
strokeWidth: 0,
|
|
358
|
+
minGridDistance: 30,
|
|
359
|
+
...dateAxisRendererSettings,
|
|
360
|
+
});
|
|
361
|
+
const xAxis = chart.xAxes.push(am5xy.DateAxis.new(root, {
|
|
362
|
+
baseInterval,
|
|
363
|
+
renderer: xRenderer,
|
|
364
|
+
...dateAxisSettings,
|
|
365
|
+
}));
|
|
366
|
+
xRenderer.grid.template.setAll({
|
|
367
|
+
strokeWidth: 0,
|
|
368
|
+
forceHidden: true,
|
|
369
|
+
});
|
|
370
|
+
xRenderer.labels.template.setAll({
|
|
371
|
+
location: 0.5,
|
|
372
|
+
fontSize: '0.7rem',
|
|
373
|
+
textAlign: 'center',
|
|
374
|
+
});
|
|
375
|
+
xAxis.data.setAll(Array.prototype.concat(stackedBarSeriesData ?? [], lineSeriesData ?? [], barSeriesData ?? []));
|
|
376
|
+
addRanges(root, xAxis, rangesData);
|
|
377
|
+
const yAxes = new Map();
|
|
378
|
+
if (barSeriesData) {
|
|
379
|
+
addBarSeries(barSeriesData, root, chart, xAxis, yAxes, dateField, unitPlacement, false, legendRef, gridSettings, valueAxisSettings, translateLabel, barSeriesSettings, columnSettings, tooltipSettings);
|
|
380
|
+
}
|
|
381
|
+
if (stackedBarSeriesData) {
|
|
382
|
+
addBarSeries(stackedBarSeriesData, root, chart, xAxis, yAxes, dateField, unitPlacement, true, legendRef, gridSettings, valueAxisSettings, translateLabel, barSeriesSettings, columnSettings, tooltipSettings);
|
|
383
|
+
}
|
|
384
|
+
if (lineSeriesData) {
|
|
385
|
+
addLineSeries(lineSeriesData, root, chart, xAxis, yAxes, dateField, unitPlacement, legendRef, gridSettings, valueAxisSettings, translateLabel, lineSeriesSettings, tooltipSettings);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}, [
|
|
389
|
+
stackedBarSeriesData,
|
|
390
|
+
barSeriesData,
|
|
391
|
+
lineSeriesData,
|
|
392
|
+
chartRef.current,
|
|
393
|
+
colors?.series,
|
|
394
|
+
barSeriesSettings,
|
|
395
|
+
lineSeriesSettings,
|
|
396
|
+
]);
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
if (numberFormat) {
|
|
399
|
+
rootRef.current?.numberFormatter.set('numberFormat', numberFormat);
|
|
400
|
+
}
|
|
401
|
+
}, [rootRef.current, numberFormat]);
|
|
402
|
+
useEffect(() => {
|
|
403
|
+
let resizeObserver;
|
|
404
|
+
if (containerRef.current) {
|
|
405
|
+
const onResize = debounce(() => rootRef.current?.resize(), 100);
|
|
406
|
+
resizeObserver = new ResizeObserver(onResize);
|
|
407
|
+
resizeObserver.observe(containerRef.current);
|
|
408
|
+
}
|
|
409
|
+
return () => resizeObserver?.disconnect();
|
|
410
|
+
}, [containerRef.current, rootRef.current]);
|
|
411
|
+
const classes = useStyles();
|
|
412
|
+
return typeof id === 'string' ? (React.createElement("div", { id: id, className: classes.root })) : (
|
|
413
|
+
// If the DOM target is an HTML element, do not render another div. The chart will be attached to the existing element.
|
|
414
|
+
React.createElement(React.Fragment, null));
|
|
415
|
+
};
|
|
416
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../../../src/react/components/charts/line-bar/Chart.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAG1C,OAAO,KAAK,KAAK,MAAM,wBAAwB,CAAA;AAG/C,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAErD,MAAM,SAAS,GAAG,eAAe,CAAC;IACjC,IAAI,EAAE;QACL,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;KACd;CACD,CAAC,CAAA;AAWF;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,CAC7B,KAAe,EACkB,EAAE;IACnC,OAAO;QACN,eAAe,EAAE;YAChB,IAAI,EAAE,KAAK,CAAC,SAAS;SACrB;QACD,MAAM,EAAE;YACP,KAAK,CAAC,OAAO,CAAC,IAAI;YAClB,KAAK,CAAC,OAAO,CAAC,IAAI;YAClB,KAAK,CAAC,OAAO,CAAC,MAAM;YACpB,K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AAG,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,CAAA;IAC1C,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IAE3C,MAAM,OAAO,GAAG,SAAS,EAAE,CAAA;IAC3B,OAAO,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC/B,6BAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,GAAQ,CAC5C,CAAC,CAAC,CAAC;IACH,uHAAuH;IACvH,yCAAK,CACL,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as am5 from '@amcharts/amcharts5';
|
|
2
|
+
import { ITimeInterval } from '@amcharts/amcharts5/.internal/core/util/Time';
|
|
3
|
+
import { HBool, HDict, HGrid, HNum, HStr, HVal } from 'haystack-core';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { BarChartSeriesData, LegendPlacement, LineChartSeriesData, UnitPlacement } from './Chart';
|
|
6
|
+
export declare const rollupDurationToTimeInterval: (value?: HNum) => ITimeInterval;
|
|
7
|
+
export interface HGridChartRange extends HGridChartItemProps {
|
|
8
|
+
startValue: HVal;
|
|
9
|
+
endValue: HVal;
|
|
10
|
+
}
|
|
11
|
+
export interface HGridChartMetadata extends HDict {
|
|
12
|
+
ranges?: HGridChartRange[];
|
|
13
|
+
hisRollupInterval?: HNum;
|
|
14
|
+
}
|
|
15
|
+
export interface HGridChartItemProps extends HDict {
|
|
16
|
+
dis?: HStr;
|
|
17
|
+
color?: HStr;
|
|
18
|
+
opacity?: HNum;
|
|
19
|
+
}
|
|
20
|
+
export interface HGridChartSeriesProps extends HGridChartItemProps {
|
|
21
|
+
series?: HStr;
|
|
22
|
+
variant?: HStr;
|
|
23
|
+
unit?: HStr;
|
|
24
|
+
hideAxis?: HBool;
|
|
25
|
+
axisPlacement?: HStr;
|
|
26
|
+
}
|
|
27
|
+
export interface HGridChartProps {
|
|
28
|
+
className?: string;
|
|
29
|
+
data: HGrid;
|
|
30
|
+
timeRange: [Date, Date];
|
|
31
|
+
timeInterval?: am5.time.ITimeInterval;
|
|
32
|
+
unitPlacement?: UnitPlacement;
|
|
33
|
+
legendPlacement?: LegendPlacement;
|
|
34
|
+
translateLabel?: (name: string) => string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Optional DOM id for the chart container, if not specified it will be automatically generated.
|
|
37
|
+
* It can also be an HTMLElement, in that case the element will be used as a parent.
|
|
38
|
+
*/
|
|
39
|
+
DOMtargetId?: string | HTMLElement;
|
|
40
|
+
}
|
|
41
|
+
export declare const isLineSeries: (colMetadata?: HGridChartSeriesProps) => boolean;
|
|
42
|
+
export declare const isStackedBarSeries: (colMetadata?: HGridChartSeriesProps) => boolean;
|
|
43
|
+
export declare const isBarSeries: (colMetadata?: HGridChartSeriesProps) => boolean;
|
|
44
|
+
export declare const colNameToDisProvider: (grid: HGrid, translateLabel?: ((name: string) => string | undefined) | undefined) => (colName: string) => string;
|
|
45
|
+
export declare const splitBarAndLineSeriesCols: (grid: HGrid) => {
|
|
46
|
+
barSeries: Set<string>;
|
|
47
|
+
stackedBarSeries: Set<string>;
|
|
48
|
+
lineSeries: Set<string>;
|
|
49
|
+
};
|
|
50
|
+
export declare const getBarSeriesRowData: (row: HDict, metadata: HDict, colName: string, barSeriesData: Map<string, BarChartSeriesData>) => void;
|
|
51
|
+
export declare const addLineSeriesRowData: (row: HDict, metadata: HDict, colName: string, lineSeriesData: Map<string, LineChartSeriesData>) => void;
|
|
52
|
+
export declare const calculateDefaultTimeInterval: (timeRange: [Date, Date]) => am5.time.ITimeInterval;
|
|
53
|
+
/**
|
|
54
|
+
* A component that renders a chart containing multiple series
|
|
55
|
+
* of different kinds, taking all the data and configuration from an HGrid.
|
|
56
|
+
*/
|
|
57
|
+
export declare const HGridChart: React.NamedExoticComponent<HGridChartProps>;
|
|
58
|
+
export default HGridChart;
|