plotly / Plotly.NET

interactive graphing library for .NET programming languages :chart_with_upwards_trend:
https://plotly.net
MIT License
651 stars 84 forks source link

Incompatible with DynamicObj v. 3.0 #470

Open ntwilson opened 1 week ago

ntwilson commented 1 week ago

Description

When installed with DynamicObj v. 3.0, Chart.Histogram crashes:

System.MissingMethodException: Method not found: 'Void DynamicObj.DynamicObj.CopyDynamicPropertiesTo(DynamicObj.DynamicObj)'.
   at Plotly.NET.GenericChart.ofTraceObject$cont@351(Trace trace, Unit unitVar)
   at Plotly.NET.GenericChart.ofTraceObject(Boolean useDefaults, Trace trace)
   at Plotly.NET.Chart2D.Chart.Histogram[a76,a77,a78](FSharpOption`1 X, FSharpOption`1 MultiX, FSharpOption`1 Y, FSharpOption`1 MultiY, FSharpOption`1 Orientation, FSharpOption`1 Name, FSharpOption`1 ShowLegend, FSharpOption`1 Opacity, FSharpOption`1 Text, FSharpOption`1 MultiText, FSharpOption`1 TextPosition, FSharpOption`1 HistFunc, FSharpOption`1 HistNorm, FSharpOption`1 AlignmentGroup, FSharpOption`1 OffsetGroup, FSharpOption`1 NBinsX, FSharpOption`1 NBinsY, FSharpOption`1 BinGroup, FSharpOption`1 XBins, FSharpOption`1 YBins, FSharpOption`1 MarkerColor, FSharpOption`1 MarkerColorScale, FSharpOption`1 MarkerOutline, FSharpOption`1 MarkerPatternShape, FSharpOption`1 MultiMarkerPatternShape, FSharpOption`1 MarkerPattern, FSharpOption`1 Marker, FSharpOption`1 Line, FSharpOption`1 XError, FSharpOption`1 YError, FSharpOption`1 Cumulative, FSharpOption`1 HoverLabel, FSharpOption`1 UseDefaults)

When downgrading DynamicObj to v. 2.0, it runs without issue. I haven't discovered if this affects other charts, or if it would work for histograms with different configuration options. I used the following options, though I cannot share the full code

Chart.Histogram(
    X = xValues,
    Name = modelName,
    MarkerColor = color,
    ShowLegend = showLegend,
    XBins = bins
)

Known workarounds

Just downgrade Dynamic Obj to >= 2.0 and < 3.0

Related information

kMutagene commented 1 week ago

Thanks for reporting this @ntwilson. We are aware of a few problems that the latest major version of DynamicObj brings when used with Plotly.NET (internal tests fail as well when upgrading the Plotly.NET repo from v2 to v3).

The best way is to just not upgrade this dependency for now. I think i will publish a patch to Plotly.NET that pins the version to > v3 though.