'Convert HighCharts .Net Core 2.1 Application to .Net 5
I am trying to use HighCharts in a .Net5 Application. All of the examples that they provide appear to be written for .Net Core 2.1. As an example, here is the code that HighSoft provides for creating a bubble chart. I pasted this into my view. I added the appropriate code in my controller. I added the HighSoft.HighCharts and Newtonsoft.Json packages thru Nuget.
@using Highsoft.Web.Mvc.Charts;
@using Highsoft.Web.Mvc.Charts.Rendering;
<h1>@ViewData["Title"]</h1>
<div>
@{ var chartOptions = new Highcharts
{
Chart = new Highsoft.Web.Mvc.Charts.Chart
{
ZoomType = ChartZoomType.Xy
},
Title = new Title
{
Text = "Highcharts Bubbles"
},
Series = new List<Series>
{
new BubbleSeries
{
Data = @ViewData["bubble1"] as List<BubbleSeriesData>
},
new BubbleSeries
{
Data = @ViewData["bubble2"] as List<BubbleSeriesData>
},
new BubbleSeries
{
Data = @ViewData["bubble3"] as List<BubbleSeriesData>
}
}
};
chartOptions.ID = "chart";
var renderer = new HighchartsRenderer(chartOptions);
}
@Html.Raw(renderer.RenderHtml())
</div>
Under .Net Core 2.1, there are no errors. When I switch to .Net5 (or .Net Core 3.1 for that matter). the following lines throw errors:
Data = @ViewData["bubble1"] as List<BubbleSeriesData>
Data = @ViewData["bubble2"] as List<BubbleSeriesData>
Data = @ViewData["bubble3"] as List<BubbleSeriesData>
Intellisense is telling me "The BubbleSeriesData element was not closed. All elements must be self closing or having a matching end tag.
How do I change those lines so they work in .Net5?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
