点网高图表系列颜色



有没有人有使用新的 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")
)

可以按照 .NET Highcharts 的 API 参考中所述按系列设置系列颜色。

...
Series = new List<Series>
{
    new ColumnSeries
    {
        Color = "rgba(165,170,217,1)",
        ...

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

using System.Drawing;
Color = ColorTranslator.FromHtml("#DFEEB2"),

最新更新