-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Description
There were already reports regarding problems using Plotly.NET from C#, e.g. #29 .
Problems regarding the translation of F# options into C# have been fixed, however there are 2 main issues left:
-
Extension methods defined in the
ChartExtensionsmodule do not works as intended. This can be fixed using the[<System.Runtime.CompilerServices.Extension>]atttribute for those methods, making it possible to call the methods on chart instances in C#, e.gmyChart |> Chart.Showwill in C# be
myChart.Show()
The extension method must have the Chart as first parameter though, so overloads for all fitting methods are necessary. Additionally,
using static ChartExtensionsalready works.implemented via members of
GenericChartvia c1ed1be -
Generic types are easier to use in F#. Consider the following F# example:
Chart.Point(data,Color="#ffffff")
In this case, Color is not typed in the Chart.Point function, and is infered as generic
'a1. This is not the case in C#, where you must annotate it (the secondstringannotation). :var chart = Chart.Point<double, double, string, string>(data, Color: "#ffffff"); //This is what you should be able to do: var chart = Chart.Point<double, double, string>(data, Color: "#ffffff");
I see no solution for that other than adding type annotations to the respective parameters extensively.
However, when these issues are taken care of, from my limited usage of C# it seems like we can reach comfortable usage in that language with these features added.