Ticket Q98344
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Web - Capability to print and export a WebChartControl on the client side

Export from WebChartControl

created 17 years ago

Hello.
I am using both ChartContorl and WebChartControl, in the ChartContorl there is the ability to export the chart into pdf format or html format and other formats.
I couldn't find how to do it in the WebChartControl.
How can i do it ?
Thanks,
Koby.
p.s. i am also using PivotGrid and ASPxPivotGrid and on both i have the ability to export.

Show previous comments (5)

    Thanks for your answer Alan.

    1. PDF and XSL - not working fine for me, when i add data to the chart it will be exported correctly, but if the data is small enough it will be exported correctly.
    2. JPG - Look fine now, i will test it a little bit more but for now it looks fine :).
      Thanks,
      Koby.
      p.s. I have attached the project with the data in which the PDF and XSL will not work fine.
    DevExpress Support Team 17 years ago

      Hello Koby,
      I've investigated your test project and confirm that I see the problem with exporting a chart to PDF and XLS. Again, this is caused by the chart size, which is too small to display a diagram and a legend. You need to either make the chart's size bigger, or hide a legend. To make a chart bigger, please try to make axis labels smaller - in any case, they are unreadable now. Does this help you with the PDF and XLS output?
      Alan.
      R&D, .net Team.

        Hey Alan.
        Well it will be very hard for me to resize the chart every time i what to export it.
        I don't understand why it works on the Win forms application and not on the Web Application.
        Is it going to be implemented soon ?
        Thanks,
        Koby.

        Answers approved by DevExpress Support

        created 17 years ago (modified 12 years ago)

        Hello Koby,
        First, about the problem with exporting a chart to PDF and XLS. I must say that this problem isn't specific to Web charts only - you may observe the same behavior when resizing a Windows Forms chart. The current behavior presumes that the diagram is hidden when there isn't enough space for it on a chart (for example, when a legend occupies too much space). And, when you export a chart to PDF in your example, it turns out that the chart is resized to fit the page width (which is used in the resulting PDF file), and its size in PDF is smaller than its size on the Web page. That is why the diagram is visible on a Web page, but is hidden in PDF and XLS.
        To avoid this problem I suggest you to do one of the following:

        1. Set winChart.OptionsPrint.SizeMode = DevExpress.XtraCharts.Printing.PrintSizeMode.None and then manually set the chart size.
          or
        2. Set the Legend.AlignmentHorizontal property to Center, AlignmentVertical to TopOutside and Direction to LeftToRight.
          This should help.
          As for exporting a report to HTML, it seems to be impossible to export a chart in such a way. The reason is that the stream can contain only one file, and this is the HTML file in your case. A chart image can't be saved anywhere, and so that is why the HTML output is empty. Could you please explain, why do you need to export a chart to HTML and MHT from a Web Page?
          Best regards, Alan.
          R&D, .NET Team.
          Comments (2)

            Hi,
            I did everything you said in order to export the WebChartControl but the PDF file shows an empty Chart container. By the way the WebChartControl is created dinamically at runtime in C#. What am I doing wrong? Any help would be appreciated.

            Cheers, Patricia
            PS. please find attached the PDF file

            DevExpress Support Team 12 years ago

              Hi Patricia,
              Please check to see that your runtime chart initialization routine is executed on every round trip to the server (i.e., via the Page_Load event). If this does not help, create a separate ticket and provide a small sample project to illustrate the issue. We will be glad to help you.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.