Skip to content

Commit 2a3b098

Browse files
authored
Merge pull request #19459 from apache/feat/break-axis
feat: axis with break
2 parents aa1ea8b + 3fa2605 commit 2a3b098

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+8424
-785
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
},
6666
"dependencies": {
6767
"tslib": "2.3.0",
68-
"zrender": "5.6.1"
68+
"zrender": "github:ecomfe/zrender#v6"
6969
},
7070
"devDependencies": {
7171
"@babel/code-frame": "7.10.4",

src/chart/bar/BarView.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ class BarView extends ChartView {
240240

241241
function createBackground(dataIndex: number) {
242242
const bgLayout = getLayout[coord.type](data, dataIndex);
243+
if (!bgLayout) {
244+
return null;
245+
}
243246
const bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
244247
bgEl.useStyle(backgroundModel.getItemStyle());
245248
// Only cartesian2d support borderRadius.
@@ -256,6 +259,9 @@ class BarView extends ChartView {
256259
.add(function (dataIndex) {
257260
const itemModel = data.getItemModel<BarDataItemOption>(dataIndex);
258261
const layout = getLayout[coord.type](data, dataIndex, itemModel);
262+
if (!layout) {
263+
return;
264+
}
259265

260266
if (drawBackground) {
261267
createBackground(dataIndex);
@@ -327,6 +333,9 @@ class BarView extends ChartView {
327333
.update(function (newIndex, oldIndex) {
328334
const itemModel = data.getItemModel<BarDataItemOption>(newIndex);
329335
const layout = getLayout[coord.type](data, newIndex, itemModel);
336+
if (!layout) {
337+
return;
338+
}
330339

331340
if (drawBackground) {
332341
let bgEl: Rect | Sector;
@@ -927,6 +936,10 @@ const getLayout: {
927936
// when calculating bar background layout.
928937
cartesian2d(data, dataIndex, itemModel?): RectLayout {
929938
const layout = data.getItemLayout(dataIndex) as RectLayout;
939+
if (!layout) {
940+
return null;
941+
}
942+
930943
const fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0;
931944

932945
// fix layout with lineWidth

src/chart/pie/labelLayout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ function constrainTextWidth(
327327

328328
const newRect = label.getBoundingRect();
329329
textRect.width = newRect.width;
330-
const margin = (label.style.margin || 0) + 2.1;
330+
const margin = ((label.style.margin as number) || 0) + 2.1;
331331
textRect.height = newRect.height + margin;
332332
textRect.y -= (textRect.height - oldHeight) / 2;
333333
}
@@ -501,7 +501,7 @@ export default function pieLabelLayout(
501501
const textRect = label.getBoundingRect().clone();
502502
textRect.applyTransform(label.getComputedTransform());
503503
// Text has a default 1px stroke. Exclude this.
504-
const margin = (label.style.margin || 0) + 2.1;
504+
const margin = ((label.style.margin as number) || 0) + 2.1;
505505
textRect.y -= margin / 2;
506506
textRect.height += margin;
507507

src/component/axis/AngleAxisView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class AngleAxisView extends AxisView {
9393
const polar = angleAxis.polar;
9494
const radiusExtent = polar.getRadiusAxis().getExtent();
9595

96-
const ticksAngles = angleAxis.getTicksCoords();
96+
const ticksAngles = angleAxis.getTicksCoords({breakTicks: 'none'});
9797
const minorTickAngles = angleAxis.getMinorTicksCoords();
9898

9999
const labels = zrUtil.map(angleAxis.getViewLabels(), function (labelItem: TickLabel) {

0 commit comments

Comments
 (0)