Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
at first I must declare, that this is my first F# pull request, so please let me ask for some patience :-)
Motivation
I am a big fan of LINQPad as a (C# and F#) code scratchpad. One of it's main features is the
.Dump()
extension method, which let's you bring almost everything into a nicely formatted output.Almost everything: Plotly.Net charts are dumped as plain objects:
This is a pity, since LINQPad's output is html and it would perfectly support interactive charts.
How To
LINQPad supports customized dumps from F# in two ways:
The first option would require every user to implement an extension, so the second is the way to go.
Implementation
After some try-and-error, I figured out a way to support Plotly.Net in LINQPad with relatively view changes.
.ToDump()
method to GenericChartThis method can be (and is) private.
ToDump
must be able to calltoEmbeddedHTML
, which is defined later within this module.Maybe there is a better solution to this.
ToDump
, an instance ofLINQPad.Controls.IFrame
is created using reflection and returned.The use of reflection avoids a static reference to
LINQPad.Runtime
The Result