public Highcharts GetEncounterDurationOverTime(int bossFightId, int difficultyId, int guildId, string guildName, string bossFightName) { var graphTitle = string.Format("{0} vs {1}: Encounter duration over time", guildName.Replace("'", "\\\'"), bossFightName); var stats = _recordsRepository.GetEncounterDurationOverTime(bossFightId, difficultyId, guildId); if (!stats.Any()) { return(null); } #region Build chart series //var dpsSeries = new Series() { Name = "Damage" }; //var dpsDataList = new List<object[]>(); //var hpsSeries = new Series() { Name = "Healing", PlotOptionsSpline = new PlotOptionsSpline() { Visible = false } }; //var hpsDataList = new List<object[]>(); //var apsSeries = new Series() { Name = "Absorption", PlotOptionsSpline = new PlotOptionsSpline() { Visible = false } }; //var apsDataList = new List<object[]>(); var durationSeries = new Series() { Name = "Duration" }; var durationDataList = new List <object[]>(); foreach (var stat in stats) { //dpsDataList.Add(new object[] { stat.Date, stat.AverageDps }); //hpsDataList.Add(new object[] { stat.Date, stat.AverageHps }); //apsDataList.Add(new object[] { stat.Date, stat.AverageAps }); durationDataList.Add(new object[] { stat.Date, new DateTime().Add(stat.Duration) }); } //dpsSeries.Data = new Data(dpsDataList.ToArray()); //hpsSeries.Data = new Data(hpsDataList.ToArray()); //apsSeries.Data = new Data(apsDataList.ToArray()); durationSeries.Data = new Data(durationDataList.ToArray()); //var chartSeries = new Series[] { dpsSeries, hpsSeries, apsSeries }; var chartSeries = durationSeries; #endregion var chart = new Highcharts(string.Format("bf{0}d{1}g{2}duration", bossFightId, difficultyId, guildId)) .InitChart(new Chart { DefaultSeriesType = ChartTypes.Spline, ZoomType = ZoomTypes.Xy, Height = 400, BackgroundColor = new BackColorOrGradient(new Gradient { LinearGradient = new[] { 0, 0, 0, 400 }, Stops = new object[, ] { { 0, Color.FromArgb(13, 255, 255, 255) }, { 1, Color.FromArgb(13, 255, 255, 255) } } }), Style = ChartColors.WhiteTextStyle }) .SetCredits(ChartDefaults.Credits) .SetOptions(new GlobalOptions { Colors = ChartColors.ColorArrayBlackBg(), Global = new Global { UseUTC = false } }) .SetTitle(new Title { Text = graphTitle, Style = ChartColors.WhiteTextStyle }) .SetXAxis(new XAxis { Type = AxisTypes.Datetime, DateTimeLabelFormats = new DateTimeLabel { Month = "%e %b", Year = "%e %b", Day = "%e %b", Week = "%e %b" }, LineColor = Color.White, TickColor = Color.White, Labels = new XAxisLabels { Style = ChartColors.WhiteTextStyle }, }) .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Encounter time", Style = ChartColors.WhiteTextStyle }, Type = AxisTypes.Datetime, DateTimeLabelFormats = new DateTimeLabel { Hour = "%Mm %Ss", Minute = "%Mm %Ss", Second = "%Mm %Ss" }, //Min = 0 TickColor = Color.White, LineColor = Color.White, Labels = new YAxisLabels { Style = ChartColors.WhiteTextStyle }, }) //.SetTooltip(new Tooltip() { ValueSuffix = " per second" }) .SetTooltip(new Tooltip { Formatter = @"function() { return '<b>' + this.series.name +'</b><br/>' + Highcharts.dateFormat('%Mm %Ss',new Date(this.y)); }" }) .SetSeries(chartSeries) .SetExporting(new Exporting { Enabled = false }) .SetLegend(new Legend() { ItemStyle = ChartColors.WhiteTextStyle, ItemHoverStyle = "color: '#bbb'" }) ; return(chart); }