public ActionResult GetScalableLineImage(string userToken, string culture = "en", bool isTesting = false) { var title1 = culture == "en" ? "Your Feelings by Activity Type" : "Vos sentiments par type d'activité"; var title2 = culture == "en" ? "ActivityType" : "Type d'activité"; var title3 = culture == "en" ? "Anverage Score" : "Score moyen"; var data = GetChartDataForScalableLine(userToken, culture, isTesting); var setting = new ScalabelLineGraphSetting { ChartTitle = title1, ChartTitleFontSize = 8, ChartFontSize = 8, IsChartTitleHighlighted = true, LegendIcon = LegendIconType.Rectangle, XAxisTitle = title2, XAxisTitleFontSize = 8, YAxisTitle = title3, YAxisTitleFontSize = 8, NotchCount = 5 }; Image img = StcGraphics.GetScalableLineGraph2D(data, 400, 40, setting); using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); return(File(ms.ToArray(), "image/jpeg")); } }
public HttpResponseMessage GetScalableLineImage(string userToken, string culture = "en") { var title1 = EsmResource.GetString("Your Feelings by Activity Type", culture); var title2 = EsmResource.GetString("ActivityType", culture); var title3 = EsmResource.GetString("Anverage Score", culture); var data = GetChartDataForScalableLine(userToken, culture); var setting = new ScalabelLineGraphSetting { ChartTitle = title1, ChartTitleFontSize = 8, ChartFontSize = 8, IsChartTitleHighlighted = true, LegendIcon = LegendIconType.Rectangle, XAxisTitle = title2, XAxisTitleFontSize = 8, YAxisTitle = title3, YAxisTitleFontSize = 8, NotchCount = 5 }; Image img = StcGraphics.GetScalableLineGraph2D(data, 410, 350, setting); using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); var result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new ByteArrayContent(ms.ToArray()); result.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeg"); return(result); } }