Export activeanalysis graphs to bitmap

Posted by: hemoeco on 3 August 2017, 3:58 pm EST

  • Posted 3 August 2017, 3:58 pm EST

    Hi... how can i export using code the analysis graphics to image... how do i use this?

    Me.PivotView2.DrawToBitmap(...)


    ?

    Thanks
  • Replied 3 August 2017, 3:58 pm EST

    <h2>hemoeco,</h2>You can export current layout view to image by using PivotView Export method like this:

      FileInfo file = new FileInfo("C:\\test.bmp");
      pivotView1.Export(file, ExportImageFormat.Bmp,ViewLayoutSettings.CreateDefault());

    Thank you,
    Andrey T.

  • Replied 3 August 2017, 3:58 pm EST

    I found a solution but it's not the right solution for to use the clipboard...

           Dim img2 As System.Drawing.Bitmap
            PivotView2.CopyDataToClipboard(GrapeCity.ActiveAnalysis.Export.ClipboardFormat.Bitmap, GrapeCity.ActiveAnalysis.Export.ViewLayoutSettings.CreateDefault)
            img2 = Clipboard.GetImage
            img2.Save("c:\itsara\test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)



  • Replied 3 August 2017, 3:58 pm EST

    Ryan,

    Thank you for your suggestion. I have opened a new feature request Case 154813 for the development team to add the export to image, as a default export option in the pivotview toolbar. You will be notified once a build containing this feature would be released in future.

    Regards,
    Sankalp
  • Replied 3 August 2017, 3:58 pm EST

    If possible it would be great if this can be added in as a default export option (along with save to csv, excel and pdf).



    Thanks



    Ryan
  • Replied 3 August 2017, 3:58 pm EST

    :( we have a requirement to export charts to images



    thanks anyways
  • Replied 3 August 2017, 3:58 pm EST

    ryne,

    The Web based Pivot view control currently does not support exporting the view to PNG, BMP, JPG, etc.We already have a feature request with tracking number 158110 to implement this feature. I have added you to the list of affected users and you will be notified once the case gets implemented.

    Best Regards,
    Abhishek
  • Replied 3 August 2017, 3:58 pm EST

    ryne,

    Unfortunately I am unable to provide you an workaround for exporting the layout to images in Web Based projects. You will have to wait until case 158110 gets implemented.

    Best Regards,
    Abhishek
  • Replied 3 August 2017, 3:58 pm EST

    Is there a workaround that you can suggest to export web based pivot view graphs to image?



    Thanks in advance,
  • Replied 3 August 2017, 3:58 pm EST

    I tried out this code to export my pivotview's bar chart, but I got an error.

    It seems that PivotView Export method doesn't accept 3 arguments. Also, ExportImageFormat.Bmp is not accepted as argument in this method.

    <BLOCKQUOTE><table width="85%"><tr><td class="txt4"><img src="/wp-content/uploads/CS_images/icon-quote.gif"> Andrey - DD wrote:</td></tr><tr><td class="quoteTable"><table width="100%"><tr><td width="100%" valign="top" class="txt4"><h2>hemoeco,</h2>You can export current layout view to image by using PivotView Export method like this:

      FileInfo file = new FileInfo("C:\\test.bmp");
      pivotView1.Export(file, ExportImageFormat.Bmp,ViewLayoutSettings.CreateDefault());

    Thank you,
    Andrey T.

    </td></tr></table></td></tr></table></BLOCKQUOTE>
  • Replied 3 August 2017, 3:58 pm EST

    ryne,

    Can you please try this code instead and let me know if it works out?

    using System.Windows.Forms;
    using System.IO;
    using GrapeCity.ActiveAnalysis;

    namespace WindowsFormsApplication2
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            private void Form1_Load(object sender, EventArgs e)
            {

                FileInfo file = new FileInfo("C:\\test.bmp");
                this.pivotView1.Export(file, GrapeCity.ActiveAnalysis.Export.ExportImageFormat.Bmp, GrapeCity.ActiveAnalysis.Export.ViewLayoutSettings.CreateDefault());
            }
        }
    }


    Best Regards,
    Abhishek
  • Replied 3 August 2017, 3:58 pm EST

    Hi Abhishek,

    I'm working on web application, so I guess this will not work for me :(


    Regards,
    ryne
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels