Skip to content

Compile error while building a C# proyect with Plotly.NET library using C# binding #390

@ivanjimenez

Description

@ivanjimenez

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#

image

Repro steps

  1. I am trying to make a Range Graph with code provided in F# translated to C#:
...
using Plotly.NET.CSharp;
using Microsoft.Web.WebView2;
using Microsoft.Web.WebView2.WinForms;
using Plotly.NET.TraceObjects;
using Plotly.NET;
...

        Plotly.NET.Chart2D.Chart.Range(
             x: new double[] { 1, 2 },
             y: new double[] { 5, 10 },
             upper: X,
             lower: Y,
             mode: StyleParam.Mode.Lines_Markers,
            MarkerColor: System.Drawing.Color.FromName("Blue"),
            RangeColor : System.Drawing.Color.FromName("Red")

         )
         .WithTraceInfo("Hello from C#", ShowLegend: true)
         .WithXAxisStyle<double, double, string, double>(Title: Plotly.NET.Title.init("xAxis"))
         .WithYAxisStyle<double, double, string, double>(Title: Plotly.NET.Title.init("yAxis"))
         .SaveHtml(strPath);
  1. There is an error in IDE

image

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

  • Operating system: Windows 10
  • Branch: version 4.1.0
  • .NET Runtime, CoreCLR or Mono Version: .net 7.0
  • Performance information, links to performance testing scripts: no scripts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions