コード例 #1
0
        public ActionResult GetLocationSim24HourChartImage(DateTime startDate, DateTime endDate, Guid locationId)
        {
            var stats = _statisticsManager.GetHourStatisticsForLocation(startDate.ToUniversalTime(),
                                                                        endDate.ToUniversalTime().AddDays(1.0), locationId, false);

            var chart = new Chart(800, 600)
                        .AddTitle(Resources.Call_Simultaneous + " - " + stats.LocationName)
                        .AddLegend("")
                        .SetXAxis(Resources.Stats_Time_Of_Day);

            chart.AddSeries(
                name: Resources.Stats_Max_In_Period,
                chartType: "Column",
                xValue: stats.Statistics.Select(s => s.Label).ToArray(),
                yValues: stats.Statistics.Select(s => s.MaxSimultaneousCalls).ToArray())
            .AddSeries(
                name: Resources.Stats_Median_In_Period,
                chartType: "Column",
                xValue: stats.Statistics.Select(s => s.Label).ToArray(),
                yValues: stats.Statistics.Select(s => s.MedianNumberOfSimultaneousCalls).ToArray())
            ;

            return(File(chart.GetBytes("png"), "image/png"));
        }