Uh oh!
There was an error while loading. Please reload this page.
Any C# sample with connectgaps #434
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello, do you have any sample in C# to help create a line plot with connectgaps property ? I saw #146, but i don't know how to convert it from F# to C#. Thanks |
Replies: 3 comments
@davidsaurel, if it is the dynamic object syntax that is the issue, you may check https://plotly.net/#Declarative-style-in-C-using-the-underlying Otherwise, chatgpt often helps translate language you don't know to another syntax, despite it wouldn't be 1 to 1 due to Plotly.NET.CSharp having its own set of idioms on top of the underlying implementation, and C# being a bit restrictive with bringing types of same name from different namespaces in scope. In meantime, you can add a F# project to your dotnet solution, and put the code sample there, extract the parameters, and call it from C# code. If you come up with the equivalent known to work sample, you may contribute it to the documentation, if the bindings are missing in C#, you may contribute a PR to this repository to add support for it. I could not translate it quickly, because of C# tooling lacking around script, and the editor from dotnet interactive not having the extensive language support needed to solve the issue at hand quickly. |
@davidsaurel thanks for this question. I am afraid that applying this in C# is quite hard because you must either apply the tracestyle function (which is very FSharpy as it takes a function as argument) or use dynamic object style. The first solution would look like this. It has the same problems that eventually lead to However, as a workaround it at least works: usingPlotly.NET.CSharp;varchart=Chart.Scatter<float,int,string>(mode:Plotly.NET.StyleParam.Mode.Lines_Markers,x:newfloat[]{1,2,float.NaN,4},y:newint[]{1,2,3,4});Plotly.NET.GenericChart.mapTrace(Plotly.NET.Trace2DStyle.Scatter<float,float,float,float,float,float,float,float,float,float,float,float,float,float,Plotly.NET.Trace>(ConnectGaps:true),chart);
chartI think we eventually need a |
Thanks you guys |

@davidsaurel thanks for this question. I am afraid that applying this in C# is quite hard because you must either apply the tracestyle function (which is very FSharpy as it takes a function as argument) or use dynamic object style.
The first solution would look like this. It has the same problems that eventually lead to
Plotly.NET.CSharp(see #322), namely the huge amount of generic type annotations that you just do not have to set using the function from F#.However, as a workaround it at least works: