-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Description
Description
I try to create a chart and export it into a Base64 JPG string to display it as image on a page. If I run the .ToBase64JPGString (or any other ToBase64...), the export does not get finished.
Same behavior if I use .SaveJPG("chart.jpg").
.SaveHtml("chart.html") works as expected.
Run this in a console application, it works.
Repro steps
- Create a new Blazor Server Side Application
- Add class Index.razor.cs
- Add the following code in Index.razor.cs:
string image = string.Empty;
protected override void OnParametersSet()
{
List<DateTime> dateTimes = new();
List<float> temp = new();
List<float> utemp = new();
List<float> ltemp = new();
for (int i = 0; i < 10; i++)
{
dateTimes.Add(DateTime.Now.AddDays(i));
}
for (int i = 0; i < 10; i++)
{
float t = Random.Shared.Next(10, 30);
float diff = Random.Shared.Next(1, 10);
temp.Add(t);
utemp.Add(t + diff);
ltemp.Add(t - diff);
}
var range = Chart.Range<DateTime, float, string>(dateTimes, temp, utemp, ltemp, Name: "range", mode: Plotly.NET.StyleParam.Mode.Lines_Markers);
image = range.ToBase64JPGString();
}
- run the application
Expected behavior
Base64 image string
Actual behavior
.ToBase64JPGString hangs
.SaveJPG hangs
Related information
Windows 11
Plotly.Net 4.2.0
Plotly.Net.ImageExport 5.0.1
Plotly.Net.CSharp 0.11.1
.NET 6.0