Skip to content

#4968 - Added support for corner radius in bar chart#4969

Closed
mdm84 wants to merge 1 commit intoChartsOrg:masterfrom
NAXEsrl:feature/barchart-with-corner-radius
Closed

#4968 - Added support for corner radius in bar chart#4969
mdm84 wants to merge 1 commit intoChartsOrg:masterfrom
NAXEsrl:feature/barchart-with-corner-radius

Conversation

@mdm84
Copy link
Copy Markdown

@mdm84 mdm84 commented Nov 10, 2022

Added the barCornerRadiusFactor property in Dataset for barchat. If you set the value different from 0.0 the bars will have the round corners

Issue Link 🔗

#4968

Goals ⚽

Get the chance for drawing the corner in the bar when you use the Bar Chart

Implementation Details 🚧

Create a property called barCornerRadiusFactor. We can set the factor for barWidth and create the appropriate corner in the bar

Testing Details 🔍

for testing, you can set the value in the demo project and see the behavior

Added the barCornerRadiusFactor property in Dataset for barchat. If you set the value different from 0.0 the bars will have the round corners
@liuxuan30
Copy link
Copy Markdown
Member

no offence, have you checked out #4339 ? There was some legacy discussion that not seeing a perfect solution - mainly when then bar is thin, the rounded corner is more like an oval - making it not favorable merging into master

@mdm84
Copy link
Copy Markdown
Author

mdm84 commented Nov 11, 2022

@liuxuan30 any news?

@pmairoldi pmairoldi self-assigned this Mar 11, 2023
@pmairoldi pmairoldi added this to the 5.0.0 milestone Mar 11, 2023
@EvgeniyMac
Copy link
Copy Markdown

EvgeniyMac commented Jun 1, 2023

Thanks this work, but it rounded all corners. I change code with rounded top use pmairoldi code but change -
let bezierPath = UIBezierPath(roundedRect: barRect, cornerRadius: barRect.width * dataSet.barCornerRadiusFactor)
to this code -
let bezierPath = UIBezierPath(roundedRect: barRect, byRoundingCorners: [.topLeft , .topRight], cornerRadii: CGSize(width: barRect.width * dataSet.barCornerRadiusFactor, height: barRect.height * dataSet.barCornerRadiusFactor))
change cornerRadii parameters for your settings if need

@mdm84
Copy link
Copy Markdown
Author

mdm84 commented Jun 1, 2023

cool, this

Thanks this work, but it rounded all corners. I change code with rounded top use pmairoldi code but change -
let bezierPath = UIBezierPath(roundedRect: barRect, cornerRadius: barRect.width * dataSet.barCornerRadiusFactor)
to this code -
let bezierPath = UIBezierPath(roundedRect: barRect, byRoundingCorners: [.topLeft , .topRight], cornerRadii: CGSize(width: barRect.width * dataSet.barCornerRadiusFactor, height: barRect.height * dataSet.barCornerRadiusFactor))
change cornerRadii parameters for your settings if need

yes, this should be an option (choose the corner to rounding and by default .all)

@pmairoldi pmairoldi modified the milestones: 5.0.0, Future Jun 7, 2023
@JonesonOh
Copy link
Copy Markdown

Is this already available in Release 5.0.0? Would really need the rounded corner support for bar charts

@alinless
Copy link
Copy Markdown

Any updates about this feature?

@EvgeniyMac
Copy link
Copy Markdown

Any updates about this feature?

I write how do it. Please dive into the code to understand how it works.

@shutrup
Copy link
Copy Markdown

shutrup commented Oct 15, 2024

Haven't added this feature yet? really needed

@shutrup
Copy link
Copy Markdown

shutrup commented Oct 15, 2024

cool, this

Thanks this work, but it rounded all corners. I change code with rounded top use pmairoldi code but change -
let bezierPath = UIBezierPath(roundedRect: barRect, cornerRadius: barRect.width * dataSet.barCornerRadiusFactor)
to this code -
let bezierPath = UIBezierPath(roundedRect: barRect, byRoundingCorners: [.topLeft , .topRight], cornerRadii: CGSize(width: barRect.width * dataSet.barCornerRadiusFactor, height: barRect.height * dataSet.barCornerRadiusFactor))
change cornerRadii parameters for your settings if need

yes, this should be an option (choose the corner to rounding and by default .all)

when will you add it?

@pmairoldi
Copy link
Copy Markdown
Collaborator

Currently already implemented here
Closing in favour of #5250 for full platform support

@pmairoldi pmairoldi closed this Mar 7, 2026
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.

7 participants