我使用asp.net mvc开发简单的web应用程序,将此软件包添加到我的nuget:
highsoft.web.mvc version 5.0.10.1
并尝试将图表添加到查看页面:
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
@(Html.Highsoft().GetHighcharts(
new Highcharts
{
Chart = new Highsoft.Web.Mvc.Charts.Chart
{
PlotBackgroundColor = null,
PlotBorderWidth = null,
PlotShadow = new Shadow
{
Enabled = false
}
},
Title = new Title
{
Text = "Browser market shares at a specific website, 2014"
},
Tooltip = new Tooltip
{
PointFormat = "{series.name}: <b>{point.percentage:.1f}%</b>"
},
PlotOptions = new PlotOptions
{
Pie = new PlotOptionsPie
{
AllowPointSelect = true,
Cursor = PlotOptionsPieCursor.Pointer,
DataLabels = new PlotOptionsPieDataLabels
{
Enabled = true,
Format = "<b>{point.name}</b>: {point.percentage:.1f} %"
}
}
},
Series = new List<Series>
{
new PieSeries
{
Name = "Browser Share",
Data = @ViewData["pieData"] as List<PieSeriesData>
},
}
}
, "chart")
)
但在这一行:
@(Html.Highsoft().GetHighcharts(
得到这个错误:
Html Helper不包含Highsoft的定义
我该如何解决这个问题?谢谢。
完整的错误消息:
CS1929:&#39; HtmlHelper&#39;不包含的定义 &#39; Highsoft&#39;和最好的扩展方法重载 &#39; HtmlHelperExtensions.Highsoft(IHtmlHelper)&#39;需要一个接收器 输入&#39; IHtmlHelper&#39;