简体   繁体   中英

Saved image of chart is fuzzy/noisy

I have two MS Charts that I wish to export as .png images. For both I use the Chart.SaveImage() method, but with different results. One is fuzzy/noisy and the other looks clean.

Here is the fuzzy graphic (later called ChartBHKW). Please note that only the text outside the Chart looks blurry. The legend is displayed correctly.

模糊图形

And here is the normal graphic , saved as it should be (later called ChartAmortisation):

普通图形

In order to preserve the image size and aspect ratio, the two Charts undergo the following saving procedure: undock, rezise, save, and dock again. Code below.

With Main.ChartBHKW
    'Resize and save
    .Dock = DockStyle.None
    .Size = PrintSize
    .SaveImage(JDLImagePath, ChartImageFormat.Png)

    'Reset
    .Dock = DockStyle.Fill
End With

With Main.ChartAmortisation
    'Resize and save
    .Dock = DockStyle.None
    .Size = PrintSize
    .SaveImage(AmortisationImagePath, ChartImageFormat.Png)

    'Reset
    .Dock = DockStyle.Fill
End With

I tried with various different sizes and formats. The size has no influence. But it is interesting to see what happens when saved as .jpg or .bmp. Example below.

模糊图形为jpg

Any idea?

I strongly believe that it is related to the background , I guess it's transparent . Use white instead

Set: chart.AntiAliasing=AntiAliasingStyles.Graphics;
See This page for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM