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

Add concrete scale implementations that support CGFloat as an output type #2

Closed
heckj opened this issue Mar 30, 2022 · 2 comments · Fixed by #9
Closed

Add concrete scale implementations that support CGFloat as an output type #2

heckj opened this issue Mar 30, 2022 · 2 comments · Fixed by #9
Assignees
Labels
enhancement New feature or request

Comments

@heckj
Copy link
Member

heckj commented Mar 30, 2022

For the work on Chart (specifically the VisualChannel construct), we have a couple of types that aren't currently covered which should be:

The (default-ish) output type needed to draw into a GraphicsContext is CGFloat - for better or worse, so we probably need explicit implementations that output there instead of (or in addition to) the current Float. That may mean we want to reconsider how those mappings are happening, not sure.

In addition, there's a need for scales that convert values (Int, Float, Double, etc) into colors. I suspect that's probably a variation of LinearScale, but the interpolated output should be a type of color, or a type that can be easily converted into a color. First cut pass, maybe CGColor from CoreGraphics, but a general color representation might not be amiss that can apply over into SwiftUI color, UIKit/UIColor, or AppKit/NSColor as needed.

Finally, we need some discrete scales - none currently in play, to enable bar charts - something that takes a list of categories (represented by a [String]) and can return a spacing location for the center, or be used to calculate the relevant positioning with a width and spacing. So again, output to CGFloat, input a Collection - where first cut of Something is String

The secondary output type for the discrete scale is color - to enable color to be used to provide an indicator of an underlying category choice in things like Dot or Line charts.

@heckj
Copy link
Member Author

heckj commented Mar 30, 2022

(probably want to break this up into separate issues and sections)

@heckj heckj self-assigned this Mar 30, 2022
@heckj heckj added the enhancement New feature or request label Mar 30, 2022
@heckj heckj transferred this issue from swiftviz/SwiftViz Mar 31, 2022
@heckj
Copy link
Member Author

heckj commented Mar 31, 2022

Broke out color scales (#6) and discrete scales (#7) from this issue - enabling CGFloat as the output type for existing Linear, Log, and Pow concrete scales

@heckj heckj changed the title Broaden input and output types with scales Add concrete scale implementations that support CGFloat as an output type Mar 31, 2022
@heckj heckj closed this as completed in #9 Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant