我将在我的.NetCore C#项目中使用来自高级图书馆的折线图。我对这件事很新。遵循所有highcharts.net指令看起来一切都很容易。我已经复制了
<highchart:LineChart id="hcVendas" runat="server" Width="500" Height="350" />
在About.cshtml中,左下方的代码位于控制器中:
public IActionResult About()
{
//Defining Axis
hcVendas.YAxis.Add(new YAxisItem { title = new Title("Faturamento") });
hcVendas.XAxis.Add(new XAxisItem { categories = new[] { "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002" } });
//New data collection
var series = new Collection<Serie>();
series.Add(new Serie { data = new object[] { 400, 435, 446, 479, 554, 634, 687, 750, 831 } });
//bind
hcVendas.DataSource = series;
hcVendas.DataBind();
if (User.IsInRole("Adminstrators"))
ViewData["Message"] = "Your application description page.";
return View();
}
但我收到错误&#34;错误CS0103名称&#39; hcVendas&#39;在当前背景下不存在&#34; 任何想法都受到高度赞赏。