plotly / Plotly.NET

interactive graphing library for .NET programming languages :chart_with_upwards_trend:
https://plotly.net
MIT License
663 stars 88 forks source link

LINQPad integration #404

Closed Peter-B- closed 1 year ago

Peter-B- commented 1 year ago

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:

image

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.

The Result

image

kMutagene commented 1 year ago

Hi @Peter-B-

First of all, this is a very nicely formatted PR, clear and concise!

Also, I must say that LINQPad looks quite interesting. I do most interactive programming in dotnet notebooks these days, but from my limited look at it it seems like it also has a debugger which can be very handy.

What I like most about this PR is that we do not need to add external dependencies. Since the member is private, the public API stays the same and since the tests pass, everything looks good to me.

Regarding the module rec, this will be unnecessary once I start moving to v5, because I want to get rid of the GenericChart module in favor of a type with static members (so it is only Plotly.NET.GenericChart instead of Plotly.NET.GenericChart.GenericChart).

As of now, I think this PR itself does not add backwards-incompatible stuff, so adding it to a minor release (4.2.0) seems reasonable.

Peter-B- commented 1 year ago

Thanks a lot for your review and for merging it. I'm looking forward to seeing it published.

LINQPad is indeed a great app, especially as a database-scripting-tool in combination with Entity Framework. Just the plots were a bit old-school - until now :-)