@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.
Files changed (154) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/lib/cjs/Area.js +71 -49
  3. package/lib/cjs/Area.js.map +1 -1
  4. package/lib/cjs/Axis.js +148 -142
  5. package/lib/cjs/Axis.js.map +1 -1
  6. package/lib/cjs/Bar.js +101 -54
  7. package/lib/cjs/Bar.js.map +1 -1
  8. package/lib/cjs/ClipPath.js +110 -0
  9. package/lib/cjs/ClipPath.js.map +1 -0
  10. package/lib/cjs/Donut.js +169 -68
  11. package/lib/cjs/Donut.js.map +1 -1
  12. package/lib/cjs/Dots.js +55 -21
  13. package/lib/cjs/Dots.js.map +1 -1
  14. package/lib/cjs/GroupBar.js +7 -6
  15. package/lib/cjs/GroupBar.js.map +1 -1
  16. package/lib/cjs/HorizontalBar.js +72 -45
  17. package/lib/cjs/HorizontalBar.js.map +1 -1
  18. package/lib/cjs/Hover.js +46 -47
  19. package/lib/cjs/Hover.js.map +1 -1
  20. package/lib/cjs/Line.js +63 -41
  21. package/lib/cjs/Line.js.map +1 -1
  22. package/lib/cjs/Plot.js +16 -29
  23. package/lib/cjs/Plot.js.map +1 -1
  24. package/lib/cjs/ResponsiveContainer.js +13 -9
  25. package/lib/cjs/ResponsiveContainer.js.map +1 -1
  26. package/lib/cjs/StackBar.js +6 -6
  27. package/lib/cjs/StackBar.js.map +1 -1
  28. package/lib/cjs/StackedArea.js +8 -9
  29. package/lib/cjs/StackedArea.js.map +1 -1
  30. package/lib/cjs/Tooltip.js +49 -75
  31. package/lib/cjs/Tooltip.js.map +1 -1
  32. package/lib/cjs/Venn.js +235 -0
  33. package/lib/cjs/Venn.js.map +1 -0
  34. package/lib/cjs/index.js +8 -0
  35. package/lib/cjs/index.js.map +1 -1
  36. package/lib/cjs/style/area.shadow.css +11 -10
  37. package/lib/cjs/style/bar.shadow.css +4 -0
  38. package/lib/cjs/style/donut.shadow.css +1 -0
  39. package/lib/cjs/style/dot.shadow.css +19 -0
  40. package/lib/cjs/style/line.shadow.css +4 -15
  41. package/lib/cjs/style/tooltip.shadow.css +1 -0
  42. package/lib/cjs/style/venn.shadow.css +23 -0
  43. package/lib/cjs/utils.js +8 -1
  44. package/lib/cjs/utils.js.map +1 -1
  45. package/lib/es6/Area.js +72 -50
  46. package/lib/es6/Area.js.map +1 -1
  47. package/lib/es6/Axis.js +149 -143
  48. package/lib/es6/Axis.js.map +1 -1
  49. package/lib/es6/Bar.js +100 -54
  50. package/lib/es6/Bar.js.map +1 -1
  51. package/lib/es6/ClipPath.js +91 -0
  52. package/lib/es6/ClipPath.js.map +1 -0
  53. package/lib/es6/Donut.js +167 -67
  54. package/lib/es6/Donut.js.map +1 -1
  55. package/lib/es6/Dots.js +51 -20
  56. package/lib/es6/Dots.js.map +1 -1
  57. package/lib/es6/GroupBar.js +7 -6
  58. package/lib/es6/GroupBar.js.map +1 -1
  59. package/lib/es6/HorizontalBar.js +72 -45
  60. package/lib/es6/HorizontalBar.js.map +1 -1
  61. package/lib/es6/Hover.js +47 -48
  62. package/lib/es6/Hover.js.map +1 -1
  63. package/lib/es6/Line.js +65 -43
  64. package/lib/es6/Line.js.map +1 -1
  65. package/lib/es6/Plot.js +17 -29
  66. package/lib/es6/Plot.js.map +1 -1
  67. package/lib/es6/ResponsiveContainer.js +13 -7
  68. package/lib/es6/ResponsiveContainer.js.map +1 -1
  69. package/lib/es6/StackBar.js +6 -6
  70. package/lib/es6/StackBar.js.map +1 -1
  71. package/lib/es6/StackedArea.js +8 -9
  72. package/lib/es6/StackedArea.js.map +1 -1
  73. package/lib/es6/Tooltip.js +52 -76
  74. package/lib/es6/Tooltip.js.map +1 -1
  75. package/lib/es6/Venn.js +217 -0
  76. package/lib/es6/Venn.js.map +1 -0
  77. package/lib/es6/index.js +1 -0
  78. package/lib/es6/index.js.map +1 -1
  79. package/lib/es6/style/area.shadow.css +11 -10
  80. package/lib/es6/style/bar.shadow.css +4 -0
  81. package/lib/es6/style/donut.shadow.css +1 -0
  82. package/lib/es6/style/dot.shadow.css +19 -0
  83. package/lib/es6/style/line.shadow.css +4 -15
  84. package/lib/es6/style/tooltip.shadow.css +1 -0
  85. package/lib/es6/style/venn.shadow.css +23 -0
  86. package/lib/es6/utils.js +6 -1
  87. package/lib/es6/utils.js.map +1 -1
  88. package/lib/types/Area.d.ts +7 -8
  89. package/lib/types/Axis.d.ts +6 -6
  90. package/lib/types/Bar.d.ts +7 -3
  91. package/lib/types/ClipPath.d.ts +26 -0
  92. package/lib/types/Donut.d.ts +12 -2
  93. package/lib/types/GroupBar.d.ts +2 -2
  94. package/lib/types/HorizontalBar.d.ts +7 -3
  95. package/lib/types/Hover.d.ts +2 -2
  96. package/lib/types/Line.d.ts +9 -4
  97. package/{src/types/Plot.ts → lib/types/Plot.d.ts} +2 -2
  98. package/lib/types/ResponsiveContainer.d.ts +1 -1
  99. package/lib/types/StackBar.d.ts +3 -11
  100. package/lib/types/StackedArea.d.ts +7 -6
  101. package/lib/types/Tooltip.d.ts +4 -4
  102. package/lib/types/Venn.d.ts +45 -0
  103. package/lib/types/context.d.ts +1 -1
  104. package/lib/types/index.d.ts +6 -0
  105. package/package.json +10 -5
  106. package/src/Area.js +43 -14
  107. package/src/Axis.js +24 -22
  108. package/src/Bar.js +69 -24
  109. package/src/ClipPath.js +36 -0
  110. package/src/Donut.js +84 -12
  111. package/src/Dots.js +36 -20
  112. package/src/GroupBar.js +1 -0
  113. package/src/HorizontalBar.js +49 -22
  114. package/src/Hover.js +3 -3
  115. package/src/Line.js +41 -13
  116. package/src/Plot.js +3 -7
  117. package/src/ResponsiveContainer.js +3 -3
  118. package/src/StackBar.js +1 -1
  119. package/src/StackedArea.js +3 -2
  120. package/src/Tooltip.js +11 -12
  121. package/src/Venn.js +112 -0
  122. package/src/index.js +1 -0
  123. package/src/style/area.shadow.css +11 -10
  124. package/src/style/bar.shadow.css +4 -0
  125. package/src/style/donut.shadow.css +1 -0
  126. package/src/style/dot.shadow.css +19 -0
  127. package/src/style/line.shadow.css +4 -15
  128. package/src/style/tooltip.shadow.css +1 -0
  129. package/src/style/venn.shadow.css +23 -0
  130. package/src/types/Area.d.ts +7 -8
  131. package/src/types/Axis.d.ts +6 -6
  132. package/src/types/Bar.d.ts +7 -3
  133. package/src/types/ClipPath.d.ts +26 -0
  134. package/src/types/Donut.d.ts +12 -2
  135. package/src/types/GroupBar.d.ts +2 -2
  136. package/src/types/HorizontalBar.d.ts +7 -3
  137. package/src/types/Hover.d.ts +2 -2
  138. package/src/types/Line.d.ts +9 -4
  139. package/src/types/Plot.d.ts +16 -0
  140. package/src/types/ResponsiveContainer.d.ts +1 -1
  141. package/src/types/StackBar.d.ts +3 -11
  142. package/src/types/StackedArea.d.ts +7 -6
  143. package/src/types/Tooltip.d.ts +4 -4
  144. package/src/types/Venn.d.ts +45 -0
  145. package/src/types/context.d.ts +1 -1
  146. package/src/types/index.d.ts +6 -0
  147. package/src/utils.js +7 -1
  148. package/lib/cjs/style/chart.shadow.css +0 -4
  149. package/lib/cjs/types/Plot.js +0 -2
  150. package/lib/cjs/types/Plot.js.map +0 -1
  151. package/lib/es6/style/chart.shadow.css +0 -4
  152. package/lib/es6/types/Plot.js +0 -2
  153. package/lib/es6/types/Plot.js.map +0 -1
  154. 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
- SDot {
5
- stroke-width: 2px;
6
- stroke: #fff;
7
- r: 6px;
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
- SDot[active] {
15
- r: 8px;
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 {
@@ -1,6 +1,10 @@
1
1
  @import '@semcore/utils/style/var.css';
2
2
 
3
3
  SBar {
4
+ fill: var(--color);
5
+ transition-property: height, width, y;
6
+ transition-duration: var(--duration);
7
+ transition-timing-function: ease-in-out;
4
8
  }
5
9
 
6
10
  SBar[hide] {
@@ -1,5 +1,6 @@
1
1
  SPie {
2
2
  stroke: #ffffff;
3
+ fill: var(--color);
3
4
  }
4
5
 
5
6
  SLabel {
@@ -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
- /*stroke-linecap: round;*/
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);
@@ -27,4 +27,5 @@ SDot {
27
27
  height: 8px;
28
28
  border-radius: 50%;
29
29
  margin-right: 8px;
30
+ background: var(--color);
30
31
  }
@@ -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
+ }
@@ -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 Axis x */
6
+ /** Field from data for XAxis */
7
7
  x?: string;
8
- /** Field from data for Axis y for line*/
8
+ /** Field from data for YAxis*/
9
9
  y?: string;
10
- /** Color line
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 {
@@ -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 to ticks axis */
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 to ticks axis */
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 to ticks axis */
31
+ /** Values for axis ticks */
32
32
  ticks?: any[];
33
33
  }
34
34
 
35
35
  export interface IAxisGridProps extends IContext {
36
- /** Values to ticks axis */
36
+ /** Values for axis ticks */
37
37
  ticks?: any[];
38
38
  }
39
39
 
@@ -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 Axis x */
5
+ /** Field from data for XAxis */
6
6
  x?: string;
7
- /** Field from data for Axis y */
7
+ /** Field from data for YAxis */
8
8
  y?: string;
9
- /** Color line
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;
@@ -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
- /* Inner radius */
5
+ /** Inner radius
6
+ * @default 0
7
+ * */
6
8
  innerRadius?: number;
7
- /* Semi donut */
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
  **/
@@ -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 Axis x */
7
+ /** Field from data for XAxis */
8
8
  x?: string;
9
- /** Field from data for Axis y */
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 Axis x */
6
+ /** Field from data for XAxis */
7
7
  x?: string;
8
- /** Field from data for Axis y */
8
+ /** Field from data for YAxis */
9
9
  y?: string;
10
- /** Color line
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>(
@@ -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 Axis x */
5
+ /** Field from data for XAxis */
6
6
  x?: string;
7
- /** Field from data for Axis y */
7
+ /** Field from data for YAxis */
8
8
  y?: string;
9
9
  }
10
10
 
@@ -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 Axis x */
7
+ /** Field from data for XAxis */
7
8
  x?: string;
8
- /** Field from data for Axis y */
9
+ /** Field from data for YAxis */
9
10
  y?: string;
10
- /** Color line
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 change size block */
7
+ /** Callback which will be called after changing the block size */
8
8
  onResize?: (size: [number, number], entries: ResizeObserverEntry[]) => void;
9
9
  }
10
10
 
@@ -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
- /** Data for graphic */
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 Axis y */
9
+ /** Field from data for YAxis */
12
10
  y?: string;
13
11
  /** Stack generators
14
12
  * @default d3.stack() */
15
- stack?: 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 { IAreaProps } from './Area';
3
+ import Area from './Area';
4
4
 
5
5
  export interface IStackedAreaProps extends IContext {
6
- /** Data for graphic */
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 Axis y */
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: <T>(props: CProps<IAreaProps & T>) => ReturnEl;
23
+ Area: typeof Area;
23
24
  };
24
25
 
25
26
  export default StackedArea;
@@ -1,13 +1,13 @@
1
- import { IPopperProps, IPopperTriggerProps } from '@semcore/popper';
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 Axis x */
8
+ /** Field from data for XAxis */
9
9
  x?: string;
10
- /** Field from data for Axis y */
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;
@@ -1,6 +1,6 @@
1
1
  export default interface IContext {
2
2
  /** Data for graphic */
3
- data?: any[];
3
+ data?: any;
4
4
  /** Scale for svg element */
5
5
  scale?: any[];
6
6
  }
@@ -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