@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.
@@ -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 Component = point.interactive ? DraggableHandle : DragHandle;
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={point.interactive}
105
+ interactive={enableDraggable}
104
106
  r={r}
105
107
  onDragStart={() => this.setState({ dragging: true })}
106
108
  onDrag={v =>
@@ -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}`}