C1WebChart: Empty Image

Posted by: m-schaeferkeller-kgs-com on 10 September 2017, 11:45 am EST

  • Posted 10 September 2017, 11:45 am EST

    Hello,

    c1chartimage.png shows the result of my C1WebChart saved by Browser.
    For Print/Export i will integrate it into a PDF. But the image is empty when i saved it (Other formats also). So my PDF is also empty.

    Where is the Problem? Is there a better Solution?


    <C1WebChart:C1WebChart ID="m_C1Chart1" runat="server" Width="900px" Height="600px" ImageRenderMethod="HttpHandler" ImageTransferMethod="Session"></C1WebChart:C1WebChart>



    Image img = m_C1Chart1.GetImage(ImageFormat.Png, new System.Drawing.Size((int)m_C1Chart1.Width.Value, (int)m_C1Chart1.Height.Value));
    img.Save(@"c:tempchart.png");

    C1.C1Pdf.C1PdfDocument pdf = new C1.C1Pdf.C1PdfDocument();

    pdf.PaperKind = System.Drawing.Printing.PaperKind.A4;
    pdf.Landscape = true;

    RectangleF rect = pdf.PageRectangle;
    rect.Inflate(-72, -72);

    pdf.DrawImage(img, rect, ContentAlignment.MiddleCenter, C1.C1Pdf.ImageSizeModeEnum.Scale);

    pdf.Save(@"c:tempchart.pdf");


    Thanks & Regards
    Matthias




    2012/04/chart.pdf
  • Replied 10 September 2017, 11:45 am EST

    Hello,

    I tried your code with the latest builds and it works properly at my end i.e. chart image is saved and displayed in the PDF. Could you kindly check the attached sample and let me know your observations ?

    The latest builds are available at the following link:
    http://prerelease.componentone.com/dotnet40/C1WebChart/2012-T1/
    http://prerelease.componentone.com/dotnet40/C1WebChart/2012-T1/

    If the issue persists, then kindly modify the same so that I can check it at my end.

    Regards
    Ashish
    2012/04/C1WebChart_SaveImage.zip
  • Replied 10 September 2017, 11:45 am EST

    Hello Ashish,

    thanks for your reply. Your Example works.

    I add "m_C1Chart2.SaveChartToFile(@"C:temptempchart.xml");" to your code and "m_C1Chart1.LoadChartFromFile(@"C:temptempchart.xml");" in my code. Everything works.

    In the next Step I do a "m_C1Chart1.SaveChartToFile(@"c:tempchart.xml");" with my Chart created in CodeBehind. Attached you find this Chart-Config-File. Can you check this file for the problem ?

    I'm using C1.Web.C1WebChart.4.dll in File-Version 4.0.20112.21181. Trying to switch to the latest PreRelease 4.0.20121.22115 results in the following Message:
    "Die Datei oder Assembly "_C1.Web.C1WebChart.4" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)"

    The Description in http://prerelease.componentone.com/dotnet/howtoinstall.html describes a Folder "C:Program FilesComponentOne Studio.NETbin", but I didn't find this Folder. The DLL resides only in my Project. Exchanging C1.Web.C1WebChart.4.dll seems to be not enough.
    How can I switch to the newest Version?

    Thanks & Regards
    Matthias
    2012/05/chart.xml
  • Replied 10 September 2017, 11:45 am EST

    Hello Matthias,

    You may run the C1Live utility which is available under the Component One folder in All Programs for upgrading the builds. Else, you may download the same and replace the corresponding dll's present in the bin folder i.e. C:Program FilesComponentOneStudio for ASP.NETbinv2 where all the dll's are stored, by default.

    The error occurs because C1WebChart needs corresponding dll's of Win Chart as well which can be downloaded from the following link:
    http://prerelease.componentone.com/dotnet40/C1Chart/2012-T1/
    http://prerelease.componentone.com/dotnet20/C1Chart/2012-T1/

    Moreover, it is difficult to conclude anything with the given xml, If the issue persists, then I would suggest you modify the sample so that it replicates the issue and I can assist you further.

    Regards
    Ashish
Need extra support?

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

Learn More

Forum Channels