public FileResult UniVariateChartByState(string chartSize, string chartType, int country_id, int test_id, int?category_id, int?question_id) { Test test = new TestsServices().GetById(test_id); ChartDetails cd = new ChartDetails(chartSize, chartType, false, this.GetChartDetails(12, 13), 2, test.GetAvgAndMedByStates(null, null, country_id), test_id); MemoryStream ms = new MemoryStream(); cd.chart.SaveImage(ms); return(new FileContentResult(ms.GetBuffer(), @"image/png")); }