Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pie): two new alignTo layouts #11715

Merged
merged 10 commits into from Nov 28, 2019
Merged

feat(pie): two new alignTo layouts #11715

merged 10 commits into from Nov 28, 2019

Conversation

Ovilia
Copy link
Contributor

@Ovilia Ovilia commented Nov 26, 2019

feat(pie): support align to edge and labelLine mode #11381

Before:

image

After (two new layouts proposed):

image

image

API changes

The following are new options in this PR:

label: {
    alignTo: 'none', // 'none', 'labelLine', 'edge'. Works only when position is 'outer'. 'none' is for the previous design.

    // Closest distance between label and chart edge.
    // Works only position is 'outer' and alignTo is 'labelLine' or 'edge'.
    margin: '25%',

    // Works only position is 'outer' and alignTo is not 'edge'.
    bleedMargin: 10

    // Distance between text and labelLine. Previously, it's hard-coded as 3 in `labelLaout.js`.
    distanceToLabelLine: 5
}

For labelLine and edge, labelLine.length2 is used as the minimum length2.

Result and test

test/pie-alignTo.html provides test cases with different length2 and margin.

Limitations and todo

@@ -179,10 +179,10 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight, viewLef
}
else {
if (layout.x < cx) {
targetTextWidth = layout.x - viewLeft - layout.labelMargin;
targetTextWidth = layout.x - viewLeft - layout.bleedingMargin;
Copy link
Contributor

@pissang pissang Nov 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bleedingMargin should be bleedMargin?

@Ovilia Ovilia merged commit 02b55aa into master Nov 28, 2019
@Ovilia Ovilia deleted the fix-pie-align branch Nov 28, 2019
Ovilia added a commit to apache/echarts-examples that referenced this pull request Dec 5, 2019
Ovilia added a commit to apache/echarts-doc that referenced this pull request Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants