private byte[] GetVehicleChartBytes(int userId, int vehicleId, Func <StatisticSeriesEntry, double> yValueAccessor) { Debug.Assert(yValueAccessor != null); StatisticSeries seriesData = chartDataService.CalculateSeriesForVehicle(userId, vehicleId, DateTime.UtcNow.AddMonths(-12), null); var myChart = new Chart(width: 250, height: 120); if (ChartController.PlotSingleChartLine(myChart, seriesData.Entries, yValueAccessor)) { return(myChart.GetBytes("jpeg")); } else { return(null); } }
private byte[] GetChartBytes(int userId, Func <StatisticSeriesEntry, double> yValueAccessor, string chartTitle) { Debug.Assert(yValueAccessor != null); var seriesData = this.chartDataService.CalculateSeriesForUser(userId, DateTime.UtcNow.AddMonths(-12), null); var myChart = new Chart(width: 800, height: 450) .AddTitle(chartTitle) .AddLegend(); if (ChartController.PlotMultipleChartLine(myChart, seriesData.Entries, yValueAccessor)) { return(myChart.GetBytes("jpeg")); } else { return(null); } }