Closed ivanjimenez closed 1 year ago
Your issue is three-fold:
This is not an error, it is how C# wants you to annotate Generics: in the case of the method you are using, you must annotate 7 Generics. In F# you do not have to do that, and this is the main reason why the C# bindings even exist, instead of further optimizing the F# API to be directly consumed from C#.
The Color
type must be Plotly.NET.Color.
While you reference Plotly.NET.CSharp
, you are not using the Chart method from it. I'd suggest not opening the Plotly.NET
root namespace at all if you want to use native C# bindings to avoid confusion (many things are named the same naturally).
While the sample documentation is not ported, the API reference of Plotly.NET.CSharp
is documented extensively. Here is the section on Chart.Range
: https://plotly.net/reference/plotly-net-csharp-chart.html#Range
Here is a working example:
Note that you have to annotate less (3) Generics with the actual C# binding, and they have helpful names:
Hi,
Thanks for your explanations. I will follow your indications. Although Plotly C# Api is well documented, I think is a little messy and there are not many examples of using it. You must convert a lot of F# examples in C#. F# is not complicated, but I miss more resources about fantastic plotly .net c# library.
Thanks a bunch!
Description
Can't build a simple code for Plotly.NET C# Binding in a rage plot graph:
https://plotly.net/02_3_range-plots.html
I am trying to translate F# code to C#
Repro steps
Expected behavior
With other charts this library works
Actual behavior
Maybe there is an error in the argument, but with no documentation for API in C# it results tricky.
Known workarounds
Unknown
Related information