XPlot icon indicating copy to clipboard operation
XPlot copied to clipboard

Rationalise Plotly and GoogleCharts

Open isaacabraham opened this issue 9 years ago • 11 comments

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.

isaacabraham avatar Feb 05 '16 00:02 isaacabraham

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.

TahaHachana avatar Feb 07 '16 08:02 TahaHachana

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 :).

tpetricek avatar Feb 07 '16 17:02 tpetricek

@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 :-)

isaacabraham avatar Feb 07 '16 19:02 isaacabraham

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

TahaHachana avatar May 06 '16 15:05 TahaHachana

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:[email protected] Sent: ‎06/‎05/‎2016 17:34 To: TahaHachana/XPlotmailto:[email protected] Cc: Isaac Abrahammailto:[email protected]; Mentionmailto:[email protected] 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 avatar May 06 '16 19:05 isaacabraham

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

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

isaacabraham avatar May 08 '16 14:05 isaacabraham

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

cartermp avatar Nov 08 '19 17:11 cartermp

@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.

isaacabraham avatar Nov 10 '19 18:11 isaacabraham

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.

cartermp avatar Nov 10 '19 19:11 cartermp

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.

dsyme avatar Nov 10 '19 21:11 dsyme

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.

isaacabraham avatar Nov 11 '19 09:11 isaacabraham