Ability to use custom-drawn markers#386
Ability to use custom-drawn markers#386henkburgstra wants to merge 7 commits intoScottPlot:masterfrom
Conversation
Update van het origineel
This reverts commit dec07cc.
|
Hi @henkburgstra, thank you for this insightful suggestion! I really like how this PR uses interfaces to let the user create a custom marker. This seems like a really useful feature that could benefit many plottable objects. However, this PR only addresses scatter plots. Rather than merge this PR, I added this topic to the ScottPlot roadmap because I think the whole library would benefit from refactoring away from the enum-based marker system to a class-based system with interfaces like the one you implemented here. This is a really good idea, and it pains mt to close this PR, but I'd really like to implement this idea on a much wider scale. I'll ping you when I do so you can take a look and let me know what you think! |
|
Hi Scott, thank you very much for your thoughtful response! Could I maybe help you with this? Thank you for keeping me updated, I would rather use the original ScottPlot library than my fork in our project :) |
Since the current marker system is enum based, markers are hard-coded into the library. The fastest way could be for me to add your custom markers to the enum-based system so you can use them immediately, then I work toward supporting custom markers in a future release. To add a custom marker you could just add its name to the list of current markers. Then add a case for that marker in the You could either paste that code in this issue, or change the code and make a PR, and I can incorporate it into the main library pretty quick. |
|
Hi Scott,
Many thanks for taking the time to respond. I apologize for my late reply.
I think I will do as you suggested for now. Hopefully I can make a pull
request later today or tomorrow.
Thanks again,
Henk.
…On Sun, May 17, 2020 at 4:50 PM Scott W Harden ***@***.***> wrote:
Could I maybe help you with this? Thank you for keeping me updated, I
would rather use the original ScottPlot library than my fork in our project
:)
Since the current marker system is enum based, markers are hard-coded into
the library. The fastest way could be for me to add your custom markers to
the enum-based system so you can use them immediately, then I work toward
supporting custom markers in a future release.
To add a custom marker you could just add its name to the list of current
markers.
https://github.com/swharden/ScottPlot/blob/ef59756715ac87c6d778fe783c81357a593561b2/src/ScottPlot/Markers.cs#L10-L27
Then add a case for that marker in the DrawMarker function (using the
arguments that are passed in for location, size, and color)
https://github.com/swharden/ScottPlot/blob/ef59756715ac87c6d778fe783c81357a593561b2/src/ScottPlot/Markers.cs#L44-L46
You could either paste that code in this issue, or change the code and
make a PR, and I can incorporate it into the main library pretty quick.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#386 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALOLDR7PEIOWDEUMJV3EH3RR72RRANCNFSM4M7DGUKA>
.
|
New contributors should review CONTRIBUTING.md:
https://github.com/swharden/ScottPlot/blob/master/CONTRIBUTING.md
Purpose:
This is a non-evasive change. The existing interface remains unchanged.
I needed the ability to use custom-drawn markers. This change adds this ability. The change adds public field Settings.markerDrawer of type IMarkerDrawer. PlottableScatter.Render uses this field if present to draw markers.
New functionality (code):
Provide a code example demonstrating new functionality achieved with this pull request (if applicable)
Implementation of IMarkerDrawer (open triangle in this case) to be used in an Audiogram (https://en.wikipedia.org/wiki/Audiogram)
To be used like this:
New functionality (image):

If this pull request changes how a plot is rendered, provide an image or screenshot demonstrating the new functionality: