ChartView
ChartView copied to clipboard
LineView not properly scaling with large values
When data array contains values below, the LineView looks how it does below.
[282.502, 284.495, 283.51, 285.019, 285.197, 286.118, 288.737, 288.455, 289.391, 287.691, 285.878, 286.46, 286.252, 284.652, 284.129, 284.188]

with small values as well.
Just found SwiftUICharts and I think it is great! Thank you.
I'm trying to plot a BarChartView on an iPad running 13.4. The data is (x-axis) a date string and y-axis is the daily virus case count.
If I use ChartForm.medium
everything works but the view is too small. If I use ChartForm.large
the view expands across the screen but the view hight is small and no data shows.
Please can you allow a more flexible view sizing.
Thank you
Guys you've just to modify "StepHeight" in each file.
Where you find : return (frame.size.height-padding) / CGFloat(max + min)
Change it whit : return (frame.size.height-padding) / CGFloat(max - min)
It works for me!
Guys you've just to modify "StepHeight" in each file.
Where you find : return (frame.size.height-padding) / CGFloat(max + min)
Change it whit : return (frame.size.height-padding) / CGFloat(max - min)
It works for me!
it does not work for me still facing same problem
@antoniowar17 Where do you find that? I looked in LineView but could not find that line.
I am experiencing the same issue. Passing in numbers like 1,500 and it just can't figure out how to scale properly
@antoniowar17 thanks, this works for me. You have to adjust in both 'Line' and 'Legend'!
Can someone please tell me how to edit the package code? Mine is read only
Is this still an issue with the latest version, on the master branch?
@satan87 I haven’t tried in a while. I’ll check again tonight.
@marchantcilliers I didn’t manage to solve it, but in order to get around the read-only thing, you have to clone the repo, move it to a new directory w/o git, and then add the local copy as a package. (However I don’t recommend since it causes other issues especially with updating to future versions)
@MattGeimer Thanks. Let me know and if it's still there I'll take a look
@satan87 @MattGeimer Thanks. I look forward to your replies.
@satan87 I was still able to replicate the issue. I copy/pasted the data I initially provided in the issue, and got the same result. I am currently using version 1.5.0 w/ a deployment target of iOS 13.5.
Data: [282.502, 284.495, 283.51, 285.019, 285.197, 286.118, 288.737, 288.455, 289.391, 287.691, 285.878, 286.46, 286.252, 284.652, 284.129, 284.188]
Resulting View:
EDIT: Noticed it was hard to see simulator's view against white background, so swapped sim to dark mode. Black is background, orange it area allocated to the LineView but not being used, and white is the area being used by the LineView.
I push a quick fix based on @antoniowar17 's solution. This needs to be reviewed but I'm hoping it will solve your issues for now.
@satan87 I have updated to latest package versions. But there is no change. Should I do something different?
@marchantcilliers You need to wait for the PR #113 to be merged into the master branch, then you can do the update.
Will this be pulled into V2 or even a better, a way to manually set the scale?
Will this be pulled into V2 or even a better, a way to manually set the scale?
I tested it out about a couple weeks ago, and it seemed to be fixed, but I didn't get enough time to fully test it out.
Using the "new-version-beta2" branch this does not appear to be fixed. The scale for values between 52-67 as shown here is way too compressed.