@gravity-ui/chartkit
Advanced tools
Comparing version 2.0.0 to 2.1.0
import React from 'react'; | ||
import { i18n } from '../../i18n'; | ||
export const ErrorView = ({ error }) => { | ||
const message = error.message || i18n('error', 'label_unknown-error'); | ||
const code = 'code' in error && error.code; | ||
const message = error.message || code || i18n('error', 'label_unknown-error'); | ||
return React.createElement("div", null, message); | ||
}; |
import React from 'react'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
import { data } from '../mocks/area-range'; | ||
import { data } from '../../mocks/area-range'; | ||
import { ChartStory } from '../components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
import React from 'react'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
import { data } from '../mocks/area-stacked'; | ||
import { data } from '../../mocks/area-stacked'; | ||
import { ChartStory } from '../components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
import React from 'react'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
import { data } from '../mocks/column-hor-stacked'; | ||
import { data } from '../../mocks/column-hor-stacked'; | ||
import { ChartStory } from '../components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
import React from 'react'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
import { data } from '../mocks/column-ver'; | ||
import { data } from '../../mocks/column-ver'; | ||
import { ChartStory } from '../components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
import React from 'react'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
import { data } from '../mocks/column-ver-stacked'; | ||
import { data } from '../../mocks/column-ver-stacked'; | ||
import { ChartStory } from '../components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
import React from 'react'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
import { data } from '../mocks/combo-chart-with-same-legend-titles'; | ||
import { data } from '../../mocks/combo-chart-with-same-legend-titles'; | ||
import { ChartStory } from '../components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
import React from 'react'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
import { ChartStory } from '../components/ChartStory'; | ||
import { data } from '../mocks/complex'; | ||
import { data } from '../../mocks/complex'; | ||
export default { | ||
@@ -6,0 +6,0 @@ title: 'Plugins/Highcharts/TwoAxis', |
@@ -5,3 +5,3 @@ import React from 'react'; | ||
import { HighchartsPlugin } from '../../index'; | ||
import holidays from '../mocks/holidays'; | ||
import holidays from '../../mocks/holidays'; | ||
import { ChartKit } from '../../../../components/ChartKit'; | ||
@@ -8,0 +8,0 @@ const DEFAULT_STORY_HEIGHT = '300px'; |
import React from 'react'; | ||
import { ChartKit } from '../../../components/ChartKit'; | ||
import { data } from './mocks/line'; | ||
import { data } from '../mocks/line'; | ||
import { ChartStory } from './components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
import React from 'react'; | ||
import { ChartKit } from '../../../components/ChartKit'; | ||
import { data } from './mocks/pie'; | ||
import { data } from '../mocks/pie'; | ||
import { ChartStory } from './components/ChartStory'; | ||
@@ -5,0 +5,0 @@ export default { |
@@ -29,1 +29,2 @@ export declare enum HighchartsType { | ||
} | ||
export declare const DEFAULT_LINES_LIMIT = 50; |
@@ -31,1 +31,2 @@ export var HighchartsType; | ||
})(NavigatorLinesMode || (NavigatorLinesMode = {})); | ||
export const DEFAULT_LINES_LIMIT = 50; |
import moment from 'moment'; | ||
import lodashMin from 'lodash/min'; | ||
import { ChartKitError, CHARTKIT_ERROR_CODE } from '../../../../libs'; | ||
import { DEFAULT_LINES_LIMIT } from './constants'; | ||
function prepareValue(value, firstValue, options) { | ||
@@ -86,2 +87,3 @@ if (value === null) { | ||
export function prepareData(data, options, holidays) { | ||
const limit = options.linesLimit || DEFAULT_LINES_LIMIT; | ||
if (!data || | ||
@@ -95,3 +97,3 @@ (typeof data === 'object' && !Object.keys(data).length) || | ||
if (data.graphs) { | ||
if (data.graphs.length > 50 && !options.withoutLineLimit) { | ||
if (data.graphs.length > limit && !options.withoutLineLimit) { | ||
throw new ChartKitError({ code: CHARTKIT_ERROR_CODE.TOO_MANY_LINES }); | ||
@@ -98,0 +100,0 @@ } |
@@ -30,2 +30,3 @@ import type { Highcharts } from './lib'; | ||
* Percentage value displayed in tooltip. | ||
* | ||
* Relevant in case of initialized [stacking](https://api.highcharts.com/highcharts/plotOptions.column.stacking) property only. | ||
@@ -37,4 +38,15 @@ */ | ||
normalizeSub?: boolean; | ||
/** | ||
* Used to ignore `linesLimit` option | ||
*/ | ||
withoutLineLimit?: boolean; | ||
precision?: number; | ||
/** | ||
* Lines (series) count limit. | ||
* | ||
* If you have lines more than `limit`, your chart will throw an error 'ERR.CK.TOO_MANY_LINES'. | ||
* | ||
* Ingnored in case of `withoutLineLimit: true`. Default: 50. | ||
*/ | ||
linesLimit?: number; | ||
title?: string; | ||
@@ -41,0 +53,0 @@ subtitle?: string; |
# Changelog | ||
## [2.1.0](https://github.com/gravity-ui/chartkit/compare/v2.0.0...v2.1.0) (2023-03-13) | ||
### Features | ||
* **Highcharts:** add linesLimit property to HighchartsWidgetData.config ([#135](https://github.com/gravity-ui/chartkit/issues/135)) ([91d16a3](https://github.com/gravity-ui/chartkit/commit/91d16a32aad00fb683c68f3f39a6477f14f18c33)) | ||
## [2.0.0](https://github.com/gravity-ui/chartkit/compare/v1.6.7...v2.0.0) (2023-03-09) | ||
@@ -8,3 +15,2 @@ | ||
* update uikit up to 4 | ||
* update uikit up to 4 ([#133](https://github.com/gravity-ui/chartkit/issues/133)) | ||
@@ -14,3 +20,2 @@ | ||
* update uikit up to 4 ([8ae0c8d](https://github.com/gravity-ui/chartkit/commit/8ae0c8d179273a448de8f670dfe1b3f2314c0523)) | ||
* update uikit up to 4 ([#133](https://github.com/gravity-ui/chartkit/issues/133)) ([8ae0c8d](https://github.com/gravity-ui/chartkit/commit/8ae0c8d179273a448de8f670dfe1b3f2314c0523)) | ||
@@ -17,0 +22,0 @@ |
{ | ||
"name": "@gravity-ui/chartkit", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "React component used to render charts based on any sources you need", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
915584
291
26092
1