@gravity-ui/chartkit 0.9.0 → 0.10.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.
- package/CHANGELOG.md +21 -0
- package/build/components/ChartKit.css +23 -0
- package/build/components/ChartKit.d.ts +0 -1
- package/build/components/ChartKit.js +4 -5
- package/build/i18n/keysets/en.json +60 -0
- package/build/i18n/keysets/ru.json +62 -0
- package/build/libs/chartkit-error/chartkit-error.d.ts +1 -0
- package/build/libs/chartkit-error/chartkit-error.js +1 -0
- package/build/libs/settings/__tests__/settings.test.js +1 -1
- package/build/libs/settings/settings.d.ts +6 -3
- package/build/libs/settings/settings.js +4 -2
- package/build/plugins/highcharts/__stories__/AreaRange.stories.d.ts +4 -0
- package/build/plugins/highcharts/__stories__/AreaRange.stories.js +22 -0
- package/build/plugins/highcharts/__stories__/Line.stories.d.ts +4 -0
- package/build/plugins/highcharts/__stories__/Line.stories.js +21 -0
- package/build/plugins/highcharts/__stories__/mocks/area-range.d.ts +2 -0
- package/build/plugins/highcharts/__stories__/mocks/area-range.js +61 -0
- package/build/plugins/highcharts/__stories__/mocks/holidays.d.ts +7070 -0
- package/build/plugins/highcharts/__stories__/mocks/holidays.js +7065 -0
- package/build/plugins/highcharts/__stories__/mocks/line.d.ts +2 -0
- package/build/plugins/highcharts/__stories__/mocks/line.js +129 -0
- package/build/plugins/highcharts/index.d.ts +2 -0
- package/build/plugins/highcharts/index.js +5 -0
- package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +23 -0
- package/build/plugins/highcharts/renderer/HighchartsWidget.js +6 -0
- package/build/plugins/highcharts/renderer/components/HighchartsComponent.css +4 -0
- package/build/plugins/highcharts/renderer/components/HighchartsComponent.d.ts +575 -0
- package/build/plugins/highcharts/renderer/components/HighchartsComponent.js +115 -0
- package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.css +50 -0
- package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.d.ts +10 -0
- package/build/plugins/highcharts/renderer/components/StyledSplitPane/StyledSplitPane.js +32 -0
- package/build/plugins/highcharts/renderer/components/withSplitPane/WithSplitPane.css +4 -0
- package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.d.ts +10 -0
- package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +207 -0
- package/build/plugins/highcharts/renderer/helpers/add-holidays.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/add-holidays.js +43 -0
- package/build/plugins/highcharts/renderer/helpers/comments/drawing.d.ts +11 -0
- package/build/plugins/highcharts/renderer/helpers/comments/drawing.js +571 -0
- package/build/plugins/highcharts/renderer/helpers/config/config.d.ts +575 -0
- package/build/plugins/highcharts/renderer/helpers/config/config.js +1483 -0
- package/build/plugins/highcharts/renderer/helpers/config/handleLegendItemClick.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/handleLegendItemClick.js +57 -0
- package/build/plugins/highcharts/renderer/helpers/config/options.d.ts +465 -0
- package/build/plugins/highcharts/renderer/helpers/config/options.js +350 -0
- package/build/plugins/highcharts/renderer/helpers/config/types.d.ts +6 -0
- package/build/plugins/highcharts/renderer/helpers/config/types.js +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.d.ts +10 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.js +42 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/addShowInNavigatorToSeries.test.js +99 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.js +17 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/buildNavigatorFallback.test.js +28 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.d.ts +5 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.js +20 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/calculatePrecision.test.js +27 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/concatStrings.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/concatStrings.js +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getChartKitFormattedValue.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getChartKitFormattedValue.js +15 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.d.ts +3 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.js +15 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getFormatOptionsFromLine.test.js +11 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.js +9 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/getXAxisThresholdValue.test.js +20 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/index.d.ts +13 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/index.js +13 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isNavigatorSeries.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isNavigatorSeries.js +3 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isSafari.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isSafari.js +12 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.js +8 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/isTooltipShared.test.js +31 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/localStorage.d.ts +5 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/localStorage.js +23 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/mergeArrayWithObject.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/mergeArrayWithObject.js +10 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.js +19 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/numberFormat.test.js +20 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.d.ts +13 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.js +27 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/config/utils/setNavigatorDefaultPeriod.test.js +45 -0
- package/build/plugins/highcharts/renderer/helpers/constants.d.ts +28 -0
- package/build/plugins/highcharts/renderer/helpers/constants.js +30 -0
- package/build/plugins/highcharts/renderer/helpers/graph.css +89 -0
- package/build/plugins/highcharts/renderer/helpers/graph.d.ts +552 -0
- package/build/plugins/highcharts/renderer/helpers/graph.js +85 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/colors.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/colors.js +17 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.d.ts +4 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/highcharts.js +346 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calcucalteClosestPointManually.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calcucalteClosestPointManually.js +19 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calculateClosestPointManually.test.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/utils/calculateClosestPointManually.test.js +42 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/utils/index.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/highcharts/utils/index.js +1 -0
- package/build/plugins/highcharts/renderer/helpers/init-highcharts-modules.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/init-highcharts-modules.js +49 -0
- package/build/plugins/highcharts/renderer/helpers/prepare-data.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/prepare-data.js +175 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/constants.d.ts +13 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/constants.js +14 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.d.ts +1 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/helpers.js +5 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/index.d.ts +13 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/index.js +253 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/index.d.ts +6 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/index.js +22 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashDotLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashDotLineIcon.js +20 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DashLineIcon.js +25 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DotLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/DotLineIcon.js +20 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotDotLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotDotLineIcon.js +18 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashDotLineIcon.js +18 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/LongDashLineIcon.js +15 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotDotLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotDotLineIcon.js +18 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashDotLineIcon.js +18 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDashLineIcon.js +18 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDotLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/ShortDotLineIcon.js +20 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/SolidLineIcon.d.ts +2 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/SolidLineIcon.js +13 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/index.d.ts +11 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/template-icons/index.js +11 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/types.d.ts +4 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/types.js +1 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/utils.d.ts +7 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/render-shape-icon/utils.js +5 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/tooltip.css +367 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/types.d.ts +85 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/types.js +1 -0
- package/build/plugins/highcharts/renderer/helpers/types.d.ts +22 -0
- package/build/plugins/highcharts/renderer/helpers/types.js +1 -0
- package/build/plugins/highcharts/types/comments.d.ts +51 -0
- package/build/plugins/highcharts/types/comments.js +1 -0
- package/build/plugins/highcharts/types/highcharts-extends.d.ts +38 -0
- package/build/plugins/highcharts/types/index.d.ts +4 -0
- package/build/plugins/highcharts/types/index.js +1 -0
- package/build/plugins/highcharts/types/lib.d.ts +1 -0
- package/build/plugins/highcharts/types/lib.js +1 -0
- package/build/plugins/highcharts/types/misc.d.ts +19 -0
- package/build/plugins/highcharts/types/misc.js +1 -0
- package/build/plugins/highcharts/types/widget.d.ts +47 -0
- package/build/plugins/highcharts/types/widget.js +1 -0
- package/build/plugins/index.d.ts +4 -2
- package/build/plugins/index.js +1 -0
- package/build/plugins/indicator/renderer/IndicatorItem.d.ts +3 -2
- package/build/plugins/indicator/renderer/IndicatorWidget.d.ts +10 -2
- package/build/plugins/indicator/renderer/IndicatorWidget.js +1 -1
- package/build/plugins/indicator/types.d.ts +0 -6
- package/build/plugins/shared/format-number/format-number.d.ts +4 -0
- package/build/plugins/shared/format-number/format-number.js +88 -0
- package/build/plugins/shared/format-number/format-number.test.d.ts +1 -0
- package/build/plugins/shared/format-number/format-number.test.js +14 -0
- package/build/plugins/shared/format-number/i18n/en.json +17 -0
- package/build/plugins/shared/format-number/i18n/i18n.d.ts +5 -0
- package/build/plugins/shared/format-number/i18n/i18n.js +8 -0
- package/build/plugins/shared/format-number/i18n/ru.json +17 -0
- package/build/plugins/shared/format-number/types.d.ts +14 -0
- package/build/plugins/shared/format-number/types.js +1 -0
- package/build/plugins/shared/index.d.ts +2 -0
- package/build/plugins/shared/index.js +1 -0
- package/build/plugins/yagr/renderer/YagrWidget.d.ts +11 -3
- package/build/plugins/yagr/renderer/YagrWidget.js +4 -3
- package/build/plugins/yagr/types.d.ts +0 -7
- package/build/types/index.d.ts +1 -2
- package/build/types/misc.d.ts +4 -0
- package/build/types/misc.js +1 -0
- package/build/types/widget.d.ts +17 -0
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.10.0](https://github.com/gravity-ui/chartkit/compare/v0.9.1...v0.10.0) (2022-11-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add highcharts plugin ([#61](https://github.com/gravity-ui/chartkit/issues/61)) ([9329ede](https://github.com/gravity-ui/chartkit/commit/9329edeaba8c4ef84b1fc30bb7196ba350dc3abd))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **Highcharts plaugin:** fix error handling and reflow method ([#63](https://github.com/gravity-ui/chartkit/issues/63)) ([ba4f2ad](https://github.com/gravity-ui/chartkit/commit/ba4f2ada96ae642a93ebd203438463f72883e245))
|
|
14
|
+
* yagr & indicator types fixes ([#64](https://github.com/gravity-ui/chartkit/issues/64)) ([479c552](https://github.com/gravity-ui/chartkit/commit/479c552f5ce1890451f3f104fc8efb730f2baf67))
|
|
15
|
+
|
|
16
|
+
## [0.9.1](https://github.com/gravity-ui/chartkit/compare/v0.9.0...v0.9.1) (2022-11-14)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* fix yagr theme ininitialization ([7247873](https://github.com/gravity-ui/chartkit/commit/724787380b8d81f6dfdaae1f6e5c1b806af32e3c))
|
|
22
|
+
* fix yagr theme initialization ([#59](https://github.com/gravity-ui/chartkit/issues/59)) ([7247873](https://github.com/gravity-ui/chartkit/commit/724787380b8d81f6dfdaae1f6e5c1b806af32e3c))
|
|
23
|
+
|
|
3
24
|
## [0.9.0](https://github.com/gravity-ui/chartkit/compare/v0.8.0...v0.9.0) (2022-11-08)
|
|
4
25
|
|
|
5
26
|
|
|
@@ -5,4 +5,27 @@
|
|
|
5
5
|
|
|
6
6
|
.chartkit_mobile .chartkit-scrollable-node {
|
|
7
7
|
max-height: 3000px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.chartkit-theme_common {
|
|
11
|
+
--highcarts-navigator-border: var(--yc-color-line-generic);
|
|
12
|
+
--highcarts-navigator-track: var(--yc-color-base-generic);
|
|
13
|
+
--highcarts-navigator-body: var(--yc-color-scroll-handle);
|
|
14
|
+
--highcharts-series-border: var(--yc-color-base-background);
|
|
15
|
+
--highcharts-grid-line: var(--yc-color-line-generic);
|
|
16
|
+
--highcharts-axis-line: var(--yc-color-line-generic);
|
|
17
|
+
--highcharts-tick: var(--yc-color-line-generic);
|
|
18
|
+
--highcharts-title: var(--yc-color-text-primary);
|
|
19
|
+
--highcharts-axis-labels: var(--yc-color-text-secondary);
|
|
20
|
+
--highcharts-data-labels: var(--yc-color-text-complementary);
|
|
21
|
+
--highcharts-plot-line-label: var(--yc-color-text-complementary);
|
|
22
|
+
--highcharts-legend-item: var(--yc-color-text-secondary);
|
|
23
|
+
--highcharts-legend-item-hover: var(--yc-color-text-primary);
|
|
24
|
+
--highcharts-legend-item-hidden: var(--yc-color-text-hint);
|
|
25
|
+
--highcharts-floating-bg: var(--yc-color-infographics-tooltip-bg);
|
|
26
|
+
--highcharts-tooltip-text: var(--yc-color-text-primary);
|
|
27
|
+
--highcharts-tooltip-bg: var(--highcharts-floating-bg);
|
|
28
|
+
--highcharts-tooltip-alternate-bg: var(--yc-color-base-generic);
|
|
29
|
+
--highcharts-tooltip-text-complementary: var(--yc-color-text-complementary);
|
|
30
|
+
--highcharts-holiday-band: var(--yc-color-base-generic);
|
|
8
31
|
}
|
|
@@ -13,7 +13,6 @@ export declare const ChartKit: <T extends keyof import("../types").ChartkitWidge
|
|
|
13
13
|
isMobile?: boolean | undefined;
|
|
14
14
|
onLoad?: ((data?: import("../types").ChartKitOnLoadData<T> | undefined) => void) | undefined;
|
|
15
15
|
onError?: import("../types").ChartKitOnError | undefined;
|
|
16
|
-
formatNumber?: import("../types").ChartKitFormatNumber | undefined;
|
|
17
16
|
} & { [key in keyof Omit<import("../types").ChartkitWidget[T], "widget" | "data">]: import("../types").ChartkitWidget[T][key]; } & {
|
|
18
17
|
ref?: React.ForwardedRef<ChartKitRef | undefined> | undefined;
|
|
19
18
|
}) => ReturnType<typeof ChartKitComponent>;
|
|
@@ -31,12 +31,11 @@ const ChartKitComponent = (props) => {
|
|
|
31
31
|
},
|
|
32
32
|
}), []);
|
|
33
33
|
return (React.createElement(React.Suspense, { fallback: React.createElement(Loader, null) },
|
|
34
|
-
React.createElement("div", { className: b({ mobile: isMobile }) },
|
|
34
|
+
React.createElement("div", { className: b({ mobile: isMobile }, 'chartkit-theme_common') },
|
|
35
35
|
React.createElement(ChartComponent, Object.assign({ ref: widgetRef, id: id, lang: lang, data: data, onLoad: onLoad }, restProps)))));
|
|
36
36
|
};
|
|
37
|
-
const ChartKitComponentWithErrorBoundary = React.forwardRef((props, ref)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
React.createElement(ChartKitComponent, Object.assign({ instanceRef: ref }, componentProps))));
|
|
37
|
+
const ChartKitComponentWithErrorBoundary = React.forwardRef(function ChartKitComponentWithErrorBoundary(props, ref) {
|
|
38
|
+
return (React.createElement(ErrorBoundary, { onError: props.onError },
|
|
39
|
+
React.createElement(ChartKitComponent, Object.assign({ instanceRef: ref }, props))));
|
|
41
40
|
}) /* https://stackoverflow.com/a/58473012 */;
|
|
42
41
|
export const ChartKit = typedMemo(ChartKitComponentWithErrorBoundary);
|
|
@@ -3,9 +3,69 @@
|
|
|
3
3
|
"tooltip-sum": "Sum",
|
|
4
4
|
"tooltip-rest": "Rest"
|
|
5
5
|
},
|
|
6
|
+
"chartkit": {
|
|
7
|
+
"error": "Error",
|
|
8
|
+
"legend-series-hide": "Hide all lines",
|
|
9
|
+
"legend-series-show": "Show all lines",
|
|
10
|
+
|
|
11
|
+
"tooltip-point-format-size": "Size",
|
|
12
|
+
"tooltip-sum": "Sum",
|
|
13
|
+
"tooltip-rest": "Rest",
|
|
14
|
+
|
|
15
|
+
"error-incorrect-key-value-intro": "Incorrect notation of an object passed to",
|
|
16
|
+
"error-incorrect-key": ", object keys must be convertible to integer",
|
|
17
|
+
"error-incorrect-value": ", object values must be a string or a function which returns a string"
|
|
18
|
+
},
|
|
19
|
+
"chartkit-table": {
|
|
20
|
+
"message-no-data": "No data",
|
|
21
|
+
"paginator-rows": "Rows"
|
|
22
|
+
},
|
|
23
|
+
"chartkit-ymap-legend": {
|
|
24
|
+
"label-more": "Show more {{count}}",
|
|
25
|
+
"label-hide": "Hide",
|
|
26
|
+
"label-heatmap": "Heatmap"
|
|
27
|
+
},
|
|
6
28
|
"error": {
|
|
7
29
|
"label_no-data": "No data",
|
|
8
30
|
"label_unknown-plugin": "Unknown plugin type \"{{type}}\"",
|
|
9
31
|
"label_unknown-error": "Unknown error"
|
|
32
|
+
},
|
|
33
|
+
"highcharts": {
|
|
34
|
+
"reset-zoom-title": "Reset zoom",
|
|
35
|
+
|
|
36
|
+
"decimal-point": ".",
|
|
37
|
+
"thousands-sep": " ",
|
|
38
|
+
|
|
39
|
+
"Mon": "Mon",
|
|
40
|
+
"Tue": "Tue",
|
|
41
|
+
"Wed": "Wed",
|
|
42
|
+
"Thu": "Thu",
|
|
43
|
+
"Fri": "Fri",
|
|
44
|
+
"Sat": "Sat",
|
|
45
|
+
"Sun": "Sun",
|
|
46
|
+
"Jan": "Jan",
|
|
47
|
+
|
|
48
|
+
"January": "January",
|
|
49
|
+
"Feb": "Feb",
|
|
50
|
+
"February": "February",
|
|
51
|
+
"Mar": "Mar",
|
|
52
|
+
"March": "March",
|
|
53
|
+
"Apr": "Apr",
|
|
54
|
+
"April": "April",
|
|
55
|
+
"May": "May",
|
|
56
|
+
"Jun": "Jun",
|
|
57
|
+
"June": "June",
|
|
58
|
+
"Jul": "Jul",
|
|
59
|
+
"July": "July",
|
|
60
|
+
"Aug": "Aug",
|
|
61
|
+
"August": "August",
|
|
62
|
+
"Sep": "Sep",
|
|
63
|
+
"September": "September",
|
|
64
|
+
"Oct": "Oct",
|
|
65
|
+
"October": "October",
|
|
66
|
+
"Nov": "Nov",
|
|
67
|
+
"November": "November",
|
|
68
|
+
"Dec": "Dec",
|
|
69
|
+
"December": "December"
|
|
10
70
|
}
|
|
11
71
|
}
|
|
@@ -3,9 +3,71 @@
|
|
|
3
3
|
"tooltip-sum": "Сумма",
|
|
4
4
|
"tooltip-rest": "Остальные"
|
|
5
5
|
},
|
|
6
|
+
"chartkit": {
|
|
7
|
+
"error": "Ошибка",
|
|
8
|
+
"legend-series-hide": "Скрыть все линии",
|
|
9
|
+
"legend-series-show": "Показать все линии",
|
|
10
|
+
|
|
11
|
+
"loading": "Загрузка",
|
|
12
|
+
|
|
13
|
+
"tooltip-point-format-size": "Размер",
|
|
14
|
+
"tooltip-sum": "Сумма",
|
|
15
|
+
"tooltip-rest": "Остальные",
|
|
16
|
+
|
|
17
|
+
"error-incorrect-key-value-intro": "Некорректный формат объекта переданного как значение в",
|
|
18
|
+
"error-incorrect-key": ", ключи объекта должны быть преобразуемы в целое число",
|
|
19
|
+
"error-incorrect-value": ", значением объекта может быть либо строка, либо функция возвращающая строку"
|
|
20
|
+
},
|
|
21
|
+
"chartkit-table": {
|
|
22
|
+
"message-no-data": "Нет данных",
|
|
23
|
+
"paginator-rows": "Строки"
|
|
24
|
+
},
|
|
25
|
+
"chartkit-ymap-legend": {
|
|
26
|
+
"label-more": "Показать ещё {{count}}",
|
|
27
|
+
"label-hide": "Свернуть",
|
|
28
|
+
"label-heatmap": "Тепловая карта"
|
|
29
|
+
},
|
|
6
30
|
"error": {
|
|
7
31
|
"label_no-data": "Нет данных",
|
|
8
32
|
"label_unknown-plugin": "Неизвестный тип плагина \"{{type}}\"",
|
|
9
33
|
"label_unknown-error": "Неизвестная ошибка"
|
|
34
|
+
},
|
|
35
|
+
"highcharts": {
|
|
36
|
+
"reset-zoom-title": "Сбросить увеличение",
|
|
37
|
+
|
|
38
|
+
"decimal-point": ",",
|
|
39
|
+
"thousands-sep": " ",
|
|
40
|
+
|
|
41
|
+
"Mon": "Пн",
|
|
42
|
+
"Tue": "Вт",
|
|
43
|
+
"Wed": "Ср",
|
|
44
|
+
"Thu": "Чт",
|
|
45
|
+
"Fri": "Пт",
|
|
46
|
+
"Sat": "Сб",
|
|
47
|
+
"Sun": "Вс",
|
|
48
|
+
"Jan": "Янв",
|
|
49
|
+
|
|
50
|
+
"January": "Январь",
|
|
51
|
+
"Feb": "Фев",
|
|
52
|
+
"February": "Февраль",
|
|
53
|
+
"Mar": "Мар",
|
|
54
|
+
"March": "Март",
|
|
55
|
+
"Apr": "Апр",
|
|
56
|
+
"April": "Апрель",
|
|
57
|
+
"May": "Май",
|
|
58
|
+
"Jun": "Июн",
|
|
59
|
+
"June": "Июнь",
|
|
60
|
+
"Jul": "Июл",
|
|
61
|
+
"July": "Июль",
|
|
62
|
+
"Aug": "Авг",
|
|
63
|
+
"August": "Август",
|
|
64
|
+
"Sep": "Сен",
|
|
65
|
+
"September": "Сентябрь",
|
|
66
|
+
"Oct": "Окт",
|
|
67
|
+
"October": "Октябрь",
|
|
68
|
+
"Nov": "Ноя",
|
|
69
|
+
"November": "Ноябрь",
|
|
70
|
+
"Dec": "Дек",
|
|
71
|
+
"December": "Декабрь"
|
|
10
72
|
}
|
|
11
73
|
}
|
|
@@ -2,6 +2,7 @@ export const CHARTKIT_ERROR_CODE = {
|
|
|
2
2
|
NO_DATA: 'ERR.CK.NO_DATA',
|
|
3
3
|
UNKNOWN: 'ERR.CK.UNKNOWN_ERROR',
|
|
4
4
|
UNKNOWN_PLUGIN: 'ERR.CK.UNKNOWN_PLUGIN',
|
|
5
|
+
TOO_MANY_LINES: 'ERR.CK.TOO_MANY_LINES',
|
|
5
6
|
};
|
|
6
7
|
export class ChartKitError extends Error {
|
|
7
8
|
constructor({ originalError, message, code = CHARTKIT_ERROR_CODE.UNKNOWN, } = {}) {
|
|
@@ -6,7 +6,7 @@ const resetSettings = () => settings.set({
|
|
|
6
6
|
describe('libs/settings', () => {
|
|
7
7
|
it('Default locale should be equal DEFAULT_LOCALE_SPECIFICATION', () => {
|
|
8
8
|
const result = settings.get('locale');
|
|
9
|
-
expect(result).
|
|
9
|
+
expect(result).toStrictEqual(DEFAULT_LOCALE_SPECIFICATION);
|
|
10
10
|
});
|
|
11
11
|
it('Default lang should be equal to en', () => {
|
|
12
12
|
const result = settings.get('lang');
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
|
-
import type { ChartKitPlugin, ChartKitLang } from '../../types';
|
|
3
|
-
|
|
2
|
+
import type { ChartKitPlugin, ChartKitLang, ChartKitHolidays } from '../../types';
|
|
3
|
+
interface Settings {
|
|
4
4
|
plugins: ChartKitPlugin[];
|
|
5
5
|
lang: ChartKitLang;
|
|
6
6
|
locale?: moment.LocaleSpecification;
|
|
7
|
-
|
|
7
|
+
extra?: {
|
|
8
|
+
holidays?: ChartKitHolidays;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
8
11
|
declare type SettingKey = keyof Settings;
|
|
9
12
|
export declare const DEFAULT_LOCALE_SPECIFICATION: moment.LocaleSpecification;
|
|
10
13
|
declare class ChartKitSettings {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import merge from 'lodash/merge';
|
|
2
4
|
import { configure } from '@gravity-ui/uikit';
|
|
3
5
|
import { i18nFactory } from '../../i18n';
|
|
4
6
|
export const DEFAULT_LOCALE_SPECIFICATION = { week: { dow: 1, doy: 7 } };
|
|
@@ -27,7 +29,7 @@ class ChartKitSettings {
|
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
get(key) {
|
|
30
|
-
return this.settings
|
|
32
|
+
return get(this.settings, key);
|
|
31
33
|
}
|
|
32
34
|
set(updates) {
|
|
33
35
|
const filteredUpdates = removeUndefinedValues(updates);
|
|
@@ -36,7 +38,7 @@ class ChartKitSettings {
|
|
|
36
38
|
const locale = filteredUpdates.locale || this.get('locale');
|
|
37
39
|
updateLocale({ lang, locale });
|
|
38
40
|
}
|
|
39
|
-
this.settings =
|
|
41
|
+
this.settings = merge(this.settings, filteredUpdates);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
export const settings = new ChartKitSettings();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '@gravity-ui/uikit';
|
|
3
|
+
import { settings } from '../../../libs';
|
|
4
|
+
import { HighchartsPlugin } from '../..';
|
|
5
|
+
import { ChartKit } from '../../../components/ChartKit';
|
|
6
|
+
import { data } from './mocks/area-range';
|
|
7
|
+
import holidays from './mocks/holidays';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Plugins/Highcharts/AreaRange',
|
|
10
|
+
component: ChartKit,
|
|
11
|
+
};
|
|
12
|
+
const Template = () => {
|
|
13
|
+
const [shown, setShown] = React.useState(false);
|
|
14
|
+
const chartkitRef = React.useRef();
|
|
15
|
+
if (!shown) {
|
|
16
|
+
settings.set({ plugins: [HighchartsPlugin], extra: { holidays } });
|
|
17
|
+
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
18
|
+
}
|
|
19
|
+
return (React.createElement("div", { style: { height: 300, width: '100%' } },
|
|
20
|
+
React.createElement(ChartKit, { ref: chartkitRef, id: "1", type: "highcharts", data: data })));
|
|
21
|
+
};
|
|
22
|
+
export const AreaRange = Template.bind({});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '@gravity-ui/uikit';
|
|
3
|
+
import { settings } from '../../../libs';
|
|
4
|
+
import { HighchartsPlugin } from '../../../plugins';
|
|
5
|
+
import { ChartKit } from '../../../components/ChartKit';
|
|
6
|
+
import { data } from './mocks/line';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Plugins/Highcharts/Line',
|
|
9
|
+
component: ChartKit,
|
|
10
|
+
};
|
|
11
|
+
const Template = () => {
|
|
12
|
+
const [shown, setShown] = React.useState(false);
|
|
13
|
+
const chartkitRef = React.useRef();
|
|
14
|
+
if (!shown) {
|
|
15
|
+
settings.set({ plugins: [HighchartsPlugin] });
|
|
16
|
+
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
17
|
+
}
|
|
18
|
+
return (React.createElement("div", { style: { height: 300, width: '100%' } },
|
|
19
|
+
React.createElement(ChartKit, { ref: chartkitRef, id: "1", type: "highcharts", data: data, hoistConfigError: false, onError: () => console.log('onError invoked') })));
|
|
20
|
+
};
|
|
21
|
+
export const Line = Template.bind({});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const data = {
|
|
2
|
+
data: {
|
|
3
|
+
graphs: [
|
|
4
|
+
{
|
|
5
|
+
name: 'Temperatures',
|
|
6
|
+
data: [
|
|
7
|
+
[1246406400000, 10.4, 17],
|
|
8
|
+
[1246492800000, 10.3, 28.6],
|
|
9
|
+
[1246579200000, 14.8, 18.4],
|
|
10
|
+
[1246665600000, 11.5, 25.8],
|
|
11
|
+
[1246752000000, 11.1, 24.4],
|
|
12
|
+
[1246838400000, 17.7, 19.6],
|
|
13
|
+
[1246924800000, 15.1, 18.1],
|
|
14
|
+
[1247011200000, 15.1, 27.2],
|
|
15
|
+
[1247097600000, 17, 17.5],
|
|
16
|
+
[1247184000000, 12.6, 18.5],
|
|
17
|
+
[1247270400000, 12.2, 26],
|
|
18
|
+
[1247356800000, 15.9, 22.9],
|
|
19
|
+
[1247443200000, 17.1, 18.1],
|
|
20
|
+
[1247529600000, 13.3, 24.2],
|
|
21
|
+
[1247616000000, 17, 28.1],
|
|
22
|
+
[1247702400000, 16.2, 22.6],
|
|
23
|
+
[1247788800000, 10.6, 19],
|
|
24
|
+
[1247875200000, 11.3, 19.7],
|
|
25
|
+
[1247961600000, 14.1, 24.6],
|
|
26
|
+
[1248048000000, 14.2, 22.5],
|
|
27
|
+
[1248134400000, 14.1, 28.5],
|
|
28
|
+
[1248220800000, 14, 27],
|
|
29
|
+
[1248307200000, 10.2, 20.6],
|
|
30
|
+
[1248393600000, 13.1, 29.9],
|
|
31
|
+
[1248480000000, 13.7, 21.1],
|
|
32
|
+
[1248566400000, 15, 28.6],
|
|
33
|
+
[1248652800000, 12, 17.5],
|
|
34
|
+
[1248739200000, 17.8, 24.4],
|
|
35
|
+
[1248825600000, 11.7, 25.9],
|
|
36
|
+
[1248912000000, 13.6, 25.6],
|
|
37
|
+
[1248998400000, 17.3, 22.2],
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
config: {
|
|
43
|
+
hideHolidays: false,
|
|
44
|
+
normalizeDiv: false,
|
|
45
|
+
normalizeSub: false,
|
|
46
|
+
},
|
|
47
|
+
libraryConfig: {
|
|
48
|
+
chart: {
|
|
49
|
+
type: 'arearange',
|
|
50
|
+
},
|
|
51
|
+
title: {
|
|
52
|
+
text: 'Temperature variation by day',
|
|
53
|
+
},
|
|
54
|
+
xAxis: {
|
|
55
|
+
type: 'datetime',
|
|
56
|
+
},
|
|
57
|
+
tooltip: {
|
|
58
|
+
valueSuffix: '°C',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|