Dot Net Highcharts系列颜色

时间:2017-05-11 10:50:45

标签: c# asp.net-mvc highcharts dotnethighcharts

有没有人有一个使用新的Dot Net Highcharts包装并改变系列颜色的工作示例?我不能让它改变我的生活,认为我必须改变每一个颜色属性。它们都不是默认的普通调色板。

@(Html.Highsoft().Highcharts(
new Highcharts
{
    Title = new Title
    {
        Text = "Picks Grouped By Target And Week Of Year"

    },

    XAxis = new List<XAxis>
    {
        new XAxis
        {
            Categories = WeeksOfYear.ConvertAll<string>(x => x.ToString())
        }
    },
    YAxis = new List<YAxis>
    {
        new YAxis
        {
            Min = 0,
            Title = new YAxisTitle
            {
                Text = "Number of picks"
            },
            StackLabels = new YAxisStackLabels
            {
                Enabled = true,
                Style = new Hashtable
                {
                    { "fontWeght", "bold" }
                }
            }
        }
    },
    Legend = new Legend
    {
        Align = LegendAlign.Right,
        X = -30,
        VerticalAlign = LegendVerticalAlign.Top,
        Y = 25,
        Floating = true,
        BorderColor = "#CCC",
        BorderWidth = 1,
        BackgroundColor = "white"

    },
    Tooltip = new Tooltip
    {
        Formatter = "formatToolTip"
    },
    PlotOptions = new PlotOptions
    {
        Column = new PlotOptionsColumn
        {

            Stacking = PlotOptionsColumnStacking.Normal,
            DataLabels = new PlotOptionsColumnDataLabels
            {
                Enabled = true,
                Color = "#FFFFFF",

                Shadow = new Shadow()
                {
                    Enabled = true,
                    Color = "black",
                    Width = 10,
                    OffsetX = 0,
                    OffsetY = 0
                }
            }
        }
    },

    Series = new List<Series>
    {
        new ColumnSeries
        {
            Name = "Over 45 Min",
            Data = @ViewData["StackedColumnOver45Min"] as List<ColumnSeriesData>

    },
        new ColumnSeries
        {
            Name = "Under 45 Min",
            Data = @ViewData["StackedColumnUnder45Min"] as List<ColumnSeriesData>

        }
    }
}
, "WeekOfYearSlaStackedColumn")
)

1 个答案:

答案 0 :(得分:0)

用于设置颜色(在asp.net中的Highcharts中的任何位置),您应该使用这种结构:

using System.Drawing;

Color = ColorTranslator.FromHtml("#DFEEB2"),