@oliasoft-open-source/charts-library 6.1.0 → 7.0.0-beta-1
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 +1266 -15
- package/dist/index.js +17 -14
- package/package.json +12 -11
- package/dist/src/components/bar-chart/bar-chart-const.d.ts +0 -2
- package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +0 -3
- package/dist/src/components/bar-chart/bar-chart.d.ts +0 -3
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +0 -146
- package/dist/src/components/bar-chart/utils/get-bar-chart-data-labels.d.ts +0 -10
- package/dist/src/components/bar-chart/utils/get-bar-chart-scales.d.ts +0 -4
- package/dist/src/components/bar-chart/utils/get-bar-chart-tooltips.d.ts +0 -6
- package/dist/src/components/bar-chart/utils/use-bar-chart-config.d.ts +0 -13
- package/dist/src/components/bar-chart/utils/use-bar-chart-options.d.ts +0 -54
- package/dist/src/components/common/common.interface.d.ts +0 -273
- package/dist/src/components/common/controls-portal.d.ts +0 -7
- package/dist/src/components/common/enums.d.ts +0 -89
- package/dist/src/components/common/helpers/add-transparency/add-transparency.d.ts +0 -1
- package/dist/src/components/common/helpers/callout-helpers/callout-helpers.d.ts +0 -25
- package/dist/src/components/common/helpers/chart-border-plugin.d.ts +0 -16
- package/dist/src/components/common/helpers/chart-consts.d.ts +0 -39
- package/dist/src/components/common/helpers/chart-utils.d.ts +0 -86
- package/dist/src/components/common/helpers/container.d.ts +0 -18
- package/dist/src/components/common/helpers/custom-format-number.d.ts +0 -1
- package/dist/src/components/common/helpers/download-pgn.d.ts +0 -3
- package/dist/src/components/common/helpers/get-cartesian-scale-options.d.ts +0 -28
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +0 -139
- package/dist/src/components/common/helpers/get-chart-from-ctx.d.ts +0 -1
- package/dist/src/components/common/helpers/get-custom-legend-plugin-example.d.ts +0 -6
- package/dist/src/components/common/helpers/get-draggableData.d.ts +0 -18
- package/dist/src/components/common/helpers/get-grouped-color-scheme/get-grouped-color-scheme.d.ts +0 -1
- package/dist/src/components/common/helpers/input-normalizers.d.ts +0 -15
- package/dist/src/components/common/helpers/range/estimate-data-series-have-close-values.d.ts +0 -8
- package/dist/src/components/common/helpers/range/range.d.ts +0 -33
- package/dist/src/components/common/helpers/text.d.ts +0 -1
- package/dist/src/components/common/helpers/to-annotation.d.ts +0 -4
- package/dist/src/components/common/hooks/use-generated-labels.d.ts +0 -4
- package/dist/src/components/common/hooks/use-legend-state.d.ts +0 -28
- package/dist/src/components/common/hooks/use-legend.d.ts +0 -4
- package/dist/src/components/common/hooks/use-update-annotations.d.ts +0 -4
- package/dist/src/components/common/legend-component/legend-dropzone.d.ts +0 -3
- package/dist/src/components/common/legend-component/legend-interface.d.ts +0 -47
- package/dist/src/components/common/legend-component/legend-item/LegendItemLine.d.ts +0 -5
- package/dist/src/components/common/legend-component/legend-item/legend-item.d.ts +0 -3
- package/dist/src/components/common/legend-component/legend-panel.d.ts +0 -3
- package/dist/src/components/common/legend-component/legend.d.ts +0 -3
- package/dist/src/components/common/legend-component/state/legend-action-types.d.ts +0 -3
- package/dist/src/components/common/legend-component/state/legend-context.d.ts +0 -14
- package/dist/src/components/common/legend-component/state/legend-state-reducer.d.ts +0 -30
- package/dist/src/components/common/legend-component/utils/create-style-object.d.ts +0 -27
- package/dist/src/components/common/legend-component/utils/get-generated-labels.d.ts +0 -2
- package/dist/src/components/common/plugins/annotation-dragger-plugin/annotation-dragger-plugin.d.ts +0 -15
- package/dist/src/components/common/plugins/annotation-dragger-plugin/annotation-position-storage.d.ts +0 -7
- package/dist/src/components/common/plugins/annotation-dragger-plugin/enums.d.ts +0 -21
- package/dist/src/components/common/plugins/annotation-dragger-plugin/event-helpers.d.ts +0 -6
- package/dist/src/components/common/plugins/annotation-dragger-plugin/helpers.d.ts +0 -53
- package/dist/src/components/common/plugins/annotation-dragger-plugin/point-annotation-label.d.ts +0 -5
- package/dist/src/components/common/plugins/ellipsis-annotation-plugin/compute-ellipse-geometry.d.ts +0 -9
- package/dist/src/components/common/plugins/ellipsis-annotation-plugin/ellipsis-annotation-plugin.d.ts +0 -18
- package/dist/src/components/common/plugins/gradient-background-plugin/enums.d.ts +0 -10
- package/dist/src/components/common/plugins/gradient-background-plugin/gradient-background-plugin.d.ts +0 -2
- package/dist/src/components/line-chart/constants/default-translations.d.ts +0 -25
- package/dist/src/components/line-chart/constants/line-chart-consts.d.ts +0 -13
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +0 -57
- package/dist/src/components/line-chart/controls/axes-options/axes-options.d.ts +0 -6
- package/dist/src/components/line-chart/controls/axes-options/axes-validation.d.ts +0 -8
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +0 -19
- package/dist/src/components/line-chart/controls/controls.d.ts +0 -3
- package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +0 -14
- package/dist/src/components/line-chart/controls/drag-options.d.ts +0 -23
- package/dist/src/components/line-chart/controls/line-options.d.ts +0 -19
- package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +0 -32
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +0 -19
- package/dist/src/components/line-chart/hooks/use-chart-plugins.d.ts +0 -7
- package/dist/src/components/line-chart/hooks/use-chart-state.d.ts +0 -12
- package/dist/src/components/line-chart/hooks/use-toggle-handler.d.ts +0 -12
- package/dist/src/components/line-chart/initialize/config.d.ts +0 -12
- package/dist/src/components/line-chart/initialize/initialize-line-chart.d.ts +0 -12
- package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +0 -3
- package/dist/src/components/line-chart/line-chart.d.ts +0 -3
- package/dist/src/components/line-chart/line-chart.interface.d.ts +0 -241
- package/dist/src/components/line-chart/plugins/callout-plugin/callout-plugin.d.ts +0 -11
- package/dist/src/components/line-chart/plugins/callout-plugin/helpers.d.ts +0 -42
- package/dist/src/components/line-chart/plugins/chart-area-text-plugin.d.ts +0 -17
- package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +0 -8
- package/dist/src/components/line-chart/plugins/line-markers-plugin/draw.d.ts +0 -39
- package/dist/src/components/line-chart/plugins/line-markers-plugin/line-markers-plugin.d.ts +0 -10
- package/dist/src/components/line-chart/plugins/line-markers-plugin/types.d.ts +0 -109
- package/dist/src/components/line-chart/plugins/line-markers-plugin/utils.d.ts +0 -40
- package/dist/src/components/line-chart/plugins/plugin-constants.d.ts +0 -11
- package/dist/src/components/line-chart/plugins/plugins.interface.d.ts +0 -9
- package/dist/src/components/line-chart/state/action-types.d.ts +0 -12
- package/dist/src/components/line-chart/state/helpers.d.ts +0 -13
- package/dist/src/components/line-chart/state/initial-state.d.ts +0 -11
- package/dist/src/components/line-chart/state/line-chart-reducer.d.ts +0 -2
- package/dist/src/components/line-chart/state/manage-state-in-local-storage.d.ts +0 -15
- package/dist/src/components/line-chart/state/state.interfaces.d.ts +0 -26
- package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +0 -2
- package/dist/src/components/line-chart/utils/axis-scales/axis-scales.d.ts +0 -18
- package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.d.ts +0 -12
- package/dist/src/components/line-chart/utils/datalabels-alignment/datalabels-alignment.interface.d.ts +0 -20
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +0 -8
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +0 -11
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +0 -6
- package/dist/src/components/line-chart/utils/enums.d.ts +0 -4
- package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +0 -8
- package/dist/src/components/line-chart/utils/get-annotations-data.d.ts +0 -1
- package/dist/src/components/line-chart/utils/get-axes-data-from-metasets.d.ts +0 -1
- package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +0 -9
- package/dist/src/components/line-chart/utils/get-axis-range-by-type.d.ts +0 -10
- package/dist/src/components/line-chart/utils/get-generated-labels.d.ts +0 -2
- package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +0 -16
- package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +0 -5
- package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +0 -30
- package/dist/src/components/line-chart/utils/line-chart-utils.d.ts +0 -24
- package/dist/src/components/line-chart/utils/translations/get-translations.d.ts +0 -8
- package/dist/src/components/pie-chart/pie-chart-defalut-props.interface.d.ts +0 -50
- package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +0 -3
- package/dist/src/components/pie-chart/pie-chart.d.ts +0 -3
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +0 -85
- package/dist/src/components/pie-chart/use-pie-chart-config.d.ts +0 -42
- package/dist/src/components/scatter-chart/hooks/use-scatter-chart-config.d.ts +0 -69
- package/dist/src/components/scatter-chart/scatter-chart-default-props.interface.d.ts +0 -73
- package/dist/src/components/scatter-chart/scatter-chart-get-default-props.d.ts +0 -4
- package/dist/src/components/scatter-chart/scatter-chart.d.ts +0 -3
- package/dist/src/components/scatter-chart/scatter-chart.interface.d.ts +0 -111
- package/dist/src/components/scatter-chart/utils/get-scales-config.d.ts +0 -5
- package/dist/src/components/scatter-chart/utils/get-tooltip-config.d.ts +0 -21
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { displayNumber, isCloseTo, round, roundByMagnitude, toNum } from "@olias
|
|
|
7
7
|
import cx from "classnames";
|
|
8
8
|
import { cloneDeep, debounce, defaultTo, find, findIndex, get, has, isArray, isEmpty, isFinite as isFinite$1, isNil, isNumber, isObject, isString, map, noop, set, some, startCase } from "es-toolkit/compat";
|
|
9
9
|
import { produce } from "immer";
|
|
10
|
-
import { Button, ButtonGroup, Field, Flex, Icon, InputGroup, InputGroupAddon, Menu, NumberInput, Popover, Portal, Select, Spacer, Text, Tooltip } from "@oliasoft-open-source/react-ui-library";
|
|
10
|
+
import { Button, ButtonGroup, Color, Field, Flex, Icon, InputGroup, InputGroupAddon, Menu, NumberInput, Popover, Portal, Select, Spacer, Text, Tooltip } from "@oliasoft-open-source/react-ui-library";
|
|
11
11
|
import { useMeasure } from "react-use";
|
|
12
12
|
import { TbArrowsMove, TbBan, TbCircleFilled, TbHandStop, TbList, TbRuler, TbSquareFilled, TbX, TbZoomIn } from "react-icons/tb";
|
|
13
13
|
import { toPng } from "html-to-image";
|
|
@@ -526,9 +526,9 @@ function functionParse(str) {
|
|
|
526
526
|
if (str.charAt(0) === "r") return rgbParse(str);
|
|
527
527
|
return hueParse(str);
|
|
528
528
|
}
|
|
529
|
-
var Color = class Color {
|
|
529
|
+
var Color$1 = class Color$1 {
|
|
530
530
|
constructor(input) {
|
|
531
|
-
if (input instanceof Color) return input;
|
|
531
|
+
if (input instanceof Color$1) return input;
|
|
532
532
|
const type = typeof input;
|
|
533
533
|
let v;
|
|
534
534
|
if (type === "object") v = fromObject(input);
|
|
@@ -579,7 +579,7 @@ var Color = class Color {
|
|
|
579
579
|
return this;
|
|
580
580
|
}
|
|
581
581
|
clone() {
|
|
582
|
-
return new Color(this.rgb);
|
|
582
|
+
return new Color$1(this.rgb);
|
|
583
583
|
}
|
|
584
584
|
alpha(a) {
|
|
585
585
|
this._rgb.a = n2b(a);
|
|
@@ -1261,10 +1261,10 @@ function isPatternOrGradient(value) {
|
|
|
1261
1261
|
return false;
|
|
1262
1262
|
}
|
|
1263
1263
|
function color(value) {
|
|
1264
|
-
return isPatternOrGradient(value) ? value : new Color(value);
|
|
1264
|
+
return isPatternOrGradient(value) ? value : new Color$1(value);
|
|
1265
1265
|
}
|
|
1266
1266
|
function getHoverColor(value) {
|
|
1267
|
-
return isPatternOrGradient(value) ? value : new Color(value).saturate(.5).darken(.1).hexString();
|
|
1267
|
+
return isPatternOrGradient(value) ? value : new Color$1(value).saturate(.5).darken(.1).hexString();
|
|
1268
1268
|
}
|
|
1269
1269
|
var numbers = [
|
|
1270
1270
|
"x",
|
|
@@ -12176,7 +12176,7 @@ var TimeSeriesScale = class extends TimeScale {
|
|
|
12176
12176
|
}
|
|
12177
12177
|
};
|
|
12178
12178
|
//#endregion
|
|
12179
|
-
//#region node_modules/.pnpm/react-chartjs-2@5.3.1_chart.js@4.5.1_react@
|
|
12179
|
+
//#region node_modules/.pnpm/react-chartjs-2@5.3.1_chart.js@4.5.1_react@19.2.8/node_modules/react-chartjs-2/dist/index.js
|
|
12180
12180
|
var defaultDatasetIdKey = "label";
|
|
12181
12181
|
function reforwardRef(ref, value) {
|
|
12182
12182
|
if (typeof ref === "function") ref(value);
|
|
@@ -20105,7 +20105,7 @@ var validateAxes = (axes) => {
|
|
|
20105
20105
|
//#region src/components/line-chart/state/helpers.ts
|
|
20106
20106
|
var RANGE_GAP = 1;
|
|
20107
20107
|
var getInitAxes = ({ chartRef, state }) => {
|
|
20108
|
-
const chart = chartRef
|
|
20108
|
+
const chart = chartRef.current;
|
|
20109
20109
|
if (!chart) return [];
|
|
20110
20110
|
const initScales = chart?.getInitialScaleBounds() ?? {};
|
|
20111
20111
|
return Object.entries(initScales).map(([id, { min = "", max = "" }]) => {
|
|
@@ -20387,7 +20387,7 @@ var Controls = ({ table, headerComponent, subheaderComponent, chartRef, state, o
|
|
|
20387
20387
|
],
|
|
20388
20388
|
trigger: "Component",
|
|
20389
20389
|
component: /* @__PURE__ */ jsx(Button, {
|
|
20390
|
-
colored:
|
|
20390
|
+
colored: Color.MUTED,
|
|
20391
20391
|
basic: true,
|
|
20392
20392
|
small: true,
|
|
20393
20393
|
round: true,
|
|
@@ -20402,7 +20402,7 @@ var Controls = ({ table, headerComponent, subheaderComponent, chartRef, state, o
|
|
|
20402
20402
|
children: /* @__PURE__ */ jsx(Button, {
|
|
20403
20403
|
small: true,
|
|
20404
20404
|
basic: true,
|
|
20405
|
-
colored:
|
|
20405
|
+
colored: Color.MUTED,
|
|
20406
20406
|
round: true,
|
|
20407
20407
|
icon: "download",
|
|
20408
20408
|
onClick: handleDownload
|
|
@@ -20416,7 +20416,7 @@ var Controls = ({ table, headerComponent, subheaderComponent, chartRef, state, o
|
|
|
20416
20416
|
children: /* @__PURE__ */ jsx(Button, {
|
|
20417
20417
|
small: true,
|
|
20418
20418
|
basic: true,
|
|
20419
|
-
colored:
|
|
20419
|
+
colored: Color.MUTED,
|
|
20420
20420
|
round: true,
|
|
20421
20421
|
icon: showTable ? "chart" : "table",
|
|
20422
20422
|
onClick: onToggleTable
|
|
@@ -24383,7 +24383,8 @@ var generateAnnotationLabels = (chart) => {
|
|
|
24383
24383
|
return Object.values(annotations);
|
|
24384
24384
|
};
|
|
24385
24385
|
var generatedLabels = (chart) => {
|
|
24386
|
-
|
|
24386
|
+
const generateLabels = chart.options.plugins?.legend?.labels?.generateLabels;
|
|
24387
|
+
return cloneDeep(generateLabels?.(chart)) ?? [];
|
|
24387
24388
|
};
|
|
24388
24389
|
var getGeneratedLabels = (chart) => {
|
|
24389
24390
|
const datasetLabels = generatedLabels(chart);
|
|
@@ -24467,7 +24468,7 @@ var LegendPanel = forwardRef(({ legendPosition, chartRef, isDragging, legendConf
|
|
|
24467
24468
|
const { state: legendState } = useLegend() ?? {};
|
|
24468
24469
|
const [legendEnabled, setLegendEnabled] = useState(legend?.display ?? true);
|
|
24469
24470
|
const items = useGeneratedLabels(chartRef, generatedDatasets);
|
|
24470
|
-
const style = createLegendStyle(legendPosition, chart);
|
|
24471
|
+
const style = createLegendStyle(legendPosition, chart ?? null);
|
|
24471
24472
|
return /* @__PURE__ */ jsxs("div", {
|
|
24472
24473
|
ref,
|
|
24473
24474
|
className: cx(legend_module_default.legend, !legendEnabled && legend_module_default.isHidden, isDragging && legend_module_default.isDragging),
|
|
@@ -24503,7 +24504,9 @@ var LegendDropZone = (legendDropZoneProps) => {
|
|
|
24503
24504
|
}));
|
|
24504
24505
|
const isActive = isOver && canDrop;
|
|
24505
24506
|
return /* @__PURE__ */ jsx("div", {
|
|
24506
|
-
ref:
|
|
24507
|
+
ref: (node) => {
|
|
24508
|
+
dropRef(node);
|
|
24509
|
+
},
|
|
24507
24510
|
className: cx(legend_module_default.dropzone, isActive && legend_module_default.isActive, position?.includes("left") && legend_module_default.left, position?.includes("right") && legend_module_default.right, position?.includes("top") && legend_module_default.top, position?.includes("bottom") && legend_module_default.bottom),
|
|
24508
24511
|
children: /* @__PURE__ */ jsx("div", {
|
|
24509
24512
|
className: legend_module_default.dropzonePlaceholder,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/charts-library",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-beta-1",
|
|
4
4
|
"description": "React Chart Library (based on Chart.js and react-chart-js-2)",
|
|
5
5
|
"homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
|
|
6
6
|
"bugs": {
|
|
@@ -41,15 +41,16 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@dnd-kit/sortable": "^10.0.0",
|
|
44
|
+
"@microsoft/api-extractor": "^7.59.0",
|
|
44
45
|
"@oliasoft-open-source/react-ui-library": "^7.2.0",
|
|
45
46
|
"@oliasoft-open-source/units": "^5.6.0",
|
|
46
|
-
"@storybook/addon-docs": "^10.
|
|
47
|
-
"@storybook/addon-themes": "^10.
|
|
48
|
-
"@storybook/react-vite": "^10.
|
|
47
|
+
"@storybook/addon-docs": "^10.5.10",
|
|
48
|
+
"@storybook/addon-themes": "^10.5.10",
|
|
49
|
+
"@storybook/react-vite": "^10.5.10",
|
|
49
50
|
"@types/node": "^22.15.17",
|
|
50
51
|
"@types/object-hash": "^3.0.6",
|
|
51
|
-
"@types/react": "^
|
|
52
|
-
"@types/react-dom": "^
|
|
52
|
+
"@types/react": "^19.2.18",
|
|
53
|
+
"@types/react-dom": "^19.2.5",
|
|
53
54
|
"@vitejs/plugin-react": "^6.1.0",
|
|
54
55
|
"@vitest/coverage-v8": "^4.1.11",
|
|
55
56
|
"classnames": "^2.5.1",
|
|
@@ -63,9 +64,9 @@
|
|
|
63
64
|
"normalize.css": "^8.0.1",
|
|
64
65
|
"oxfmt": "^0.64.0",
|
|
65
66
|
"oxlint": "^1.79.0",
|
|
66
|
-
"react": "^
|
|
67
|
-
"react-dom": "^
|
|
68
|
-
"storybook": "^10.
|
|
67
|
+
"react": "^19.2.8",
|
|
68
|
+
"react-dom": "^19.2.8",
|
|
69
|
+
"storybook": "^10.5.10",
|
|
69
70
|
"typescript": "^6.0.3",
|
|
70
71
|
"vite": "^8.2.2",
|
|
71
72
|
"vite-plugin-css-injected-by-js": "^5.0.2",
|
|
@@ -80,8 +81,8 @@
|
|
|
80
81
|
"classnames": "^2.5.1",
|
|
81
82
|
"es-toolkit": "^1",
|
|
82
83
|
"immer": "^9 || ^10",
|
|
83
|
-
"react": "^
|
|
84
|
-
"react-dom": "^
|
|
84
|
+
"react": "^19",
|
|
85
|
+
"react-dom": "^19"
|
|
85
86
|
},
|
|
86
87
|
"lint-staged": {
|
|
87
88
|
"*": [
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IBarChartProps, IBarDefaultProps, IBarOptionsInput } from './bar-chart.interface';
|
|
2
|
-
export declare const normalizeBarOptions: (options?: IBarOptionsInput) => IBarDefaultProps["options"];
|
|
3
|
-
export declare const getDefaultProps: (props: IBarChartProps) => IBarDefaultProps;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { ChartDataset } from 'chart.js';
|
|
2
|
-
import { DeepPartial, ICommonAdditionalAxesOptions, ICommonAnnotations, ICommonAnnotationsData, ICommonAxis, ICommonChartOptions, ICommonCustomLegend, ICommonData, ICommonDataset, ICommonDataValue, ICommonDragData, ICommonGraph, ICommonInteractions, ICommonLegend, ICommonOptions, ICommonScales, ICommonStyling, ICommonTooltip } from '../common/common.interface';
|
|
3
|
-
import { IChartGraph } from '../common/helpers/chart-utils';
|
|
4
|
-
import { ChartType } from '../common/enums';
|
|
5
|
-
export interface IBarStyling extends ICommonStyling {
|
|
6
|
-
squareAspectRatio?: boolean;
|
|
7
|
-
layoutPadding?: string | number | {
|
|
8
|
-
top: number;
|
|
9
|
-
bottom: number;
|
|
10
|
-
left: number;
|
|
11
|
-
right: number;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface IBarLegend extends ICommonLegend {
|
|
15
|
-
customLegend?: ICommonCustomLegend<any>;
|
|
16
|
-
}
|
|
17
|
-
export interface IBarAxes {
|
|
18
|
-
x: ICommonAxis<'top' | 'bottom'>[];
|
|
19
|
-
y: ICommonAxis<'left' | 'right'>[];
|
|
20
|
-
[key: string]: ICommonAxis[];
|
|
21
|
-
}
|
|
22
|
-
export interface IBarAdditionalAxesOptions extends ICommonAdditionalAxesOptions {
|
|
23
|
-
stackedX?: boolean;
|
|
24
|
-
stackedY?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface IBarOptions extends ICommonOptions {
|
|
27
|
-
direction?: 'vertical' | 'horizontal';
|
|
28
|
-
axes: IBarAxes;
|
|
29
|
-
scales?: ICommonScales;
|
|
30
|
-
additionalAxesOptions?: IBarAdditionalAxesOptions;
|
|
31
|
-
chartStyling: IBarStyling;
|
|
32
|
-
graph?: ICommonGraph;
|
|
33
|
-
annotations?: ICommonAnnotations;
|
|
34
|
-
legend?: IBarLegend;
|
|
35
|
-
dragData?: ICommonDragData;
|
|
36
|
-
}
|
|
37
|
-
export interface IBarChartDataset extends ICommonDataset {
|
|
38
|
-
isAnnotation?: boolean;
|
|
39
|
-
annotationIndex?: number;
|
|
40
|
-
borderSkipped?: boolean;
|
|
41
|
-
borderRadius?: number;
|
|
42
|
-
xAxisID?: string;
|
|
43
|
-
yAxisID?: string;
|
|
44
|
-
hidden?: boolean;
|
|
45
|
-
displayGroup?: string | number;
|
|
46
|
-
type?: ChartType.BAR;
|
|
47
|
-
}
|
|
48
|
-
export interface IBarChartBaseData {
|
|
49
|
-
labels: string[];
|
|
50
|
-
datasets: IBarChartDataset[];
|
|
51
|
-
}
|
|
52
|
-
export interface IBarChartData extends ICommonData {
|
|
53
|
-
testId?: string;
|
|
54
|
-
controlsPortalId?: string;
|
|
55
|
-
data: IBarChartBaseData;
|
|
56
|
-
options: IBarOptions;
|
|
57
|
-
}
|
|
58
|
-
type ILooseBarAxis = Omit<DeepPartial<ICommonAxis<string>>, 'gridLines'> & {
|
|
59
|
-
[key: string]: unknown;
|
|
60
|
-
gridLines?: unknown;
|
|
61
|
-
};
|
|
62
|
-
type ILooseBarAnnotation = Omit<DeepPartial<ICommonAnnotationsData>, 'annotationAxis'> & {
|
|
63
|
-
[key: string]: unknown;
|
|
64
|
-
annotationAxis?: string;
|
|
65
|
-
type?: string;
|
|
66
|
-
value?: number | string | null;
|
|
67
|
-
};
|
|
68
|
-
export type IBarOptionsInput = Omit<DeepPartial<IBarOptions>, 'title' | 'direction' | 'axes' | 'legend' | 'chartStyling' | 'interactions' | 'annotations' | 'additionalAxesOptions' | 'scales'> & {
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
title?: unknown;
|
|
71
|
-
direction?: string;
|
|
72
|
-
axes?: {
|
|
73
|
-
x?: ILooseBarAxis[];
|
|
74
|
-
y?: ILooseBarAxis[];
|
|
75
|
-
[key: string]: ILooseBarAxis[] | undefined;
|
|
76
|
-
};
|
|
77
|
-
legend?: Omit<DeepPartial<IBarLegend>, 'position' | 'align'> & {
|
|
78
|
-
position?: string;
|
|
79
|
-
align?: string;
|
|
80
|
-
[key: string]: unknown;
|
|
81
|
-
};
|
|
82
|
-
chartStyling?: DeepPartial<IBarStyling> & {
|
|
83
|
-
hideControls?: boolean;
|
|
84
|
-
minHeight?: number | string;
|
|
85
|
-
[key: string]: unknown;
|
|
86
|
-
};
|
|
87
|
-
additionalAxesOptions?: Omit<DeepPartial<IBarAdditionalAxesOptions>, 'chartScaleType'> & {
|
|
88
|
-
chartScaleType?: string;
|
|
89
|
-
[key: string]: unknown;
|
|
90
|
-
};
|
|
91
|
-
scales?: Record<string, unknown>;
|
|
92
|
-
interactions?: DeepPartial<ICommonInteractions> & {
|
|
93
|
-
enableZoom?: boolean;
|
|
94
|
-
enablePan?: boolean;
|
|
95
|
-
[key: string]: unknown;
|
|
96
|
-
};
|
|
97
|
-
annotations?: (Omit<DeepPartial<ICommonAnnotations>, 'annotationsData'> & {
|
|
98
|
-
annotationsData?: ILooseBarAnnotation[];
|
|
99
|
-
}) | null;
|
|
100
|
-
};
|
|
101
|
-
export interface IBarChartDataInput extends Omit<IBarChartData, 'options' | 'data'> {
|
|
102
|
-
data?: Omit<DeepPartial<IBarChartData['data']>, 'datasets'> & {
|
|
103
|
-
datasets?: Array<DeepPartial<IBarChartDataset> | object | null>;
|
|
104
|
-
};
|
|
105
|
-
options?: IBarOptionsInput;
|
|
106
|
-
}
|
|
107
|
-
export interface IBarChartProps {
|
|
108
|
-
chart: IBarChartDataInput;
|
|
109
|
-
}
|
|
110
|
-
export interface IBarDefaultProps {
|
|
111
|
-
testId: string;
|
|
112
|
-
controlsPortalId: string;
|
|
113
|
-
data: IBarChartBaseData;
|
|
114
|
-
options: {
|
|
115
|
-
title?: string | string[];
|
|
116
|
-
direction: 'vertical' | 'horizontal';
|
|
117
|
-
axes: IBarAxes;
|
|
118
|
-
additionalAxesOptions: IBarAdditionalAxesOptions;
|
|
119
|
-
chartStyling: IBarStyling;
|
|
120
|
-
tooltip: ICommonTooltip;
|
|
121
|
-
graph: IChartGraph;
|
|
122
|
-
scales?: ICommonScales;
|
|
123
|
-
annotations: {
|
|
124
|
-
showAnnotations: boolean;
|
|
125
|
-
controlAnnotation: boolean;
|
|
126
|
-
annotationsData: ICommonAnnotationsData[];
|
|
127
|
-
};
|
|
128
|
-
legend: IBarLegend;
|
|
129
|
-
chartOptions: ICommonChartOptions;
|
|
130
|
-
interactions: ICommonInteractions;
|
|
131
|
-
dragData: ICommonDragData;
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
export interface IGenerateBarChartDataset extends ChartDataset<'bar', ICommonDataValue[]> {
|
|
135
|
-
borderColor: string;
|
|
136
|
-
backgroundColor: string | string[];
|
|
137
|
-
borderDash?: number[];
|
|
138
|
-
borderWidth?: number;
|
|
139
|
-
annotationType?: string;
|
|
140
|
-
hideLegend?: boolean;
|
|
141
|
-
displayGroup?: string | number;
|
|
142
|
-
isAnnotation?: boolean;
|
|
143
|
-
annotationIndex?: number;
|
|
144
|
-
}
|
|
145
|
-
export type TGenerateBarChartDatasets = IGenerateBarChartDataset[];
|
|
146
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IBarOptions } from '../bar-chart.interface.ts';
|
|
2
|
-
type ExtendedDisplayOptions = 'auto' | boolean;
|
|
3
|
-
export interface IExtendedDataLabelsOptions {
|
|
4
|
-
display: ExtendedDisplayOptions;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Returns the data labels configuration for a bar chart.
|
|
8
|
-
*/
|
|
9
|
-
declare const getBarChartDataLabels: (options: IBarOptions) => IExtendedDataLabelsOptions;
|
|
10
|
-
export default getBarChartDataLabels;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
import { ActiveElement, Chart, ChartEvent } from 'chart.js';
|
|
3
|
-
import { IBarDefaultProps, IBarOptions, TGenerateBarChartDatasets } from '../bar-chart.interface';
|
|
4
|
-
import { ICommonHoveredItems } from '../../common/common.interface';
|
|
5
|
-
export interface IGenerateBarChartDatasetsProps {
|
|
6
|
-
datasets: TGenerateBarChartDatasets;
|
|
7
|
-
options: IBarOptions;
|
|
8
|
-
}
|
|
9
|
-
export declare const useBarChartConfig: (_chartRef: RefObject<Chart>, chart: IBarDefaultProps) => {
|
|
10
|
-
generatedDatasets: TGenerateBarChartDatasets;
|
|
11
|
-
onClick: (_evt: ChartEvent, _elements: ActiveElement[], chartInstance: Chart) => void;
|
|
12
|
-
onHover: (evt: ChartEvent, hoveredItems: ICommonHoveredItems[]) => void;
|
|
13
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
2
|
-
import { AnimationSpec, Chart } from 'chart.js';
|
|
3
|
-
import { AxisType, ChartHoverMode } from '../../common/enums';
|
|
4
|
-
import { IBarDefaultProps } from '../bar-chart.interface';
|
|
5
|
-
export interface IUseBarChartOptionsProps {
|
|
6
|
-
chart: IBarDefaultProps;
|
|
7
|
-
chartRef: MutableRefObject<Chart | null>;
|
|
8
|
-
}
|
|
9
|
-
export declare const getBarChartAnimation: (performanceMode?: boolean) => false | Partial<AnimationSpec<"bar">>;
|
|
10
|
-
export declare const useBarChartOptions: ({ chart, chartRef }: IUseBarChartOptionsProps) => {
|
|
11
|
-
onClick: (_evt: import('chart.js').ChartEvent, _elements: import('chart.js').ActiveElement[], chartInstance: Chart) => void;
|
|
12
|
-
onHover: (evt: import('chart.js').ChartEvent, hoveredItems: import('../../common/common.interface').ICommonHoveredItems[]) => void;
|
|
13
|
-
indexAxis: AxisType;
|
|
14
|
-
maintainAspectRatio: boolean | undefined;
|
|
15
|
-
animation: false | Partial<AnimationSpec<"bar">>;
|
|
16
|
-
hover: {
|
|
17
|
-
mode: ChartHoverMode;
|
|
18
|
-
intersect: boolean;
|
|
19
|
-
};
|
|
20
|
-
scales: Record<string, import('../../common/common.interface').ICommonScaleOptions>;
|
|
21
|
-
plugins: {
|
|
22
|
-
title: {
|
|
23
|
-
display: boolean;
|
|
24
|
-
text: string | string[];
|
|
25
|
-
} | {
|
|
26
|
-
display?: undefined;
|
|
27
|
-
text?: undefined;
|
|
28
|
-
};
|
|
29
|
-
datalabels: import('./get-bar-chart-data-labels').IExtendedDataLabelsOptions;
|
|
30
|
-
annotation: {
|
|
31
|
-
annotations: {};
|
|
32
|
-
};
|
|
33
|
-
tooltip: Record<string, any>;
|
|
34
|
-
legend: {
|
|
35
|
-
display: boolean;
|
|
36
|
-
events: never[];
|
|
37
|
-
position: any;
|
|
38
|
-
align: "center" | "start" | "end";
|
|
39
|
-
labels: {
|
|
40
|
-
boxHeight: number;
|
|
41
|
-
boxWidth: number | undefined;
|
|
42
|
-
usePointStyle: boolean | undefined;
|
|
43
|
-
};
|
|
44
|
-
onClick: (_: import('../../common/common.interface').UnusedParameter, legendItem: import('chart.js').LegendItem) => void;
|
|
45
|
-
};
|
|
46
|
-
customLegendPlugin: {
|
|
47
|
-
htmlLegend: any;
|
|
48
|
-
};
|
|
49
|
-
chartAreaBorder: {
|
|
50
|
-
borderColor: string;
|
|
51
|
-
};
|
|
52
|
-
dragData: false | object | import('../../common/helpers/get-draggableData').IDraggableData | undefined;
|
|
53
|
-
};
|
|
54
|
-
};
|