You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am able to create different point charts in C# with Plotly. As soon as I choose a different chart type like Line, the implementation fails. It makes no difference whether I only specify the two data sequences or the whole parameters that are not required.
double[] x = new double[] { 1,3,4,5,6,7}; double[] y = new double[] { 5,7,6,5,4,3};
... var chart = Chart.Point(x,y,"Sample",true,StyleParam.Symbol.Circle,"Green",1,null,null,null,null,null,null,false);
or without optional arguments:
var chart2 = Chart.Point(x,y);
Not Working (for Example Line) : var chartLine = Chart.Line(x,y, "Sample", true, StyleParam.Symbol.Square, "Green", 1, null, null, null, null, null, null, null, null, false) ;
or var charLine2 = new Chart.Line(x,y);
So the initialization fails and Visual Studio tells me that the type arguments are not explicit.
yep, that one is on us. In many places we let the F# type inference handle the typing of arguments for us, and that does not seem to translate well into C#. The offenders in the case of Chart.Line are the Dash and Width Parameters. When annotating those you can use Chart.Line like this:
staticvoidMain(string[]args){double[]x=newdouble[]{1,2};double[]y=newdouble[]{5,10};GenericChart.GenericChartchart=Chart.Line<double,double,StyleParam.DrawingStyle,double>(x:x,y:y,Dash:StyleParam.DrawingStyle.Dash,Width:.2);chart.WithTraceName("Hello from C#",true).WithX_AxisStyle(title:"xAxis",Showgrid:false,Showline:true).WithY_AxisStyle(title:"yAxis",Showgrid:false,Showline:true).Show();}
This is not ideal and i will try to fix this asap by adding explicit type annotations for all Chart Extensions.
yep, that one is on us. In many places we let the F# type inference handle the typing of arguments for us, and that does not seem to translate well into C#. The offenders in the case of Chart.Line are the Dash and Width Parameters. When annotating those you can use Chart.Line like this:
staticvoidMain(string[]args){double[]x=newdouble[]{1,2};double[]y=newdouble[]{5,10};GenericChart.GenericChartchart=Chart.Line<double,double,StyleParam.DrawingStyle,double>(x:x,y:y,Dash:StyleParam.DrawingStyle.Dash,Width:.2);chart.WithTraceName("Hello from C#",true).WithX_AxisStyle(title:"xAxis",Showgrid:false,Showline:true).WithY_AxisStyle(title:"yAxis",Showgrid:false,Showline:true).Show();}
This is not ideal and i will try to fix this asap by adding explicit type annotations for all Chart Extensions.
Activity
kMutagene commentedon Apr 12, 2021
Hi @LucasNmn, can you give me a sample code snippet so i can test if i can reproduce what you are experiencing?
LucasNmn commentedon Apr 12, 2021
Working Sample (with Point):
double[] x = new double[] { 1,3,4,5,6,7};double[] y = new double[] { 5,7,6,5,4,3};...
var chart = Chart.Point(x,y,"Sample",true,StyleParam.Symbol.Circle,"Green",1,null,null,null,null,null,null,false);or without optional arguments:
var chart2 = Chart.Point(x,y);Not Working (for Example Line) :
var chartLine = Chart.Line(x,y, "Sample", true, StyleParam.Symbol.Square, "Green", 1, null, null, null, null, null, null, null, null, false) ;or
var charLine2 = new Chart.Line(x,y);So the initialization fails and Visual Studio tells me that the type arguments are not explicit.
kMutagene commentedon Apr 12, 2021
yep, that one is on us. In many places we let the F# type inference handle the typing of arguments for us, and that does not seem to translate well into C#. The offenders in the case of
Chart.Lineare theDashandWidthParameters. When annotating those you can use Chart.Line like this:This is not ideal and i will try to fix this asap by adding explicit type annotations for all Chart Extensions.
dsp6414 commentedon Apr 12, 2021
i also expect Some Csharp examples.
LucasNmn commentedon Apr 13, 2021
Ok, thanks for the tip. I will try that.
LucasNmn commentedon Apr 13, 2021
It's working. Thanks!