@pie-lib/charting 4.5.17 → 5.1.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 +46 -0
- package/lib/axes.js +1 -1
- package/lib/axes.js.map +1 -1
- package/lib/bars/common/bars.js +4 -2
- package/lib/bars/common/bars.js.map +1 -1
- package/lib/chart-setup.js +211 -0
- package/lib/chart-setup.js.map +1 -0
- package/lib/chart-type.js +68 -0
- package/lib/chart-type.js.map +1 -0
- package/lib/chart.js +2 -0
- package/lib/chart.js.map +1 -1
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -1
- package/lib/line/common/drag-handle.js +1 -1
- package/lib/line/common/drag-handle.js.map +1 -1
- package/lib/line/common/line.js +6 -3
- package/lib/line/common/line.js.map +1 -1
- package/lib/plot/common/plot.js +4 -2
- package/lib/plot/common/plot.js.map +1 -1
- package/package.json +2 -2
- package/src/axes.jsx +1 -1
- package/src/bars/common/bars.jsx +5 -2
- package/src/chart-setup.jsx +163 -0
- package/src/chart-type.js +41 -0
- package/src/chart.jsx +2 -0
- package/src/index.js +4 -1
- package/src/line/common/drag-handle.jsx +2 -1
- package/src/line/common/line.jsx +5 -3
- package/src/plot/common/plot.jsx +4 -2
package/src/line/common/line.jsx
CHANGED
|
@@ -32,6 +32,7 @@ export class RawLine extends React.Component {
|
|
|
32
32
|
xBand: PropTypes.func,
|
|
33
33
|
index: PropTypes.number.isRequired,
|
|
34
34
|
graphProps: types.GraphPropsType.isRequired,
|
|
35
|
+
defineChart: PropTypes.bool,
|
|
35
36
|
data: PropTypes.arrayOf(
|
|
36
37
|
PropTypes.shape({
|
|
37
38
|
label: PropTypes.string,
|
|
@@ -77,7 +78,7 @@ export class RawLine extends React.Component {
|
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
render() {
|
|
80
|
-
const { graphProps, data, classes, CustomDraggableComponent } = this.props;
|
|
81
|
+
const { graphProps, data, classes, CustomDraggableComponent, defineChart } = this.props;
|
|
81
82
|
const { line: lineState, dragging } = this.state;
|
|
82
83
|
const { scale } = graphProps;
|
|
83
84
|
const lineToUse = dragging ? lineState : getData(data, graphProps.domain);
|
|
@@ -93,14 +94,15 @@ export class RawLine extends React.Component {
|
|
|
93
94
|
{lineToUse &&
|
|
94
95
|
lineToUse.map((point, i) => {
|
|
95
96
|
const r = 6;
|
|
96
|
-
const
|
|
97
|
+
const enableDraggable = defineChart ? true : point.interactive;
|
|
98
|
+
const Component = enableDraggable ? DraggableHandle : DragHandle;
|
|
97
99
|
|
|
98
100
|
return (
|
|
99
101
|
<Component
|
|
100
102
|
key={`point-${point.x}-${i}`}
|
|
101
103
|
x={point.x}
|
|
102
104
|
y={point.dragValue !== undefined ? point.dragValue : point.y}
|
|
103
|
-
interactive={
|
|
105
|
+
interactive={enableDraggable}
|
|
104
106
|
r={r}
|
|
105
107
|
onDragStart={() => this.setState({ dragging: true })}
|
|
106
108
|
onDrag={v =>
|
package/src/plot/common/plot.jsx
CHANGED
|
@@ -67,6 +67,7 @@ export class RawPlot extends React.Component {
|
|
|
67
67
|
interactive,
|
|
68
68
|
correctness
|
|
69
69
|
} = this.props;
|
|
70
|
+
|
|
70
71
|
const { scale, range, size } = graphProps;
|
|
71
72
|
const { max } = range || {};
|
|
72
73
|
const { dragValue } = this.state;
|
|
@@ -137,11 +138,12 @@ export class Plot extends React.Component {
|
|
|
137
138
|
onChangeCategory: PropTypes.func,
|
|
138
139
|
xBand: PropTypes.func,
|
|
139
140
|
graphProps: types.GraphPropsType.isRequired,
|
|
141
|
+
defineChart: PropTypes.bool,
|
|
140
142
|
CustomBarElement: PropTypes.func
|
|
141
143
|
};
|
|
142
144
|
|
|
143
145
|
render() {
|
|
144
|
-
const { data, graphProps, xBand, CustomBarElement, onChangeCategory } = this.props;
|
|
146
|
+
const { data, graphProps, xBand, CustomBarElement, onChangeCategory, defineChart } = this.props;
|
|
145
147
|
|
|
146
148
|
return (
|
|
147
149
|
<Group>
|
|
@@ -149,7 +151,7 @@ export class Plot extends React.Component {
|
|
|
149
151
|
<Bar
|
|
150
152
|
value={d.value}
|
|
151
153
|
label={d.label}
|
|
152
|
-
interactive={d.interactive}
|
|
154
|
+
interactive={defineChart ? true : d.interactive}
|
|
153
155
|
xBand={xBand}
|
|
154
156
|
index={index}
|
|
155
157
|
key={`bar-${d.label}-${d.value}-${index}`}
|