fslaborg / XPlot

A collection of older plotting libraries for F#. Recommended to use Plotly.NET instead https://plotly.net/
http://fslaborg.github.io/XPlot/
Apache License 2.0
288 stars 69 forks source link

Rationalise Plotly and GoogleCharts #29

Open isaacabraham opened 8 years ago

isaacabraham commented 8 years ago

Having the option of both these charting libraries is great. However, the APIs to consume them both are very different. GoogleCharts is somewhat similar to FSharp.Charting in that you can chuck lists of tuples and it just works - Plotly is completely different though, where you have to manually assign to x and y fields etc. etc..

It would be nice if the two APIs were brought in sync with one another.

TahaHachana commented 8 years ago

I agree, a higher level API for creating Plotly charts (at least the common types) would make it more appealing and familiar for someone used to FSharp.Charting. This is on my to-do and hopefully I'll implement it soon.

tpetricek commented 8 years ago

I agree this would be great - XPlot is currently providing just a thin layer, which makes a lot of sense.

I think a great starting point would be just a script prototyping some of the wrapping - @isaacabraham, if you want to have a go at this, it can be very useful for exploring how to do this :).

isaacabraham commented 8 years ago

@tpetricek is that a gentle "nudge" in my direction? :-) OK - I will! And this time I commit to actually coming up with at least a fork for review :-)

TahaHachana commented 8 years ago

I've started implementing this for some chart types

let sales = ["2013", 1000; "2014", 1170; "2015", 660; "2016", 1030]
let expenses = ["2013", 400; "2014", 460; "2015", 1120; "2016", 540]

[sales; expenses]
|> Plotly.Line
|> Plotly.Show
isaacabraham commented 8 years ago

I started work on this some months ago and got somewhere with it. The problem was whether to use pipe style or methods on a class. The latter allows optional args but the former can be nice with pipes.

I also wasn't sure how to unify both facades... Let me post a gist of where I got to.


From: Taha Hachanamailto:notifications@github.com Sent: ‎06/‎05/‎2016 17:34 To: TahaHachana/XPlotmailto:XPlot@noreply.github.com Cc: Isaac Abrahammailto:isaac.abraham@gmail.com; Mentionmailto:mention@noreply.github.com Subject: Re: [TahaHachana/XPlot] Rationalise Plotly and GoogleCharts (#29)

I've started implementing this for some chart types

`let sales = ["2013", 1000; "2014", 1170; "2015", 660; "2016", 1030] let expenses = ["2013", 400; "2014", 460; "2015", 1120; "2016", 540]

[sales; expenses] |> Plotly.Line |> Plotly.Show`


You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/TahaHachana/XPlot/issues/29#issuecomment-217476117

isaacabraham commented 8 years ago

Here's the work I did on it...

https://gist.github.com/isaacabraham/7211954b28ac4792e790bf9d6b211a0b

cartermp commented 5 years ago

@isaacabraham would you be willing to contribute your code (and/or enhancements to it?)

isaacabraham commented 5 years ago

@cartermp I vaguely remember looking into this. I think the problem was that the abstractions quickly became somewhat leaky because both chart APIs differed quite rapidly after doing basic operations.

cartermp commented 5 years ago

Gotcha, makes sense. I was wondering if there's a way to make it work similar to Julia's Plots library, which offers a consistent API across multiple backends. Probably possible, just needs some careful design work.

dsyme commented 5 years ago

Gotcha, makes sense. I was wondering if there's a way to make it work similar to Julia's Plots library, which offers a consistent API across multiple backends. Probably possible, just needs some careful design work.

Also worth taking a look at Oxyplot and seeing whether that should be brought into the family of charting options for use from F# Interactive (separate to XPlot). It's mostly used from C# but I think might be pretty good from F# now anonymous records are supported.

isaacabraham commented 5 years ago

Having a consistent, unified charting "model" that we could use would be absolutely excellent - there are several projects chart projects all with similar but slightly different APIs.