This is a migrated thread and some comments may be shown as answers.

Export cartesianchart to RadDocument in code behind

1 Answer 72 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Auvo
Top achievements
Rank 1
Auvo asked on 15 Jan 2018, 01:20 PM

Hi

I need to create Windows service,which creates the cartesianChart with data and placed it to the radDocument with additional controls (logo, titles, table)

If I add series and other fields (logo, texts,..) first to the visual element like stackpanel, and then creating a RadDcoument from there, it works ok

 

But can I do this without placing chart first to the visual element? If I try to do this, it's throw "The parameter value must be greater than zero.
Parameter name: pixelWidth" error

 

If this can be done, can you provide an example?

 

Regards,

Auvo

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 16 Jan 2018, 01:44 PM
Hello Auvo,

I guess you are using the ExportToImage() method to export the chart to a picture and than placing it in the RadDocument. In any case you will need to measure and arrange the control before exporting it to any format. Adding the chart to the visual tree measures and arranges it. However, you can do that manually by calling its Measure() and Arrange(), and also UpdateLayout() methods before you call the export method. Here is an example in code:
chart.Measure(new Size(400, 400));
chart.Arrange(new Rect(new Size(400, 400)));
chart.UpdateLayout();

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ChartView
Asked by
Auvo
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or