willdale / SwiftUICharts

A charts / plotting library for SwiftUI. Works on macOS, iOS, watchOS, and tvOS and has accessibility features built in.
MIT License
843 stars 105 forks source link

Negative Value Visualisation fix for Bar/Grouped/Horizontal Bar Charts #168

Closed kunalverma25 closed 2 years ago

kunalverma25 commented 2 years ago

Fixes negative values not showing/going out of bounds even when baseline is properly set for BarChart, GroupedBarChart and HorizontalBarChart.

Note: Baseline should be set as - .minimumValue or .minimumWithMaximum(of: Double)

Works best with .minimumWithMaximum(of: 0)

Fix for #126 #148 (except for stacked chart)

kunalverma25 commented 2 years ago

@willdale This fixes the negative values for bar charts (except stacked) Can these changes be added in v2.x?

willdale commented 2 years ago

I'm not sure I see any difference in this:

Before After
Before After
kunalverma25 commented 2 years ago

@willdale Baseline should be set as - .minimumValue or .minimumWithMaximum(of: Double)

With baseline set -

Screenshot 2022-01-30 at 6 13 47 PM

willdale commented 2 years ago

Thanks.

The touch markers don't line up one the y-axis.

touchMarker

kunalverma25 commented 2 years ago

@willdale The touch point location issues are fixed in the latest commit.

sai-manoj-kumar commented 2 years ago

@willdale All the comments seem to be addressed. Can this be merged?

sai-manoj-kumar commented 2 years ago

@willdale Can you merge this pull request?