victory-core 30.6.1 → 31.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 (71) hide show
  1. package/README.md +13 -12
  2. package/dist/victory-core.js +1083 -842
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/victory-animation/victory-animation.js +26 -21
  5. package/es/victory-label/victory-label.js +8 -2
  6. package/es/victory-primitives/path-helpers.js +1 -1
  7. package/es/victory-transition/victory-transition.js +11 -6
  8. package/es/victory-util/add-events.js +66 -38
  9. package/es/victory-util/axis.js +35 -9
  10. package/es/victory-util/data.js +24 -9
  11. package/es/victory-util/domain.js +15 -7
  12. package/es/victory-util/events.js +1 -1
  13. package/es/victory-util/helpers.js +17 -5
  14. package/es/victory-util/label-helpers.js +3 -5
  15. package/es/victory-util/textsize.js +20 -20
  16. package/es/victory-util/transitions.js +16 -16
  17. package/es/victory-util/wrapper.js +56 -19
  18. package/lib/victory-animation/victory-animation.js +27 -21
  19. package/lib/victory-label/victory-label.js +8 -2
  20. package/lib/victory-primitives/path-helpers.js +1 -1
  21. package/lib/victory-transition/victory-transition.js +12 -6
  22. package/lib/victory-util/add-events.js +66 -38
  23. package/lib/victory-util/axis.js +36 -9
  24. package/lib/victory-util/data.js +25 -9
  25. package/lib/victory-util/domain.js +16 -8
  26. package/lib/victory-util/events.js +1 -1
  27. package/lib/victory-util/helpers.js +17 -5
  28. package/lib/victory-util/label-helpers.js +3 -5
  29. package/lib/victory-util/textsize.js +20 -20
  30. package/lib/victory-util/transitions.js +16 -16
  31. package/lib/victory-util/wrapper.js +56 -19
  32. package/package.json +1 -1
  33. package/src/victory-animation/util.js +47 -45
  34. package/src/victory-animation/victory-animation.js +66 -38
  35. package/src/victory-clip-container/victory-clip-container.js +44 -31
  36. package/src/victory-container/victory-container.js +35 -21
  37. package/src/victory-label/victory-label.js +55 -71
  38. package/src/victory-portal/portal.js +1 -1
  39. package/src/victory-portal/victory-portal.js +10 -7
  40. package/src/victory-primitives/arc.js +15 -4
  41. package/src/victory-primitives/border.js +26 -5
  42. package/src/victory-primitives/circle.js +14 -3
  43. package/src/victory-primitives/clip-path.js +2 -7
  44. package/src/victory-primitives/line-segment.js +28 -5
  45. package/src/victory-primitives/line.js +15 -2
  46. package/src/victory-primitives/path-helpers.js +6 -7
  47. package/src/victory-primitives/point.js +30 -11
  48. package/src/victory-primitives/rect.js +19 -3
  49. package/src/victory-primitives/text.js +21 -11
  50. package/src/victory-primitives/tspan.js +6 -4
  51. package/src/victory-primitives/whisker.js +13 -6
  52. package/src/victory-theme/grayscale.js +153 -128
  53. package/src/victory-theme/material.js +178 -149
  54. package/src/victory-transition/victory-transition.js +31 -25
  55. package/src/victory-util/add-events.js +113 -75
  56. package/src/victory-util/axis.js +89 -35
  57. package/src/victory-util/collection.js +3 -8
  58. package/src/victory-util/common-props.js +42 -36
  59. package/src/victory-util/data.js +78 -43
  60. package/src/victory-util/domain.js +68 -46
  61. package/src/victory-util/events.js +129 -112
  62. package/src/victory-util/helpers.js +36 -16
  63. package/src/victory-util/immutable.js +12 -7
  64. package/src/victory-util/label-helpers.js +34 -18
  65. package/src/victory-util/prop-types.js +11 -23
  66. package/src/victory-util/scale.js +2 -3
  67. package/src/victory-util/selection.js +4 -5
  68. package/src/victory-util/style.js +17 -10
  69. package/src/victory-util/textsize.js +35 -31
  70. package/src/victory-util/transitions.js +53 -35
  71. package/src/victory-util/wrapper.js +112 -56
@@ -14,14 +14,8 @@ export default class Text extends React.Component {
14
14
  style: PropTypes.object,
15
15
  title: PropTypes.string,
16
16
  transform: PropTypes.string,
17
- x: PropTypes.oneOfType([
18
- PropTypes.number,
19
- PropTypes.string
20
- ]),
21
- y: PropTypes.oneOfType([
22
- PropTypes.number,
23
- PropTypes.string
24
- ])
17
+ x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
18
+ y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
25
19
  };
26
20
 
27
21
  shouldComponentUpdate(nextProps) {
@@ -30,13 +24,29 @@ export default class Text extends React.Component {
30
24
 
31
25
  render() {
32
26
  const {
33
- x, y, dx, dy, events, className, children, style, title, desc, transform, direction
27
+ x,
28
+ y,
29
+ dx,
30
+ dy,
31
+ events,
32
+ className,
33
+ children,
34
+ style,
35
+ title,
36
+ desc,
37
+ transform,
38
+ direction
34
39
  } = this.props;
35
40
  return (
36
41
  <text
37
42
  direction={direction}
38
- className={className} x={x} dx={dx} y={y} dy={dy}
39
- transform={transform} style={style}
43
+ className={className}
44
+ x={x}
45
+ dx={dx}
46
+ y={y}
47
+ dy={dy}
48
+ transform={transform}
49
+ style={style}
40
50
  {...events}
41
51
  >
42
52
  {title && <title>{title}</title>}
@@ -20,12 +20,14 @@ export default class TSpan extends React.Component {
20
20
  }
21
21
 
22
22
  render() {
23
- const {
24
- x, y, dx, dy, events, className, style, textAnchor, content
25
- } = this.props;
23
+ const { x, y, dx, dy, events, className, style, textAnchor, content } = this.props;
26
24
  return (
27
25
  <tspan
28
- x={x} y={y} dx={dx} dy={dy} textAnchor={textAnchor}
26
+ x={x}
27
+ y={y}
28
+ dx={dx}
29
+ dy={dy}
30
+ textAnchor={textAnchor}
29
31
  className={className}
30
32
  style={style}
31
33
  {...events}
@@ -6,7 +6,6 @@ import Line from "./line";
6
6
  import { assign } from "lodash";
7
7
 
8
8
  export default class Whisker extends React.Component {
9
-
10
9
  static propTypes = {
11
10
  ...CommonProps.primitiveProps,
12
11
  groupComponent: PropTypes.element,
@@ -23,17 +22,25 @@ export default class Whisker extends React.Component {
23
22
  y1: PropTypes.number,
24
23
  y2: PropTypes.number
25
24
  })
26
- }
25
+ };
27
26
 
28
27
  static defaultProps = {
29
28
  groupComponent: <g />,
30
- lineComponent: <Line/>
31
- }
29
+ lineComponent: <Line />
30
+ };
32
31
 
33
32
  render() {
34
33
  const {
35
- groupComponent, lineComponent, events, className, majorWhisker, minorWhisker,
36
- datum, active, transform, clipPath
34
+ groupComponent,
35
+ lineComponent,
36
+ events,
37
+ className,
38
+ majorWhisker,
39
+ minorWhisker,
40
+ datum,
41
+ active,
42
+ transform,
43
+ clipPath
37
44
  } = this.props;
38
45
  const style = Helpers.evaluateStyle(this.props.style, datum, active);
39
46
  const baseProps = { style, events, className, transform, clipPath };
@@ -3,15 +3,7 @@ import { assign } from "lodash";
3
3
  // *
4
4
  // * Colors
5
5
  // *
6
- const colors = [
7
- "#252525",
8
- "#525252",
9
- "#737373",
10
- "#969696",
11
- "#bdbdbd",
12
- "#d9d9d9",
13
- "#f0f0f0"
14
- ];
6
+ const colors = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
15
7
 
16
8
  const charcoal = "#252525";
17
9
  const grey = "#969696";
@@ -50,92 +42,113 @@ const strokeLinecap = "round";
50
42
  const strokeLinejoin = "round";
51
43
 
52
44
  export default {
53
- area: assign({
54
- style: {
55
- data: {
56
- fill: charcoal
57
- },
58
- labels: centeredLabelStyles
59
- }
60
- }, baseProps),
61
- axis: assign({
62
- style: {
63
- axis: {
64
- fill: "transparent",
65
- stroke: charcoal,
66
- strokeWidth: 1,
67
- strokeLinecap,
68
- strokeLinejoin
69
- },
70
- axisLabel: assign({}, centeredLabelStyles, {
71
- padding: 25
72
- }),
73
- grid: {
74
- fill: "none",
75
- stroke: "none",
76
- pointerEvents: "painted"
77
- },
78
- ticks: {
79
- fill: "transparent",
80
- size: 1,
81
- stroke: "transparent"
82
- },
83
- tickLabels: baseLabelStyles
84
- }
85
- }, baseProps),
86
- bar: assign({
87
- style: {
88
- data: {
89
- fill: charcoal,
90
- padding: 8,
91
- strokeWidth: 0
45
+ area: assign(
46
+ {
47
+ style: {
48
+ data: {
49
+ fill: charcoal
50
+ },
51
+ labels: centeredLabelStyles
52
+ }
53
+ },
54
+ baseProps
55
+ ),
56
+ axis: assign(
57
+ {
58
+ style: {
59
+ axis: {
60
+ fill: "transparent",
61
+ stroke: charcoal,
62
+ strokeWidth: 1,
63
+ strokeLinecap,
64
+ strokeLinejoin
65
+ },
66
+ axisLabel: assign({}, centeredLabelStyles, {
67
+ padding: 25
68
+ }),
69
+ grid: {
70
+ fill: "none",
71
+ stroke: "none",
72
+ pointerEvents: "painted"
73
+ },
74
+ ticks: {
75
+ fill: "transparent",
76
+ size: 1,
77
+ stroke: "transparent"
78
+ },
79
+ tickLabels: baseLabelStyles
80
+ }
81
+ },
82
+ baseProps
83
+ ),
84
+ bar: assign(
85
+ {
86
+ style: {
87
+ data: {
88
+ fill: charcoal,
89
+ padding: 8,
90
+ strokeWidth: 0
91
+ },
92
+ labels: baseLabelStyles
93
+ }
94
+ },
95
+ baseProps
96
+ ),
97
+ boxplot: assign(
98
+ {
99
+ style: {
100
+ max: { padding: 8, stroke: charcoal, strokeWidth: 1 },
101
+ maxLabels: baseLabelStyles,
102
+ median: { padding: 8, stroke: charcoal, strokeWidth: 1 },
103
+ medianLabels: baseLabelStyles,
104
+ min: { padding: 8, stroke: charcoal, strokeWidth: 1 },
105
+ minLabels: baseLabelStyles,
106
+ q1: { padding: 8, fill: grey },
107
+ q1Labels: baseLabelStyles,
108
+ q3: { padding: 8, fill: grey },
109
+ q3Labels: baseLabelStyles
92
110
  },
93
- labels: baseLabelStyles
94
- }
95
- }, baseProps),
96
- boxplot: assign({
97
- style: {
98
- max: { padding: 8, stroke: charcoal, strokeWidth: 1 },
99
- maxLabels: baseLabelStyles,
100
- median: { padding: 8, stroke: charcoal, strokeWidth: 1 },
101
- medianLabels: baseLabelStyles,
102
- min: { padding: 8, stroke: charcoal, strokeWidth: 1 },
103
- minLabels: baseLabelStyles,
104
- q1: { padding: 8, fill: grey },
105
- q1Labels: baseLabelStyles,
106
- q3: { padding: 8, fill: grey },
107
- q3Labels: baseLabelStyles
111
+ boxWidth: 20
108
112
  },
109
- boxWidth: 20
110
- }, baseProps),
111
- candlestick: assign({
112
- style: {
113
- data: {
114
- stroke: charcoal,
115
- strokeWidth: 1
113
+ baseProps
114
+ ),
115
+ candlestick: assign(
116
+ {
117
+ style: {
118
+ data: {
119
+ stroke: charcoal,
120
+ strokeWidth: 1
121
+ },
122
+ labels: centeredLabelStyles
116
123
  },
117
- labels: centeredLabelStyles
124
+ candleColors: {
125
+ positive: "#ffffff",
126
+ negative: charcoal
127
+ }
118
128
  },
119
- candleColors: {
120
- positive: "#ffffff",
121
- negative: charcoal
122
- }
123
- }, baseProps),
129
+ baseProps
130
+ ),
124
131
  chart: baseProps,
125
- errorbar: assign({
126
- borderWidth: 8,
127
- style: {
128
- data: {
129
- fill: "transparent",
130
- stroke: charcoal,
131
- strokeWidth: 2
132
- },
133
- labels: centeredLabelStyles
134
- }
135
- }, baseProps),
136
- group: assign({
137
- colorScale: colors
138
- }, baseProps),
132
+ errorbar: assign(
133
+ {
134
+ borderWidth: 8,
135
+ style: {
136
+ data: {
137
+ fill: "transparent",
138
+ stroke: charcoal,
139
+ strokeWidth: 2
140
+ },
141
+ labels: centeredLabelStyles
142
+ }
143
+ },
144
+ baseProps
145
+ ),
146
+ group: assign(
147
+ {
148
+ colorScale: colors
149
+ },
150
+ baseProps
151
+ ),
139
152
  legend: {
140
153
  colorScale: colors,
141
154
  gutter: 10,
@@ -149,16 +162,19 @@ export default {
149
162
  title: assign({}, baseLabelStyles, { padding: 5 })
150
163
  }
151
164
  },
152
- line: assign({
153
- style: {
154
- data: {
155
- fill: "transparent",
156
- stroke: charcoal,
157
- strokeWidth: 2
158
- },
159
- labels: centeredLabelStyles
160
- }
161
- }, baseProps),
165
+ line: assign(
166
+ {
167
+ style: {
168
+ data: {
169
+ fill: "transparent",
170
+ stroke: charcoal,
171
+ strokeWidth: 2
172
+ },
173
+ labels: centeredLabelStyles
174
+ }
175
+ },
176
+ baseProps
177
+ ),
162
178
  pie: {
163
179
  style: {
164
180
  data: {
@@ -173,19 +189,25 @@ export default {
173
189
  height: 400,
174
190
  padding: 50
175
191
  },
176
- scatter: assign({
177
- style: {
178
- data: {
179
- fill: charcoal,
180
- stroke: "transparent",
181
- strokeWidth: 0
182
- },
183
- labels: centeredLabelStyles
184
- }
185
- }, baseProps),
186
- stack: assign({
187
- colorScale: colors
188
- }, baseProps),
192
+ scatter: assign(
193
+ {
194
+ style: {
195
+ data: {
196
+ fill: charcoal,
197
+ stroke: "transparent",
198
+ strokeWidth: 0
199
+ },
200
+ labels: centeredLabelStyles
201
+ }
202
+ },
203
+ baseProps
204
+ ),
205
+ stack: assign(
206
+ {
207
+ colorScale: colors
208
+ },
209
+ baseProps
210
+ ),
189
211
  tooltip: {
190
212
  style: assign({}, centeredLabelStyles, { padding: 5, pointerEvents: "none" }),
191
213
  flyoutStyle: {
@@ -197,20 +219,23 @@ export default {
197
219
  cornerRadius: 5,
198
220
  pointerLength: 10
199
221
  },
200
- voronoi: assign({
201
- style: {
202
- data: {
203
- fill: "transparent",
204
- stroke: "transparent",
205
- strokeWidth: 0
206
- },
207
- labels: assign({}, centeredLabelStyles, { padding: 5, pointerEvents: "none" }),
208
- flyout: {
209
- stroke: charcoal,
210
- strokeWidth: 1,
211
- fill: "#f0f0f0",
212
- pointerEvents: "none"
222
+ voronoi: assign(
223
+ {
224
+ style: {
225
+ data: {
226
+ fill: "transparent",
227
+ stroke: "transparent",
228
+ strokeWidth: 0
229
+ },
230
+ labels: assign({}, centeredLabelStyles, { padding: 5, pointerEvents: "none" }),
231
+ flyout: {
232
+ stroke: charcoal,
233
+ strokeWidth: 1,
234
+ fill: "#f0f0f0",
235
+ pointerEvents: "none"
236
+ }
213
237
  }
214
- }
215
- }, baseProps)
238
+ },
239
+ baseProps
240
+ )
216
241
  };