Reputation: 1143
Does anyone have a working example of using the new Dot Net Highcharts wrapper and changing the series colour? I just cant get it to change for the life of me, think I must have changed every single color property going. None of them default from the normal palette.
@(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")
)
Upvotes: 1
Views: 1468
Reputation: 101
for setting colors (anywhere in Highcharts in asp.net) you should use this construction:
using System.Drawing;
Color = ColorTranslator.FromHtml("#DFEEB2"),
Upvotes: 0
Reputation: 7886
Series color could be set in series as explained in API reference for .NET Highcharts.
...
Series = new List<Series>
{
new ColumnSeries
{
Color = "rgba(165,170,217,1)",
...
Upvotes: 0