@pie-lib/charting 4.5.11-next.258 → 4.5.11-next.405

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/src/chart.jsx CHANGED
@@ -47,7 +47,6 @@ export class Chart extends React.Component {
47
47
  title: PropTypes.string,
48
48
  onDataChange: PropTypes.func,
49
49
  addCategoryEnabled: PropTypes.bool,
50
- editCategoryEnabled: PropTypes.bool,
51
50
  categoryDefaultLabel: PropTypes.string,
52
51
  theme: PropTypes.object
53
52
  };
@@ -127,13 +126,12 @@ export class Chart extends React.Component {
127
126
  };
128
127
 
129
128
  getFilteredCategories = () => {
130
- const { data, editCategoryEnabled, addCategoryEnabled } = this.props;
129
+ const { data, defineChart } = this.props;
131
130
 
132
131
  return data
133
132
  ? data.map(d => ({
134
133
  ...d,
135
- editable: !d.initial || (d.initial && editCategoryEnabled),
136
- deletable: !d.initial || (d.initial && addCategoryEnabled)
134
+ deletable: defineChart || d.deletable
137
135
  }))
138
136
  : [];
139
137
  };
@@ -150,6 +148,8 @@ export class Chart extends React.Component {
150
148
  theme
151
149
  } = this.props;
152
150
  let { chartType } = this.props;
151
+
152
+ const defineChart = this.props.defineChart || false;
153
153
  const { width, height } = size || {};
154
154
 
155
155
  const { ChartComponent } = this.getChart();
@@ -176,9 +176,10 @@ export class Chart extends React.Component {
176
176
  () => this.rootNode
177
177
  )
178
178
  };
179
+
179
180
  log('[render] common:', common);
180
181
 
181
- const maskSize = { x: -10, y: -10, width: width + 20, height: height + 20 };
182
+ const maskSize = { x: -10, y: -10, width: width + 20, height: height + 80 };
182
183
  const { scale } = common.graphProps;
183
184
  const xBand = dataToXBand(scale.x, categories, width, chartType);
184
185
 
@@ -189,12 +190,13 @@ export class Chart extends React.Component {
189
190
  const bandWidth = xBand.bandwidth();
190
191
  // for chartType "line", bandWidth will be 0, so we have to calculate it
191
192
  const barWidth = bandWidth || scale.x(correctValues.domain.max) / categories.length;
193
+ const increaseHeight = defineChart ? 80 : 0;
192
194
 
193
195
  // if there are many categories, we have to rotate their names in order to fit
194
196
  // and we have to add extra value on top of some items
195
197
  const top = getTopPadding(barWidth);
196
198
  const rootCommon = cloneDeep(common);
197
- rootCommon.graphProps.size.height += top;
199
+ rootCommon.graphProps.size.height += top + increaseHeight;
198
200
 
199
201
  return (
200
202
  <div className={classNames(classes.class, className)}>
@@ -214,6 +216,7 @@ export class Chart extends React.Component {
214
216
  />
215
217
  <ChartAxes
216
218
  {...common}
219
+ defineChart={defineChart}
217
220
  categories={categories}
218
221
  xBand={xBand}
219
222
  leftAxis={leftAxis}