Page 1 of 1

Width of the teechart asp.net control

Posted: Sun Jul 10, 2005 4:22 pm
by 9637623
Hi,
I would like to put the webteechart.net V2 component on 100% width of my webform. I readed the help of the teechart's width property that says that you can set a width in percent.
The problem is that when i set 100% in the with propert, the chart takes 100px and not 100%.
Here, you can find some captures:
http://www.oknodata.com/teechart1.jpg
http://www.oknodata.com/teechart2.jpg
http://www.oknodata.com/teechart3.jpg

How can I put my webteechart on 100% width of my client browser.

Thanks...

Posted: Tue Jul 12, 2005 10:36 am
by narcis
Hello,

The TeeChart documentation for this property is misleading. Sorry for that, it will be corrected. Percentage was ruled-out as an option due to the following reasons:

The Chart is created as an image at the server and the size needs to be known at that moment to do so. As percentage dimensions are a client variable any subsequent resizing at the client would cause, if the Chart dimensions were to be set as percentage, a distortion of the image as the aspect ratio varies on resize.

To illustrate the limitation you could try the following code, placing it in inside the <head></head> tag of a test webform:

Code: Select all

<script language="jscript" &
    window.onload=windowload;
    window.onresize=windowResize;

    function windowload()
    {
      var obj=document.getElementById('WebChart1');
      obj.style.posWidth=document.body.clientWidth*0.8;
    }
    
    function windowResize()
    {
      var obj=document.getElementById('WebChart1');
      obj.style.posWidth=document.body.clientWidth*0.8;
    }
</script &
Depending on the Chart type you might find the result satisfactory. Please note that we couldn't assure the validity of mouseclicks for postback if the Charts are dynamic in nature.

* Please bear in mind to change "&" in the script openning and closing tags for greater than symbol.