KarthikRIyer / swiftplot

Swift library for Data Visualization :bar_chart:
Apache License 2.0
400 stars 39 forks source link

LineGraph fixes #86

Closed karwa closed 4 years ago

karwa commented 4 years ago

Fixes #81

The layout data for each axis is now calculated separately by a helper struct, then we merge their X-axes (we could also not merge those axes, and show the second X-axis on top, but we can add that later).

The reference images have changed because the origin is now calculated as (10, 10) for some plots (the first data point), rather than (0,0). It would be nice to snap this to a nicer value again, but that's a bit complex to do right. In the mean time, this fixes a bunch of other issues and adds new tests for a bunch of weird cases.

karwa commented 4 years ago

OK, we now snap the origin to 0 if it happens to be in-view after calculating the axis scale based on the data (i.e. if it's in the margins or something). Changes to tested cases are barely perceptible, except for _07_secondary_axis_line_chart; since 0 on the Y-axis is not in view for the primary series (which starts at (10, 150)), the primary series Y markers are different.

KarthikRIyer commented 4 years ago

Merging