@Html.Highcharts4Net().AreaChart(settings =>
{
settings.SetChart(s=>s.Inverted = true);
settings.SetTitle(s => s.Text = "Average fruit consumption during one week");
settings.SetSubtitle(s=>
{
s.Style = new CSSObject
{
Position = "absolute",
Right = "0px",
Bottom = "10px"
};
});
settings.SetLegend(s=>
{
s.Layout = Layouts.Vertical;
s.Align = HorizontalAligns.Right;
s.VerticalAlign = VerticalAligns.Top;
s.X = -150;
s.Y = 100;
s.Floating = true;
s.BorderWidth = 1;
s.BackgroundColor = new ColorOrGradient("(Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'", true); // // false to avoid quotes in the javascript code.
});
settings.AddXAxis(s=>
{
s.Categories = new[]
{
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
};
});
settings.AddYAxis(s=>
{
s.Title = new YAxisTitle
{
Text = "Number of units"
};
s.Labels = new YAxisLabels
{
Formatter = @"function () { return this.value; }"
};
});
settings.SetPlotOptions(s=>
{
s.Area = new PlotOptionsArea
{
FillOpacity = 0.5
};
});
settings.AddSeries(s =>
{
s.Name = "John";
s.Data = new Data(new object[]
{
3, 4, 3, 5, 4, 10, 12
});
});
settings.AddSeries(s =>
{
s.Name = "Jane";
s.Data = new Data(new object[]
{
1, 3, 4, 3, 3, 5, 4
});
});
}).Render()