ASP.NET - Is it possible for watermark on Chart control in using C#

Asked By Venkatesh Desai on 26-Jun-12 09:18 AM
Jitendra Faye replied to Venkatesh Desai on 26-Jun-12 09:47 AM
You can complete this task using devexpress control.

refer this link , here you will get example-

Hope this will help you.
Lalit M replied to Venkatesh Desai on 26-Jun-12 12:28 PM
Check this link
[)ia6l0 iii replied to Venkatesh Desai on 27-Jun-12 09:42 PM
Perhaps, nobody realized the question was related to Microsoft charts. 

Nevertheless, the chart has a SaveImage method, that writes to a disc where you have specified. See below for a sample.
chartName.SaveImage(filePath, ChartImageFormat.Png); 

You can then open the image using a Image stream, and then add a water mark text. Or do as shown in the sample below. 
using (MemoryStream imageStream = new MemoryStream())
      //Save the Image to a stream
      chartName.SaveImage(imageStream, ChartImageFormat.Png);
      //create a bitmap object.
      Bitmap bitmap    = bitmap.FromStream(imageStream);
      Graphics myGraphics = Graphics.FromImage(bitmap);
      //set the watermark text to be added as a watermark.
      string watermarkText = "Place the watermark text";
      Font watermarkFont = new Font(new FontFamily("Arial"), 18.0, FontStyle.Bold | FontStyle.Italic);
      //get size of the string.
      SizeF size = myGraphics.MeasureString(watermarkText, watermarkFont);
      float X = bitmap.Width / 2 - size.Width / 2;
      float Y = bitmap.Height / 2 - size.Height / 2;
    //Draw the text
      myGraphics.DrawString(watermarkText, watermarkFont, new SolidBrush(Color.DarkMagenta), X, Y);
      //Save the new image with the watermark text
      using (MemoryStream watermarkedStream = new MemoryStream())
        bitmap.Save(watermarkedStream, ImageFormat.Png);

Hope this helps.
Momo Momo replied to [)ia6l0 iii on 29-Sep-13 05:28 AM
that's really great concept to put a  watermark on chart control's image  ,
but forgive me , i'm not sure where to put that code !! ?

i want to make the watermark to be created every time when the user saves the chart as image ,
 where to put that code !!?

Thank you .