@oliasoft-open-source/charts-library 2.1.3 → 2.1.5
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/index.js
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
Components
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import ScatterChart from './src/components/scatter-chart/scatter-chart';
|
|
6
|
+
|
|
5
7
|
export { LineChart } from './src/components/line-chart/line-chart';
|
|
6
8
|
|
|
7
9
|
export { PieChart } from './src/components/pie-chart/pie-chart';
|
|
8
10
|
|
|
9
11
|
export { BarChart } from './src/components/bar-chart/bar-chart';
|
|
12
|
+
|
|
13
|
+
export { ScatterChart };
|
package/package.json
CHANGED
|
@@ -159,7 +159,7 @@ export const getDefaultProps = (props) => {
|
|
|
159
159
|
props.chart.options.tooltip.hideSimulationName || false,
|
|
160
160
|
},
|
|
161
161
|
graph: {
|
|
162
|
-
lineTension: props.chart.options.graph.lineTension || 0.
|
|
162
|
+
lineTension: props.chart.options.graph.lineTension || 0.01,
|
|
163
163
|
spanGaps: props.chart.options.graph.spanGaps || false,
|
|
164
164
|
showDataLabels: props.chart.options.graph.showDataLabels || false,
|
|
165
165
|
showMinorGridlines:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useReducer, useRef
|
|
1
|
+
import React, { useEffect, useReducer, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
CategoryScale,
|
|
4
4
|
Chart as ChartJS,
|
|
@@ -22,15 +22,15 @@ import styles from './line-chart.module.less';
|
|
|
22
22
|
import { reducer } from './state/line-chart-reducer';
|
|
23
23
|
import initialState from './state/initial-state';
|
|
24
24
|
import {
|
|
25
|
+
SET_AXIS_VALUE,
|
|
26
|
+
SET_POINTS_ZOOM_DEFAULTS,
|
|
27
|
+
TOGGLE_ANNOTATION,
|
|
28
|
+
TOGGLE_LEGEND,
|
|
29
|
+
TOGGLE_LINE,
|
|
25
30
|
TOGGLE_PAN,
|
|
26
|
-
TOGGLE_ZOOM,
|
|
27
31
|
TOGGLE_POINTS,
|
|
28
|
-
|
|
29
|
-
TOGGLE_LEGEND,
|
|
32
|
+
TOGGLE_ZOOM,
|
|
30
33
|
UNSET_AXES_VALUES,
|
|
31
|
-
SET_AXIS_VALUE,
|
|
32
|
-
TOGGLE_ANNOTATION,
|
|
33
|
-
SET_POINTS_ZOOM_DEFAULTS,
|
|
34
34
|
} from './state/action-types';
|
|
35
35
|
import { Controls } from './Controls/Controls';
|
|
36
36
|
import { getDefaultProps, LineChartPropTypes } from './line-chart-prop-types';
|
|
@@ -38,23 +38,23 @@ import getLineChartScales from './get-line-chart-scales';
|
|
|
38
38
|
import getLineChartToolTips from './get-line-chart-tooltips';
|
|
39
39
|
import getLineChartDataLabels from './get-line-chart-data-labels';
|
|
40
40
|
import {
|
|
41
|
+
BORDER_JOIN_STYLE,
|
|
42
|
+
DEFAULT_BACKGROUND_COLOR,
|
|
41
43
|
DEFAULT_BORDER_WIDTH,
|
|
42
44
|
DEFAULT_HOVER_RADIUS,
|
|
43
|
-
DEFAULT_POINT_RADIUS,
|
|
44
|
-
BORDER_JOIN_STYLE,
|
|
45
45
|
DEFAULT_LINE_POINT_RADIUS,
|
|
46
|
-
|
|
46
|
+
DEFAULT_POINT_RADIUS,
|
|
47
47
|
} from './line-chart-consts';
|
|
48
48
|
|
|
49
49
|
import getAnnotation from '../../helpers/get-chart-annotation';
|
|
50
50
|
import {
|
|
51
51
|
generateRandomColor,
|
|
52
|
-
getClassName,
|
|
53
|
-
getTitle,
|
|
54
52
|
getAxisValue,
|
|
55
|
-
getPlugins,
|
|
56
|
-
getLegend,
|
|
57
53
|
getChartFileName,
|
|
54
|
+
getClassName,
|
|
55
|
+
getLegend,
|
|
56
|
+
getPlugins,
|
|
57
|
+
getTitle,
|
|
58
58
|
} from '../../helpers/chart-utils';
|
|
59
59
|
import {
|
|
60
60
|
ANIMATION_DURATION,
|
|
@@ -207,11 +207,12 @@ const LineChart = (props) => {
|
|
|
207
207
|
line.data[2].x = axesMax > endPoint?.x ? axesMax : endPoint?.x;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
/*
|
|
211
|
+
Remove invalid falsy data points OW-9855
|
|
212
|
+
Points should be an object of {x, y} pairs
|
|
213
|
+
This is an extra guard to prevent crashes if parent apps pass bad inputs
|
|
214
|
+
*/
|
|
215
|
+
line.data = line?.data?.filter(Boolean) || [];
|
|
215
216
|
|
|
216
217
|
line.showLine = state.lineEnabled;
|
|
217
218
|
const linePointRadius = line.pointRadius
|
|
@@ -67,6 +67,38 @@ const dataset2 = {
|
|
|
67
67
|
],
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
const datasetMissingValues = {
|
|
71
|
+
label: 'Dataset with missing (null) values',
|
|
72
|
+
data: [
|
|
73
|
+
{
|
|
74
|
+
x: 0,
|
|
75
|
+
y: 0,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
x: 3,
|
|
79
|
+
y: 0,
|
|
80
|
+
},
|
|
81
|
+
null, //reproduce OW-9855
|
|
82
|
+
undefined, //reproduce OW-9855
|
|
83
|
+
{
|
|
84
|
+
x: 3,
|
|
85
|
+
y: 30,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
x: null,
|
|
89
|
+
y: 60,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
x: 12,
|
|
93
|
+
y: 120,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
x: 15,
|
|
97
|
+
y: 240,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
|
|
70
102
|
const datasetLabelled2 = {
|
|
71
103
|
...dataset2,
|
|
72
104
|
data: dataset2.data.map((item) => ({ ...item, label: ['Label'] })),
|
|
@@ -117,6 +149,16 @@ const TemplateWithCustomLegendContainer = (args) => {
|
|
|
117
149
|
|
|
118
150
|
export const Default = Template.bind({});
|
|
119
151
|
|
|
152
|
+
export const DataGaps = Template.bind({});
|
|
153
|
+
DataGaps.args = {
|
|
154
|
+
chart: {
|
|
155
|
+
...basicChart,
|
|
156
|
+
data: {
|
|
157
|
+
datasets: [datasetMissingValues],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
120
162
|
export const MinorGridlines = Template.bind({});
|
|
121
163
|
MinorGridlines.args = {
|
|
122
164
|
chart: {
|