Resize Chart image in RadSplitter

Thread is closed for posting
4 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 06 Jun 2007 Link to this post


    Requirements

    RadControls version
     Web.UI version

    2007 Q1 SP1
    2007_3_1425
    .NET version

    2.0
    Visual Studio version

    VS2005 SP1
    programming language

      javascript, C#
    browser support

    all browsers supported by RadControls

    To convert code from posted projects Telerik online converter

     
    PROJECT DESCRIPTION
    Some RadControls like RadGrid automatically resize themselves when placed in RadSplitter or container that has variable height/width. However this does not apply for RadChart as the control renders a normal image on the page, which does not have any dynamic values to resize itself. This how ever can be achieved with the help of some javascript for manually altering the image width/height according to the RadPane's ones. Find attached a project that shows you how to do this.
  2. C29A0E8A-A7D5-4F35-BDE2-02A2F97BFC21
    C29A0E8A-A7D5-4F35-BDE2-02A2F97BFC21 avatar
    5 posts
    Member since:
    Jun 2012

    Posted 06 Jun 2007 Link to this post

    Thank you very much for your solution, But unfortunately it is not what I wants.

    Since here image will get destorted. Hence I wants to Redraw chart again for the new size. And this can be done only if I can get Serverside event on Pane Resize. Will you tell me how can I get it?

    Thanks

    Anil Lakhani
  3. 3BD6F94B-4C03-46D3-8568-9982F1F201BF
    3BD6F94B-4C03-46D3-8568-9982F1F201BF avatar
    10940 posts
    Member since:
    May 2014

    Posted 14 Jun 2007 Link to this post

    Hi Lakhani,

    Sorry for the late reply, but sometimes time just isn't enough for all you want to do. Find attached a new project which shows you how to resize real time (setting the dimensions on the server) with the help of the AjaxManager. I have used the AjaxManager, so the unpleasant postbacks can be avoided.

    I hope this is what you are looking for.

    Kind regards,
    Steve
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 08 Mar 2008 Link to this post

    Updated versions of the projects are attached to the initial message. Minor changes in the client-side code as follows:

    Client-side resize:
    function ResizeChart(sender, args) 
                { 
                    var chart = $get("<%= RadChart1.ClientID %>"); 
                    var chartimg = chart.getElementsByTagName("img")[0]; 
                    chartimg.style.setAttribute("width", sender.get_width() + "px"); 
                    chartimg.style.setAttribute("height", sender.get_height() + "px"); 
               } 

    Server-side resize:
    function ResizeChart_ServerSide(sender, args) 
               { 
                    var ajaxManager = $find('<%= RadAjaxManager1.ClientID %>'); 
                    var arg1 = sender.get_width() + "px"
                    var arg2 = sender.get_height() + "px"
                    var arguments = arg1 + "," + arg2; 
                    ajaxManager.AjaxRequest(arguments); 
               } 

    Do not forget to add the chart HTTP handler in web.config.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.