示例#1
0
        public ActionResult GetMoodCountImage(string userToken, string culture = "en", bool isTesting = false)
        {
            var   title = culture == "en" ? "Mood Count" : "Compte d'humeur";
            var   data  = GetEmotionCountData(userToken, culture, isTesting);
            Image img   = StcGraphics.GetHalfDoughnutWithEmojiLegendGraph2D(data, 500, 500, title, 18);

            using (var ms = new MemoryStream())
            {
                img.Save(ms, ImageFormat.Jpeg);
                return(File(ms.ToArray(), "image/jpeg"));
            }
        }
示例#2
0
        public HttpResponseMessage GetMoodCountImage(string userToken, string culture = "en")
        {
            var   title = culture == "en" ? "Mood Count" : "Compte d'humeur";
            var   data  = GetEmotionCountData(userToken, culture);
            Image img   = StcGraphics.GetHalfDoughnutWithEmojiLegendGraph2D(data, 500, 500, title, 18);

            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);
            }
        }