Skip to content

Hatched fills for Pie, Coxcomb, and Radar#1948

Merged
swharden merged 13 commits intoScottPlot:mainfrom
bclehmann:feature/hatch/pie-coxcomb-radar
Jul 14, 2022
Merged

Hatched fills for Pie, Coxcomb, and Radar#1948
swharden merged 13 commits intoScottPlot:mainfrom
bclehmann:feature/hatch/pie-coxcomb-radar

Conversation

@bclehmann
Copy link
Member

Purpose:
#1943

pie.HatchOptions = new HatchOptions[] {
    new () { HatchStyle = HatchStyle.StripedUpwardDiagonal, HatchColor = Color.FromArgb(100, Color.Gray) },
    new () { HatchStyle = HatchStyle.StripedDownwardDiagonal, HatchColor = Color.FromArgb(100, Color.Gray) },
    new () { HatchStyle = HatchStyle.LargeCheckerBoard, HatchColor = Color.FromArgb(100, Color.Gray) },
    new () { HatchStyle = HatchStyle.SmallCheckerBoard, HatchColor = Color.FromArgb(100, Color.Gray) },
    new () { HatchStyle = HatchStyle.LargeGrid, HatchColor = Color.FromArgb(100, Color.Gray) },
};

Pie:
image

Cocxomb:
image

Radar:
image

I promise they look better than in the screenshots, I used right-click and copy to paste the images in, and that disables anti-aliasing, which might be worth looking into separately.

@bclehmann
Copy link
Member Author

I ended up going with a HatchOptions struct, and I think when ScottPlot 5 comes around we should change BarPlot to do the same thing. I think we ought to have a place to put changes we want to make with the next major version, because I ran into a few:

  • HatchOptions rather than separate properties for BarPlot
  • WebColor is used in Coxcomb and Radar plots as the name for the axis colour, and it's a confusing name. Especially as it can be confused with the other web colours
  • LineColor and LineWidth can probably be usefully combined into LineOptions or similar.

Some of these may be too far, and make updating to ScottPlot 5 unnecessarily difficult, but I think they're at least worth considering.

@bclehmann
Copy link
Member Author

My implementation also has more brush allocations (1 per pie slice per render rather than 1 per render), I figured this was cleaner and the performance impact was negligible.

I am happy to change it to a more efficient version however, if you decide it's worth it.

@swharden swharden linked an issue Jul 14, 2022 that may be closed by this pull request
@swharden swharden linked an issue Jul 14, 2022 that may be closed by this pull request
@swharden
Copy link
Member

swharden commented Jul 14, 2022

Naming is hard! There's a ScottPlot.Drawing.HatchStyle enumeration which in hindsight should have been named ScottPlot.HatchPattern EDIT: or just ScottPlot.Pattern

I'm not really worried about performance or nailing naming at this point. This library evolved so much and is strung together in weird ways due to a years-long effort to minimize breaking API changes.

Same thing with WebColor 😅

Regarding ScottPlot 5, MarkerOptions, LineOptions, FillOptions, LabelOptions sound like fantastic structs!

Thanks for this PR btw - it looks fantastic!

@swharden
Copy link
Member

Some of these may be too far, and make updating to ScottPlot 5 unnecessarily difficult, but I think they're at least worth considering.

FYI in ScottPlot 5 I'll be keeping the basic API (users create a Plot and AddSomething() to it) so it'll be easy for old users to figure out how to use it, but I'm giving myself total liberty to choose any names/namespaces that seem best now that I have a few years of experience maintaining a charting library.

Answering 100s of questions and closing 100s of issues gave me a lot of insight into what works and what users (and contributors) find confusing, so I'm looking forward to some of the changes! I hope an improved simpler API will make features more discoverable and the code more maintainable 🤞

If you're interested in being more involved in the new API design, I'd be happy to work together on it!

@swharden swharden enabled auto-merge July 14, 2022 03:10
@swharden swharden merged commit fb7beb3 into ScottPlot:main Jul 14, 2022
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.

Controls: right-click copy should always be high quality Hatched fills for Pie, Coxcomb, Radar Chart

2 participants