Home

Chart.ToBitmap - Method not found exception?

edited April 17

Hi All,

I am trying to generate a html-file as output with charts inside. First step is to generate base64 encoded png and use it as embed resource:

   var start = temperCurve.Select(d => d.TimeStamp).Min();

    var chartTemp = temperCurve.Chart(f => (f.TimeStamp - start).ToString(@"hh\:mm\:ss"))
                               .AddYSeries(f => f.TempActual, name: nameof(TemperCurveDataDto.TempActual), seriesType: Util.SeriesType.Line)
                               .AddYSeries(f => f.TempTarget, name: nameof(TemperCurveDataDto.TempTarget), seriesType: Util.SeriesType.Line)
                               .AddYSeries(f => f.ProcessState, name: $"{nameof(TemperCurveDataDto.ProcessState)}", seriesType: Util.SeriesType.Line, useSecondaryYAxis: true);

    chartTemp.DumpInline($"Temperature, Start: {start:O}", 1920, 1080);
    var bmpTemp = chartTemp.ToBitmap(1920, 1080);
...

But I get a MissingMethodException - Method not found: 'System.Drawing.Bitmap LINQPad.ChartExtensions.ToBitmap(LINQPad.LINQPadChart, Int32, Int32)'.

Is this a bug or is there something wrong in my code?

Tanks!
George

Comments

  • edited April 17

    If I create a new query with a simple chart,
    then I have no problem calling the .ToBitmap extension :o

    There seems to be a problem with the NuGet references.
    Some of the custom packages use overriding extensions.

  • I'm surprised LINQPad didn't require you to clarify which extension method you're attempting call. I certainly get that with conflicting enums and classes (Newtonsoft.Json vs System.Xml is a prime example).

Sign In or Register to comment.