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

Segment : borderColor behaviour is not correct #10736

Open
ArkeshGKalathiya opened this issue Oct 2, 2022 · 15 comments
Open

Segment : borderColor behaviour is not correct #10736

ArkeshGKalathiya opened this issue Oct 2, 2022 · 15 comments

Comments

@ArkeshGKalathiya
Copy link

Expected behavior

It should mark each line segment with alternate color

Current behavior

Colors are not applied properly to line segment

Reproducible sample

https://codepen.io/arkesh486855/pen/qBYYjJa

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

latest

Browser name and version

No response

Link to your project

No response

@raji2004
Copy link

raji2004 commented Oct 2, 2022

Can I be assigned this issue?

@pakprogramer786
Copy link

Hi, If you are looking for change the line segment color base on the label. so you can use.

...
segment: {
        borderColor: (ctx) => (ctx.chart.data.labels[ctx.p0DataIndex])
      }
...

@ArkeshGKalathiya
Copy link
Author

@pakprogramer786

Thanks for the response, Let me change name of the labels, as it's confusing. I don't want to change color based on the label, but based on the return of borderColor function.

@etimberg
Copy link
Member

etimberg commented Oct 2, 2022

I see the line segments changing colour when I open the reproduce above

@ArkeshGKalathiya
Copy link
Author

ArkeshGKalathiya commented Oct 2, 2022

@etimberg

But it does not include repeating color second time, which is "red", let me refactor the codepen to simplify it further

EDIT : CodePen is updated now,

@etimberg
Copy link
Member

etimberg commented Oct 2, 2022

I see red twice in the pen

red twice

@ArkeshGKalathiya
Copy link
Author

ArkeshGKalathiya commented Oct 2, 2022

@etimberg
Screenshot 2022-10-02 at 11 04 06 AM

Mine shows differently, but I am testing this in "Safari", that might be the issue too. Because in "Brave" and "Chrome" it works just fine.

@LeeLenaleee
Copy link
Collaborator

Which version of safari and macos are you using, tested this on safari on a iphone 11 and it works fine

@ArkeshGKalathiya
Copy link
Author

Screenshot 2022-10-02 at 12 44 14 PM

Screenshot 2022-10-02 at 12 46 13 PM

@kurkle
Copy link
Member

kurkle commented Oct 3, 2022

Just to confirm (that Safari is the new IE):
image
image
image

And Chrome on same Mac:
image

@ArkeshGKalathiya
Copy link
Author

Yes

@LeeLenaleee
Copy link
Collaborator

Can't test this since I dont have a mac, but just out of curiosity, does normal patern is A - B - C, linked picture it only shows A - B - C - C - B. If you add more entries on the x axis does it keep mirroring so it will give this pattern: A - B - C - C - B - A - A - B - C - C - B - A?

@ArkeshGKalathiya
Copy link
Author

Screenshot 2022-10-03 at 2 50 16 PM

@kurkle
Copy link
Member

kurkle commented Oct 4, 2022

Interestingly, changing the "red" to "maroon" makes the change work:
image

So I think this is a safari optimization bug, where it thinks blue === red and does not bother updating the context.

@ArkeshGKalathiya
Copy link
Author

ArkeshGKalathiya commented Oct 4, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants