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

Chart page-breaks

1 Answer 52 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Scott Buchanan
Top achievements
Rank 1
Scott Buchanan asked on 12 Jan 2015, 10:20 PM
I know this is really odd, but I'd like to please a big customer without a lot of custom code.  We are using UI for ASP.NET MVC 2014.3.1119 in an MVC project.  One of the views displays a horizontal bar chart.  We have just added export to PDF on all to all views (not Telerik, but another commercial product).  The trouble comes when sending this view to PDF - when there are many bars, the chart is split across multiple pages.  Due to some formatting, optional text and such on the view, etc. sometimes it paginates neatly between bars but most often it splits a bar across two pages.

Obviously, this issue exists whether I print from the browser, or use any capture tool (local or server PDF).

I'm just wondering if anyone has encountered this and done some clever math with the gaps and spaces based on actual plot size (not sure how to get that) versus the page size (less margins). 

If I have to write code for this math, can I rely on getting the same figures from the Telerik objects for all browsers or are there going to be differences I would have to account for?

Best,
Scott

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 15 Jan 2015, 08:45 AM
Hello,

I think we can get the coordinates of the category boundaries with a bit of code. Those should be pretty safe for placing page breaks.
Just a word of warning. This is not currently exposed as a public API and can potentially change.
   var chart = e.sender;
   var axis = chart._plotArea.categoryAxis;
   var ticks = axis.getMajorTickPositions();


See this snippet for reference.

Note that these are coordinates relative to the chart element.
I hope you'll be able to integrate this with the export solution you're using.

Regards,
T. Tsonev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
Scott Buchanan
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or