首页 > 解决方案 > Html Helper 不包含 Highsoft 的定义

问题描述

我正在使用 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:“HtmlHelper”不包含“Highsoft”的定义,并且最佳扩展方法重载“HtmlHelperExtensions.Highsoft(IHtmlHelper)”需要“IHtmlHelper”类型的接收器

标签: asp.net-mvchighcharts

解决方案


推荐阅读