Example #1
0
        public ActionResult GetThermometersWithBulletinImage(string userToken, string culture = "en", bool isTesting = false)
        {
            var   title0 = culture == "en" ? "Feelings" : "Sentiments";
            var   title1 = culture == "en" ? "Number of times you reported a value less than 4:" : "Nombre de fois où vous avez signalé une valeur inférieure à 4:";
            var   title2 = culture == "en" ? "Number of times you reported a value greater than 7:" : "Nombre de fois où vous avez signalé une valeur supérieure à 7:";
            var   data   = GetThermometerWithBulletinData(userToken, culture, isTesting);
            Image img    = StcGraphics.GetThermometersWithBulletinGraph2D(data, 350, 350, title0, 10, 10, title1, title2);

            using (var ms = new MemoryStream())
            {
                img.Save(ms, ImageFormat.Jpeg);
                return(File(ms.ToArray(), "image/jpeg"));
            }
        }
Example #2
0
        public HttpResponseMessage GetThermometersWithBulletinImage(string userToken, string culture = "en")
        {
            var   title0 = EsmResource.GetString("Feelings", culture);
            var   title1 = EsmResource.GetString("Number of times you reported a value less than 4", culture);
            var   title2 = EsmResource.GetString("Number of times you reported a value greater than 7", culture);
            var   data   = GetThermometerWithBulletinData(userToken, culture);
            Image img    = StcGraphics.GetThermometersWithBulletinGraph2D(data, 410, 350, title0, 12, 12, title1, title2);

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