@using Highsoft.Web.Mvc.Stocks
@using Highsoft.Web.Mvc.Stocks.Rendering
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
@{ var chartOptions =
new Highstock
{
Title = new Title
{
Text = "AAPL stock price by minute"
},
Subtitle = new Subtitle
{
Text = "Using explicit breaks for nights and weekends"
},
XAxis = new List<XAxis>
{
new XAxis()
{
Breaks = new XAxisBreaks()
{
From = (long)(new DateTime(2011, 9, 6,16,0,0) - new DateTime(1970, 1, 1)).TotalMilliseconds,
To = (long)(new DateTime(2011, 9, 7, 8,0,0) - new DateTime(1970, 1, 1)).TotalMilliseconds,
Repeat = 24 * 3600 *1000,
BreakSize = 3600 *1000
},
}
},
RangeSelector = new RangeSelector()
{
Buttons = new List<RangeSelectorButton>() { new RangeSelectorButton { Type = "minute", Count = 60, Text = "1h" }, new RangeSelectorButton { Type = "day", Count = 1, Text = "1d" }, new RangeSelectorButton { Type = "all", Count = 1, Text = "All" } },
InputEnabled = false,
Selected = 1
},
Series = new List<Series>
{
new AreaSeries
{
Data = ViewBag.IntradayData as List<AreaSeriesData>,
Name = "AAPL",
GapSize = 5,
Tooltip = new AreaSeriesTooltip
{
ValueDecimals = 2
},
TurboThreshold = 10000,
FillColor = @ViewBag.fillColor
}
}
};
chartOptions.ID = "chart";
var renderer = new HighstockRenderer(chartOptions);
}
@Html.Raw(renderer.RenderHtml())