@pie-lib/charting 4.5.11-next.351 → 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/lib/axes.js +116 -25
- package/lib/axes.js.map +1 -1
- package/lib/bars/bar.js.map +1 -1
- package/lib/bars/common/bars.js.map +1 -1
- package/lib/bars/histogram.js.map +1 -1
- package/lib/chart-types.js.map +1 -1
- package/lib/chart.js +8 -8
- package/lib/chart.js.map +1 -1
- package/lib/common/drag-handle.js.map +1 -1
- package/lib/common/styles.js.map +1 -1
- package/lib/grid.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/line/common/drag-handle.js.map +1 -1
- package/lib/line/common/line.js.map +1 -1
- package/lib/line/line-cross.js.map +1 -1
- package/lib/line/line-dot.js.map +1 -1
- package/lib/mark-label.js.map +1 -1
- package/lib/plot/common/plot.js.map +1 -1
- package/lib/plot/dot.js.map +1 -1
- package/lib/plot/line.js.map +1 -1
- package/lib/tool-menu.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/axes.jsx +99 -2
- package/src/chart.jsx +9 -6
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,
|
|
129
|
+
const { data, defineChart } = this.props;
|
|
131
130
|
|
|
132
131
|
return data
|
|
133
132
|
? data.map(d => ({
|
|
134
133
|
...d,
|
|
135
|
-
|
|
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 +
|
|
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}
|