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(line): line segment styling #18052

Closed
wants to merge 1 commit into from
Closed

feat(line): line segment styling #18052

wants to merge 1 commit into from

Conversation

pe-3
Copy link

@pe-3 pe-3 commented Dec 11, 2022

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

This PR will add line segment styling to line chart.

Fixed issues

#17138

Details

Before: What was the problem?

We cannot set segment styles for a line chart, so the entire line has to use the same style, making it monotonous. To achieve this effect, we need to increase the complexity of the configuration, which is not elegant. Therefore, at the source code level, we need to implement this effect to provide users with a direct configuration option to easily configure such segmented effects.

After: How does it behave after the fixing?

Users can configure segment styles like this

{
    linePieces: [
         { 
              segment: [1, 3],
              lineStyle: {
                   type: "solid",
                   color: 'red'
              }
         },
        {
             segment: ({dataIndex})= dataIndex >= 6 && dataIndex <= 9,
             lineStyle: {
                   type: "dashed",
                   color: 'cyan',
                   width:'4'
             }
        }
    ]
}

The effect will be like this:
image

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

@echarts-bot echarts-bot bot added PR: awaiting doc Document changes is required for this PR. PR: awaiting review labels Dec 11, 2022
@echarts-bot
Copy link

echarts-bot bot commented Dec 11, 2022

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

dataVal: number
}

type LineSegmentOption = [number, number] | ((params: LineSegmentCallBackParams) => boolean);
Copy link
Contributor

Choose a reason for hiding this comment

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

What does segment: [1, 3] mean? The 1st and the 3rd line or the lines between the 1st and the 3rd data?

Copy link
Author

Choose a reason for hiding this comment

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

Represent the line segment to be selected with the index of the start point and end point.

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

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

This PR seems not to be ready yet. It can be marked as a draft.

@Ovilia Ovilia marked this pull request as draft December 13, 2022 07:09
@yassilah
Copy link
Contributor

yassilah commented Mar 8, 2024

This feature would be extremely useful at least to be able to style the line to connect null values. I'm happy to take it over if need be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: awaiting doc Document changes is required for this PR. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants