Chart Dpi settings

Thread is closed for posting
5 posts, 1 answers
  1. David
    David avatar
    4 posts
    Member since:
    Oct 2010

    Posted 16 Nov 2010 Link to this post

    Is there a way to set the DPI settings for the chart image.  I did notice an internal property for BitmapResolution;however I did not see anyway thru the control to set that.

    While I could use the code below to save a 300dpi image of the chart, isn't the source images (the generated chart) dpi set to the chart defaults? 
    System.Drawing.Bitmap image = RadChart1.GetBitmap() as System.Drawing.Bitmap; 
    image.SetResolution(300, 300); 
    image.Save(@"C:\myimage.png");

    I would not want to take at 96dpi image and convert it into a 300dpi image, where are those extra dpi's gonna come from? I think of that like taking a 200px X 200px image and resizing to 400px X 400px, which would not produce the same quality image I would get pixelation. 

    I have created a Chart generator control where the user can enter data etc.. and generate the chart from the data.  Then I want to allow them to save the generated chart image at a minimum of 300dpi since this will be added to a print ready pdf.  I would want a high quality image produced since this is for printing.

    I appreciate any information or advice on this matter.

    Thank you!

  2. Answer
    Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 19 Nov 2010 Link to this post

    Hi David,

    Generally speaking the DPI setting for an image is independent of the number of pixels contained within. So if you are generating let's say a 960 x 960 pixel image at 96 DPI its size on screen will be 10 inches. However, if you set DPI to be 300 (for print for example) then the physical size of the image will be 3.2 inches. In order for the image to be the same size on a 300DPI media you will need to increase detail (pixels) as you have correctly guessed in your post.

    You can calculate the number of pixels increase lke this: 300/96 = 3.125. This is the ratio by which you need to expand the image. So 960 x 3.125 = 3,000 pixels. So simply increase the dimensions of the chart to that new number of pixels and set a resolution of 300 DPI. The end result should be the same physical size without any loss in detail.

    All the best,
    Vladimir Milev
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David
    David avatar
    4 posts
    Member since:
    Oct 2010

    Posted 08 Dec 2011 Link to this post

    That is exactly what I did and it worked great.

    Sorry, I never did come back to mark this as answered last year :)   Better late than never.
  5. David
    David avatar
    4 posts
    Member since:
    Oct 2010

    Posted 08 Dec 2011 Link to this post

    That is exactly what I did and it worked great.

    Sorry, I never did come back to mark this as answered last year :)   Better late than never.
  6. David
    David avatar
    4 posts
    Member since:
    Oct 2010

    Posted 08 Dec 2011 Link to this post

    That is exactly what I did and it worked great.

    Sorry, I never did come back to mark this as answered last year :)   Better late than never.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017