@semcore/d3-chart 1.0.0-8 → 1.2.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 +62 -0
- package/lib/cjs/Area.js +71 -49
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +148 -142
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +101 -54
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/ClipPath.js +110 -0
- package/lib/cjs/ClipPath.js.map +1 -0
- package/lib/cjs/Donut.js +169 -68
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +55 -21
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/GroupBar.js +7 -6
- package/lib/cjs/GroupBar.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +72 -45
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +46 -47
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +63 -41
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Plot.js +16 -29
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/ResponsiveContainer.js +13 -9
- package/lib/cjs/ResponsiveContainer.js.map +1 -1
- package/lib/cjs/StackBar.js +6 -6
- package/lib/cjs/StackBar.js.map +1 -1
- package/lib/cjs/StackedArea.js +8 -9
- package/lib/cjs/StackedArea.js.map +1 -1
- package/lib/cjs/Tooltip.js +49 -75
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +235 -0
- package/lib/cjs/Venn.js.map +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/area.shadow.css +11 -10
- package/lib/cjs/style/bar.shadow.css +4 -0
- package/lib/cjs/style/donut.shadow.css +1 -0
- package/lib/cjs/style/dot.shadow.css +19 -0
- package/lib/cjs/style/line.shadow.css +4 -15
- package/lib/cjs/style/tooltip.shadow.css +1 -0
- package/lib/cjs/style/venn.shadow.css +23 -0
- package/lib/cjs/utils.js +8 -1
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/Area.js +72 -50
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +149 -143
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +100 -54
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/ClipPath.js +91 -0
- package/lib/es6/ClipPath.js.map +1 -0
- package/lib/es6/Donut.js +167 -67
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +51 -20
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/GroupBar.js +7 -6
- package/lib/es6/GroupBar.js.map +1 -1
- package/lib/es6/HorizontalBar.js +72 -45
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +47 -48
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +65 -43
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Plot.js +17 -29
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/ResponsiveContainer.js +13 -7
- package/lib/es6/ResponsiveContainer.js.map +1 -1
- package/lib/es6/StackBar.js +6 -6
- package/lib/es6/StackBar.js.map +1 -1
- package/lib/es6/StackedArea.js +8 -9
- package/lib/es6/StackedArea.js.map +1 -1
- package/lib/es6/Tooltip.js +52 -76
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +217 -0
- package/lib/es6/Venn.js.map +1 -0
- package/lib/es6/index.js +1 -0
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/area.shadow.css +11 -10
- package/lib/es6/style/bar.shadow.css +4 -0
- package/lib/es6/style/donut.shadow.css +1 -0
- package/lib/es6/style/dot.shadow.css +19 -0
- package/lib/es6/style/line.shadow.css +4 -15
- package/lib/es6/style/tooltip.shadow.css +1 -0
- package/lib/es6/style/venn.shadow.css +23 -0
- package/lib/es6/utils.js +6 -1
- package/lib/es6/utils.js.map +1 -1
- package/lib/types/Area.d.ts +7 -8
- package/lib/types/Axis.d.ts +6 -6
- package/lib/types/Bar.d.ts +7 -3
- package/lib/types/ClipPath.d.ts +26 -0
- package/lib/types/Donut.d.ts +12 -2
- package/lib/types/GroupBar.d.ts +2 -2
- package/lib/types/HorizontalBar.d.ts +7 -3
- package/lib/types/Hover.d.ts +2 -2
- package/lib/types/Line.d.ts +9 -4
- package/{src/types/Plot.ts → lib/types/Plot.d.ts} +2 -2
- package/lib/types/ResponsiveContainer.d.ts +1 -1
- package/lib/types/StackBar.d.ts +3 -11
- package/lib/types/StackedArea.d.ts +7 -6
- package/lib/types/Tooltip.d.ts +4 -4
- package/lib/types/Venn.d.ts +45 -0
- package/lib/types/context.d.ts +1 -1
- package/lib/types/index.d.ts +6 -0
- package/package.json +10 -5
- package/src/Area.js +43 -14
- package/src/Axis.js +24 -22
- package/src/Bar.js +69 -24
- package/src/ClipPath.js +36 -0
- package/src/Donut.js +84 -12
- package/src/Dots.js +36 -20
- package/src/GroupBar.js +1 -0
- package/src/HorizontalBar.js +49 -22
- package/src/Hover.js +3 -3
- package/src/Line.js +41 -13
- package/src/Plot.js +3 -7
- package/src/ResponsiveContainer.js +3 -3
- package/src/StackBar.js +1 -1
- package/src/StackedArea.js +3 -2
- package/src/Tooltip.js +11 -12
- package/src/Venn.js +112 -0
- package/src/index.js +1 -0
- package/src/style/area.shadow.css +11 -10
- package/src/style/bar.shadow.css +4 -0
- package/src/style/donut.shadow.css +1 -0
- package/src/style/dot.shadow.css +19 -0
- package/src/style/line.shadow.css +4 -15
- package/src/style/tooltip.shadow.css +1 -0
- package/src/style/venn.shadow.css +23 -0
- package/src/types/Area.d.ts +7 -8
- package/src/types/Axis.d.ts +6 -6
- package/src/types/Bar.d.ts +7 -3
- package/src/types/ClipPath.d.ts +26 -0
- package/src/types/Donut.d.ts +12 -2
- package/src/types/GroupBar.d.ts +2 -2
- package/src/types/HorizontalBar.d.ts +7 -3
- package/src/types/Hover.d.ts +2 -2
- package/src/types/Line.d.ts +9 -4
- package/src/types/Plot.d.ts +16 -0
- package/src/types/ResponsiveContainer.d.ts +1 -1
- package/src/types/StackBar.d.ts +3 -11
- package/src/types/StackedArea.d.ts +7 -6
- package/src/types/Tooltip.d.ts +4 -4
- package/src/types/Venn.d.ts +45 -0
- package/src/types/context.d.ts +1 -1
- package/src/types/index.d.ts +6 -0
- package/src/utils.js +7 -1
- package/lib/cjs/style/chart.shadow.css +0 -4
- package/lib/cjs/types/Plot.js +0 -2
- package/lib/cjs/types/Plot.js.map +0 -1
- package/lib/es6/style/chart.shadow.css +0 -4
- package/lib/es6/types/Plot.js +0 -2
- package/lib/es6/types/Plot.js.map +0 -1
- package/src/style/chart.shadow.css +0 -4
package/src/Venn.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { venn, normalizeSolution, scaleSolution, intersectionAreaPath } from '@upsetjs/venn.js';
|
|
3
|
+
import { Component, sstyled } from '@semcore/core';
|
|
4
|
+
import canUseDOM from '@semcore/utils/lib/canUseDOM';
|
|
5
|
+
import { FadeInOut } from '@semcore/animation';
|
|
6
|
+
|
|
7
|
+
import createElement from './createElement';
|
|
8
|
+
import { CONSTANT } from './utils';
|
|
9
|
+
|
|
10
|
+
import style from './style/venn.shadow.css';
|
|
11
|
+
|
|
12
|
+
class VennRoot extends Component {
|
|
13
|
+
static displayName = 'Venn';
|
|
14
|
+
static style = style;
|
|
15
|
+
|
|
16
|
+
static defaultProps = {
|
|
17
|
+
orientation: Math.PI / 2,
|
|
18
|
+
orientationOrder: (c1, c2) => c2.radius - c1.radius,
|
|
19
|
+
duration: 500,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
virtualElement = canUseDOM() ? document.createElement('div') : {};
|
|
23
|
+
|
|
24
|
+
generateGetBoundingClientRect(x = 0, y = 0) {
|
|
25
|
+
return () => ({ width: 0, height: 0, top: y, right: x, bottom: y, left: x });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
bindHandlerTooltip = (visible, props) => ({ clientX: x, clientY: y }) => {
|
|
29
|
+
const { eventEmitter } = this.asProps;
|
|
30
|
+
this.virtualElement.getBoundingClientRect = this.generateGetBoundingClientRect(x, y);
|
|
31
|
+
this.virtualElement[CONSTANT.VIRTUAL_ELEMENT] = true;
|
|
32
|
+
eventEmitter.emit('onTooltipVisible', visible, props, this.virtualElement);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
getVennData() {
|
|
36
|
+
const { data, orientation, orientationOrder, size } = this.asProps;
|
|
37
|
+
const [width, height] = size;
|
|
38
|
+
const vennData = Object.entries(data).map(([dataKey, size]) => ({
|
|
39
|
+
sets: dataKey.split('/'),
|
|
40
|
+
size,
|
|
41
|
+
}));
|
|
42
|
+
return scaleSolution(
|
|
43
|
+
normalizeSolution(venn(vennData), orientation, orientationOrder),
|
|
44
|
+
width,
|
|
45
|
+
height,
|
|
46
|
+
10,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getCircleProps(props) {
|
|
51
|
+
return {
|
|
52
|
+
duration: this.asProps.duration,
|
|
53
|
+
data: this.vennData[props.dataKey],
|
|
54
|
+
onMouseMove: this.bindHandlerTooltip(true, props),
|
|
55
|
+
onMouseLeave: this.bindHandlerTooltip(false, props),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getIntersectionProps(props) {
|
|
60
|
+
const { duration } = this.asProps;
|
|
61
|
+
const dataKeys = props.dataKey.split('/');
|
|
62
|
+
return {
|
|
63
|
+
duration,
|
|
64
|
+
delay: duration,
|
|
65
|
+
data: Object.values(this.vennData).filter((d) => dataKeys.includes(d.setid)),
|
|
66
|
+
onMouseMove: this.bindHandlerTooltip(true, props),
|
|
67
|
+
onMouseLeave: this.bindHandlerTooltip(false, props),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
renderElement = React.forwardRef((props, ref) => {
|
|
72
|
+
return <FadeInOut ref={ref} tag="g" visible {...props} />;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
render() {
|
|
76
|
+
const Element = this.Element;
|
|
77
|
+
this.vennData = this.getVennData();
|
|
78
|
+
return (
|
|
79
|
+
<Element render={this.renderElement} childrenPosition="inside" vennData={this.vennData} />
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function Circle({ Element: SCircle, styles, color = '#3AB011', data, duration }) {
|
|
85
|
+
return sstyled(styles)(
|
|
86
|
+
<SCircle
|
|
87
|
+
render="circle"
|
|
88
|
+
color={color}
|
|
89
|
+
cx={data.x}
|
|
90
|
+
cy={data.y}
|
|
91
|
+
r={data.radius}
|
|
92
|
+
use:duration={`${duration}ms`}
|
|
93
|
+
/>,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function Intersection(props) {
|
|
98
|
+
const { Element: SIntersection, styles, data } = props;
|
|
99
|
+
const renderIntersection = React.useCallback(
|
|
100
|
+
React.forwardRef((props, ref) => {
|
|
101
|
+
return <FadeInOut ref={ref} tag="path" visible {...props} />;
|
|
102
|
+
}),
|
|
103
|
+
[props],
|
|
104
|
+
);
|
|
105
|
+
return sstyled(styles)(
|
|
106
|
+
<SIntersection render={renderIntersection} d={intersectionAreaPath(data)} />,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const Venn = createElement(VennRoot, { Circle, Intersection });
|
|
111
|
+
|
|
112
|
+
export default Venn;
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { default as StackBar } from './StackBar';
|
|
|
11
11
|
export { default as Area } from './Area';
|
|
12
12
|
export { default as StackedArea } from './StackedArea';
|
|
13
13
|
export { default as Donut } from './Donut';
|
|
14
|
+
export { default as Venn } from './Venn';
|
|
14
15
|
|
|
15
16
|
export { default as Tooltip } from './Tooltip';
|
|
16
17
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
SArea {
|
|
2
|
+
fill: var(--color);
|
|
3
|
+
fill-opacity: 0.4;
|
|
2
4
|
}
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
stroke
|
|
6
|
-
stroke:
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
SDot[hide] {
|
|
11
|
-
display: none;
|
|
6
|
+
SAreaLine {
|
|
7
|
+
stroke: var(--color);
|
|
8
|
+
stroke-width: 3;
|
|
9
|
+
fill: transparent;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
SArea,
|
|
13
|
+
SAreaLine {
|
|
14
|
+
transition-property: d;
|
|
15
|
+
transition-duration: var(--duration);
|
|
16
|
+
transition-timing-function: ease-in-out;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
SNull {
|
package/src/style/bar.shadow.css
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import '@semcore/utils/style/var.css';
|
|
2
|
+
|
|
3
|
+
SDot {
|
|
4
|
+
stroke-width: 2px;
|
|
5
|
+
stroke: #fff;
|
|
6
|
+
r: 6px;
|
|
7
|
+
fill: var(--color);
|
|
8
|
+
transition-property: cx, cy;
|
|
9
|
+
transition-duration: var(--duration);
|
|
10
|
+
transition-timing-function: ease-in-out;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
SDot[hide] {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
SDot[active] {
|
|
18
|
+
r: 8px;
|
|
19
|
+
}
|
|
@@ -3,27 +3,16 @@
|
|
|
3
3
|
SLine {
|
|
4
4
|
fill: transparent;
|
|
5
5
|
stroke-width: 3;
|
|
6
|
-
|
|
6
|
+
stroke: var(--color);
|
|
7
|
+
transition-property: d;
|
|
8
|
+
transition-duration: var(--duration);
|
|
9
|
+
transition-timing-function: ease-in-out;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
SLine[hide] {
|
|
10
13
|
display: none;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
SDot {
|
|
14
|
-
stroke-width: 2px;
|
|
15
|
-
stroke: #fff;
|
|
16
|
-
r: 6px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
SDot[hide] {
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
SDot[active] {
|
|
24
|
-
r: 8px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
16
|
SNull {
|
|
28
17
|
fill: transparent;
|
|
29
18
|
stroke: var(--mist);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
SCircle {
|
|
2
|
+
fill: var(--color);
|
|
3
|
+
stroke: #fff;
|
|
4
|
+
stroke-width: 2px;
|
|
5
|
+
fill-opacity: 0.5;
|
|
6
|
+
transition-property: cx, cy;
|
|
7
|
+
transition-duration: var(--duration);
|
|
8
|
+
transition-timing-function: ease-in-out;
|
|
9
|
+
|
|
10
|
+
&:hover {
|
|
11
|
+
fill-opacity: 0.7;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
SIntersection {
|
|
16
|
+
stroke: #fff;
|
|
17
|
+
stroke-width: 2px;
|
|
18
|
+
fill-opacity: 0;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
fill-opacity: 0.1;
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/types/Area.d.ts
CHANGED
|
@@ -3,20 +3,21 @@ import IContext from './context';
|
|
|
3
3
|
import { CurveFactory } from 'd3-shape';
|
|
4
4
|
|
|
5
5
|
export interface IAreaProps extends IContext {
|
|
6
|
-
/** Field from data for
|
|
6
|
+
/** Field from data for XAxis */
|
|
7
7
|
x?: string;
|
|
8
|
-
/** Field from data for
|
|
8
|
+
/** Field from data for YAxis*/
|
|
9
9
|
y?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Line color
|
|
11
11
|
* @default '#50aef4'*/
|
|
12
12
|
color?: string;
|
|
13
|
-
/** Area color
|
|
14
|
-
* @default '#50aef450'*/
|
|
15
|
-
fill?: string;
|
|
16
13
|
/** Element hide property */
|
|
17
14
|
hide?: boolean;
|
|
18
15
|
/** Curve method */
|
|
19
16
|
curve?: CurveFactory;
|
|
17
|
+
/** Animation duration in ms
|
|
18
|
+
* @default 500
|
|
19
|
+
*/
|
|
20
|
+
duration?: number;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export interface IAreaDotsProps extends IContext {
|
|
@@ -24,8 +25,6 @@ export interface IAreaDotsProps extends IContext {
|
|
|
24
25
|
display?: boolean;
|
|
25
26
|
/** Hide property */
|
|
26
27
|
hide?: boolean;
|
|
27
|
-
/** Index active of element */
|
|
28
|
-
activeIndex?: number;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
export interface IAreaDotsContext {
|
package/src/types/Axis.d.ts
CHANGED
|
@@ -4,22 +4,22 @@ import IContext from './context';
|
|
|
4
4
|
export interface IXAxisProps extends IContext {
|
|
5
5
|
/** The position of the axis relative chart
|
|
6
6
|
* @default 'button' */
|
|
7
|
-
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
7
|
+
position?: 'top' | 'right' | 'bottom' | 'left' | number;
|
|
8
8
|
/** Element hide property
|
|
9
9
|
* @default false */
|
|
10
10
|
hide?: boolean;
|
|
11
|
-
/** Values
|
|
11
|
+
/** Values for axis ticks */
|
|
12
12
|
ticks?: any[];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface IYAxisProps extends IContext {
|
|
16
16
|
/** The position of the axis relative chart
|
|
17
17
|
* @default 'left' */
|
|
18
|
-
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
18
|
+
position?: 'top' | 'right' | 'bottom' | 'left' | number;
|
|
19
19
|
/** Element hide property
|
|
20
20
|
* @default true */
|
|
21
21
|
hide?: boolean;
|
|
22
|
-
/** Values
|
|
22
|
+
/** Values for axis ticks */
|
|
23
23
|
ticks?: any[];
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -28,12 +28,12 @@ export interface IAxisTicksProps extends IContext {
|
|
|
28
28
|
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
29
29
|
/** Element hide property */
|
|
30
30
|
hide?: boolean;
|
|
31
|
-
/** Values
|
|
31
|
+
/** Values for axis ticks */
|
|
32
32
|
ticks?: any[];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface IAxisGridProps extends IContext {
|
|
36
|
-
/** Values
|
|
36
|
+
/** Values for axis ticks */
|
|
37
37
|
ticks?: any[];
|
|
38
38
|
}
|
|
39
39
|
|
package/src/types/Bar.d.ts
CHANGED
|
@@ -2,15 +2,19 @@ import { CProps, ReturnEl } from '@semcore/core';
|
|
|
2
2
|
import IContext from './context';
|
|
3
3
|
|
|
4
4
|
export interface IBarProps extends IContext {
|
|
5
|
-
/** Field from data for
|
|
5
|
+
/** Field from data for XAxis */
|
|
6
6
|
x?: string;
|
|
7
|
-
/** Field from data for
|
|
7
|
+
/** Field from data for YAxis */
|
|
8
8
|
y?: string;
|
|
9
|
-
/**
|
|
9
|
+
/** Line color
|
|
10
10
|
* @default '#50aef4'*/
|
|
11
11
|
color?: string;
|
|
12
12
|
/** Element hide property */
|
|
13
13
|
hide?: boolean;
|
|
14
|
+
/** Animation duration in ms
|
|
15
|
+
* @default 500
|
|
16
|
+
*/
|
|
17
|
+
duration?: number;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
export interface IBarContext {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CProps, ReturnEl } from '@semcore/core';
|
|
3
|
+
|
|
4
|
+
export interface IClipPath {
|
|
5
|
+
/**
|
|
6
|
+
* HTML tag name for the displayed item
|
|
7
|
+
* @default rect
|
|
8
|
+
*/
|
|
9
|
+
tag?: string;
|
|
10
|
+
/**
|
|
11
|
+
* HTML selector
|
|
12
|
+
*/
|
|
13
|
+
id?: string;
|
|
14
|
+
/**
|
|
15
|
+
* CSS property
|
|
16
|
+
*/
|
|
17
|
+
transition?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Function which run after mounted clipPath
|
|
20
|
+
*/
|
|
21
|
+
setAttributeTag?: (rect: React.ReactNode) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare const ClipPath: <T>(props: CProps<IClipPath & T>) => ReturnEl;
|
|
25
|
+
|
|
26
|
+
export default ClipPath;
|
package/src/types/Donut.d.ts
CHANGED
|
@@ -2,13 +2,23 @@ import { CProps, ReturnEl } from '@semcore/core';
|
|
|
2
2
|
import IContext from './context';
|
|
3
3
|
|
|
4
4
|
export interface IDonutProps extends IContext {
|
|
5
|
-
|
|
5
|
+
/** Inner radius
|
|
6
|
+
* @default 0
|
|
7
|
+
* */
|
|
6
8
|
innerRadius?: number;
|
|
7
|
-
|
|
9
|
+
/** Semi donut */
|
|
8
10
|
halfsize?: boolean;
|
|
11
|
+
/** Animation duration in ms
|
|
12
|
+
* @default 500
|
|
13
|
+
*/
|
|
14
|
+
duration?: number;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
export interface IPieProps extends IContext {
|
|
18
|
+
/**
|
|
19
|
+
* Name of the field in the data
|
|
20
|
+
* */
|
|
21
|
+
dataKey: string;
|
|
12
22
|
/** Color pie
|
|
13
23
|
@default #50aef4
|
|
14
24
|
**/
|
package/src/types/GroupBar.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { IHorizontalBarProps } from './HorizontalBar';
|
|
|
4
4
|
import IContext from './context';
|
|
5
5
|
|
|
6
6
|
export interface IGroupBarProps extends IContext {
|
|
7
|
-
/** Field from data for
|
|
7
|
+
/** Field from data for XAxis */
|
|
8
8
|
x?: string;
|
|
9
|
-
/** Field from data for
|
|
9
|
+
/** Field from data for YAxis */
|
|
10
10
|
y?: string;
|
|
11
11
|
/** Scale for group bars */
|
|
12
12
|
scaleGroup?: any;
|
|
@@ -3,13 +3,17 @@ import IContext from './context';
|
|
|
3
3
|
import { IBarContext, IBackgroundProps } from './Bar';
|
|
4
4
|
|
|
5
5
|
export interface IHorizontalBarProps extends IContext {
|
|
6
|
-
/** Field from data for
|
|
6
|
+
/** Field from data for XAxis */
|
|
7
7
|
x?: string;
|
|
8
|
-
/** Field from data for
|
|
8
|
+
/** Field from data for YAxis */
|
|
9
9
|
y?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Line color
|
|
11
11
|
* @default '#50aef4'*/
|
|
12
12
|
color?: string;
|
|
13
|
+
/** Animation duration in ms
|
|
14
|
+
* @default 500
|
|
15
|
+
*/
|
|
16
|
+
duration?: number;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
declare const HorizontalBar: (<T>(
|
package/src/types/Hover.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { CProps, ReturnEl } from '@semcore/core';
|
|
|
2
2
|
import IContext from './context';
|
|
3
3
|
|
|
4
4
|
export interface IHoverProps extends IContext {
|
|
5
|
-
/** Field from data for
|
|
5
|
+
/** Field from data for XAxis */
|
|
6
6
|
x?: string;
|
|
7
|
-
/** Field from data for
|
|
7
|
+
/** Field from data for YAxis */
|
|
8
8
|
y?: string;
|
|
9
9
|
}
|
|
10
10
|
|
package/src/types/Line.d.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { CProps, ReturnEl } from '@semcore/core';
|
|
2
2
|
import IContext from './context';
|
|
3
3
|
import { CurveFactory } from 'd3-shape';
|
|
4
|
+
import { IFadeInOutProps } from '@semcore/animation';
|
|
4
5
|
|
|
5
6
|
export interface ILineProps extends IContext {
|
|
6
|
-
/** Field from data for
|
|
7
|
+
/** Field from data for XAxis */
|
|
7
8
|
x?: string;
|
|
8
|
-
/** Field from data for
|
|
9
|
+
/** Field from data for YAxis */
|
|
9
10
|
y?: string;
|
|
10
|
-
/**
|
|
11
|
+
/** Line color
|
|
11
12
|
* @default '#50aef4'*/
|
|
12
13
|
color?: string;
|
|
13
14
|
/** Element hide property */
|
|
14
15
|
hide?: boolean;
|
|
15
16
|
/** Curve method */
|
|
16
17
|
curve?: CurveFactory;
|
|
18
|
+
/** Animation duration in ms
|
|
19
|
+
* @default 500
|
|
20
|
+
*/
|
|
21
|
+
duration?: number;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
export interface ILineDotsProps extends IContext {
|
|
24
|
+
export interface ILineDotsProps extends IContext, IFadeInOutProps {
|
|
20
25
|
/** Show all Dot */
|
|
21
26
|
display?: boolean;
|
|
22
27
|
/** Hide property */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IBoxProps } from '@semcore/flex-box';
|
|
2
|
+
import { CProps, ReturnEl } from '@semcore/core';
|
|
3
|
+
import IContext from './context';
|
|
4
|
+
|
|
5
|
+
export interface IPlotProps extends IContext, IBoxProps {
|
|
6
|
+
/** Width of the svg element
|
|
7
|
+
* @default 0*/
|
|
8
|
+
width?: number;
|
|
9
|
+
/** Height of the svg element
|
|
10
|
+
* @default 0*/
|
|
11
|
+
height?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare const Plot: <T>(props: CProps<IPlotProps & T>) => ReturnEl;
|
|
15
|
+
|
|
16
|
+
export default Plot;
|
|
@@ -4,7 +4,7 @@ import { CProps, ReturnEl } from '@semcore/core';
|
|
|
4
4
|
export interface IResponsiveContainerProps extends IBoxProps {
|
|
5
5
|
/** Relation between height and width dimensions block */
|
|
6
6
|
aspect?: number;
|
|
7
|
-
/** Callback which will called after
|
|
7
|
+
/** Callback which will be called after changing the block size */
|
|
8
8
|
onResize?: (size: [number, number], entries: ResizeObserverEntry[]) => void;
|
|
9
9
|
}
|
|
10
10
|
|
package/src/types/StackBar.d.ts
CHANGED
|
@@ -4,21 +4,13 @@ import { IBarContext, IBarProps } from './Bar';
|
|
|
4
4
|
import { IHorizontalBarProps } from './HorizontalBar';
|
|
5
5
|
|
|
6
6
|
export interface IStackBarProps extends IContext {
|
|
7
|
-
/**
|
|
8
|
-
data?: any[];
|
|
9
|
-
/** Field from data for Axis x */
|
|
7
|
+
/** Field from data for XAxis */
|
|
10
8
|
x?: string;
|
|
11
|
-
/** Field from data for
|
|
9
|
+
/** Field from data for YAxis */
|
|
12
10
|
y?: string;
|
|
13
11
|
/** Stack generators
|
|
14
12
|
* @default d3.stack() */
|
|
15
|
-
stack?:
|
|
16
|
-
any,
|
|
17
|
-
{
|
|
18
|
-
[key: string]: number;
|
|
19
|
-
},
|
|
20
|
-
string
|
|
21
|
-
>;
|
|
13
|
+
stack?: any;
|
|
22
14
|
}
|
|
23
15
|
|
|
24
16
|
export interface IStackBarContext {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { CProps, ReturnEl } from '@semcore/core';
|
|
2
2
|
import IContext from './context';
|
|
3
|
-
import
|
|
3
|
+
import Area from './Area';
|
|
4
4
|
|
|
5
5
|
export interface IStackedAreaProps extends IContext {
|
|
6
|
-
/**
|
|
7
|
-
data?: any[];
|
|
8
|
-
/** Field from data for Axis x */
|
|
6
|
+
/** Field from data for XAxis */
|
|
9
7
|
x?: string;
|
|
10
|
-
/** Field from data for
|
|
8
|
+
/** Field from data for YAxis */
|
|
11
9
|
y?: string;
|
|
10
|
+
/** Stack generators
|
|
11
|
+
* @default d3.stack() */
|
|
12
|
+
stack?: any;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface IStackedAreaContext {
|
|
@@ -19,7 +20,7 @@ export interface IStackedAreaContext {
|
|
|
19
20
|
declare const StackedArea: (<T>(
|
|
20
21
|
props: CProps<IStackedAreaProps & T, IStackedAreaContext>,
|
|
21
22
|
) => ReturnEl) & {
|
|
22
|
-
Area:
|
|
23
|
+
Area: typeof Area;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
export default StackedArea;
|
package/src/types/Tooltip.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import Popper, { IPopperProps, IPopperTriggerProps } from '@semcore/popper';
|
|
2
3
|
import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
|
|
3
|
-
import Popper from '@semcore/popper/lib/types/Popper';
|
|
4
4
|
import { IBoxProps } from '@semcore/flex-box';
|
|
5
5
|
import IContext from './context';
|
|
6
6
|
|
|
7
7
|
export interface ITooltipProps extends IPopperProps, IPopperTriggerProps, IContext {
|
|
8
|
-
/** Field from data for
|
|
8
|
+
/** Field from data for XAxis */
|
|
9
9
|
x?: string;
|
|
10
|
-
/** Field from data for
|
|
10
|
+
/** Field from data for YAxis */
|
|
11
11
|
y?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CProps, ReturnEl } from '@semcore/core';
|
|
2
|
+
import IContext from './context';
|
|
3
|
+
import { IFadeInOutProps } from '@semcore/animation';
|
|
4
|
+
|
|
5
|
+
export interface IVennProps extends IContext, IFadeInOutProps {
|
|
6
|
+
/**
|
|
7
|
+
* Rotate sets in the chart
|
|
8
|
+
* @default Math.PI / 2
|
|
9
|
+
*/
|
|
10
|
+
orientation?: number;
|
|
11
|
+
/**
|
|
12
|
+
* The function for sorting sets inside the chart
|
|
13
|
+
* @default (circle1, circle2) => circle2.radius - circle1.radius
|
|
14
|
+
*/
|
|
15
|
+
orientationOrder?: (c1: number, c2: number) => number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ICircleProps extends IContext {
|
|
19
|
+
/**
|
|
20
|
+
* Name of the field in the data
|
|
21
|
+
* */
|
|
22
|
+
dataKey: string;
|
|
23
|
+
/** Color circle
|
|
24
|
+
@default #3AB011
|
|
25
|
+
**/
|
|
26
|
+
color?: string;
|
|
27
|
+
/** Animation duration in ms
|
|
28
|
+
* @default 500
|
|
29
|
+
*/
|
|
30
|
+
duration?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IIntersectionProps extends IContext, IFadeInOutProps {
|
|
34
|
+
/**
|
|
35
|
+
* Name of the field in the data
|
|
36
|
+
* */
|
|
37
|
+
dataKey: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare const Venn: (<T>(props: CProps<IVennProps & T>) => ReturnEl) & {
|
|
41
|
+
Circle: <T>(props: CProps<ICircleProps & T>) => ReturnEl;
|
|
42
|
+
Intersection: <T>(props: CProps<IIntersectionProps & T>) => ReturnEl;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default Venn;
|
package/src/types/context.d.ts
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -28,6 +28,12 @@ export * from './GroupBar';
|
|
|
28
28
|
export { default as StackBar } from './StackBar';
|
|
29
29
|
export * from './StackBar';
|
|
30
30
|
|
|
31
|
+
export { default as Area } from './Area';
|
|
32
|
+
export * from './Area';
|
|
33
|
+
|
|
34
|
+
export { default as StackedArea } from './StackedArea';
|
|
35
|
+
export * from './StackedArea';
|
|
36
|
+
|
|
31
37
|
export { default as Donut } from './Donut';
|
|
32
38
|
export * from './Donut';
|
|
33
39
|
|