@gravity-ui/chartkit 5.19.2 → 5.20.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.
|
@@ -7,25 +7,9 @@ const calcOption = (d) => {
|
|
|
7
7
|
})
|
|
8
8
|
: d;
|
|
9
9
|
};
|
|
10
|
-
const getSeriesColorProperty = (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const userSeries = userData.graphs[rowIndex];
|
|
14
|
-
const lineColor = (_a = data.yagr.getSeriesById(row.id)) === null || _a === void 0 ? void 0 : _a.lineColor;
|
|
15
|
-
let seriesColor = row.color;
|
|
16
|
-
switch (userSeries === null || userSeries === void 0 ? void 0 : userSeries.legendColorKey) {
|
|
17
|
-
case 'lineColor': {
|
|
18
|
-
if (lineColor) {
|
|
19
|
-
seriesColor = lineColor;
|
|
20
|
-
}
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
case 'color':
|
|
24
|
-
default: {
|
|
25
|
-
seriesColor = row.color;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return seriesColor;
|
|
10
|
+
const getSeriesColorProperty = ({ data, rowId }) => {
|
|
11
|
+
const series = data.yagr.getSeriesById(rowId);
|
|
12
|
+
return data.yagr.getSerieLegendColor(series);
|
|
29
13
|
};
|
|
30
14
|
/*
|
|
31
15
|
* Default tooltip renderer.
|
|
@@ -62,7 +46,7 @@ export const getRenderTooltip = (userData) => (data) => {
|
|
|
62
46
|
activeRowAlwaysFirstInTooltip: rows.length > 1,
|
|
63
47
|
tooltipHeader: dateTime({ input: x / timeMultiplier, timeZone }).format('DD MMMM YYYY HH:mm:ss'),
|
|
64
48
|
shared: true,
|
|
65
|
-
lines: rows.map((row, i) => (Object.assign(Object.assign({}, row), { seriesName: row.name || 'Serie ' + (i + 1), seriesColor: getSeriesColorProperty({ data,
|
|
49
|
+
lines: rows.map((row, i) => (Object.assign(Object.assign({}, row), { seriesName: row.name || 'Serie ' + (i + 1), seriesColor: getSeriesColorProperty({ data, rowId: row.id }), selectedSeries: row.active, seriesIdx: row.seriesIdx, percentValue: typeof row.transformed === 'number' ? row.transformed.toFixed(1) : '' }))),
|
|
66
50
|
withPercent: calcOption(opts.percent),
|
|
67
51
|
hiddenRowsNumber: hiddenRowsNumber,
|
|
68
52
|
hiddenRowsSum,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MinimalValidConfig, RawSerieData,
|
|
1
|
+
import type { MinimalValidConfig, RawSerieData, YagrConfig } from '@gravity-ui/yagr';
|
|
2
2
|
import type Yagr from '@gravity-ui/yagr';
|
|
3
3
|
import { ChartKitProps } from 'src/types';
|
|
4
4
|
export type { default as Yagr } from '@gravity-ui/yagr';
|
|
@@ -10,19 +10,9 @@ export interface CustomTooltipProps {
|
|
|
10
10
|
export type YagrWidgetProps = ChartKitProps<'yagr'> & {
|
|
11
11
|
id: string;
|
|
12
12
|
};
|
|
13
|
-
export type YagrSeriesData<T = Omit<SeriesOptions, 'type'>> = RawSerieData<T> & {
|
|
14
|
-
/**
|
|
15
|
-
* Determines what data value should be used to get a color for tooltip series. Does not work in case of using custom tooltip rendered via `tooltip` property.
|
|
16
|
-
* - `lineColor` indicates that lineColor property should be used
|
|
17
|
-
* - `color` indicates that color property should be used
|
|
18
|
-
*
|
|
19
|
-
* @default 'color'
|
|
20
|
-
*/
|
|
21
|
-
legendColorKey?: 'color' | 'lineColor';
|
|
22
|
-
};
|
|
23
13
|
export type YagrWidgetData = {
|
|
24
14
|
data: {
|
|
25
|
-
graphs:
|
|
15
|
+
graphs: RawSerieData[];
|
|
26
16
|
timeline: number[];
|
|
27
17
|
/**
|
|
28
18
|
* Allow to setup timezone for X axis and tooltip's header.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.20.0",
|
|
4
4
|
"description": "React component used to render charts based on any sources you need",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:gravity-ui/ChartKit.git",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@gravity-ui/charts": "^0.5.0",
|
|
51
51
|
"@gravity-ui/date-utils": "^2.1.0",
|
|
52
52
|
"@gravity-ui/i18n": "^1.0.0",
|
|
53
|
-
"@gravity-ui/yagr": "^4.
|
|
53
|
+
"@gravity-ui/yagr": "^4.5.0",
|
|
54
54
|
"afterframe": "^1.0.2",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
56
|
"tslib": "^2.6.2"
|