Chart page-breaks

2 posts, 0 answers
  1. Scott Buchanan
    Scott Buchanan avatar
    38 posts
    Member since:
    Dec 2008

    Posted 12 Jan 2015 Link to this post

    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?

  2. T. Tsonev
    T. Tsonev avatar
    2760 posts

    Posted 15 Jan 2015 Link to this post


    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.

    T. Tsonev

    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.

  3. UI for ASP.NET AJAX banner
Back to Top