|
ASP.NET charts and sizing |
Posted by Chris Noakes on Apr-06-2011 18:43 |
|
Hello,
I am using (what appears to be!) version 4.1 of your ASP .NET charting component.
Basically I am looking to do an auto-size of the chart to fit the screen area it is in; this
should also include the legend.
From what I can see, I have to manually give the chart a width and height, along with
giving the legend a X+Y, but ultimately these will be "unknowns" as I want to open a chart
in full-screen and have it display without specifying any numbers (but rather, percentages).
Is there an easy way to do this?
Regards,
Chris. |
Re: ASP.NET charts and sizing |
Posted by Peter Kwan on Apr-07-2011 01:55 |
|
Hi Chris,
Unlikely HTML text which are rendered by the browser, the charts are images rendered on the server side. The server cannot automatically know the size of the screen on the browser side. You would need to run some code on the browser side (such as some Javascript code) to detect the screen size, then send the result to the server. On the server side, your code can then create the chart based on the size as detected by your code.
Once you know the width and height of the screen, the percentage can be easily converted to a number. For example, if you want to create a chart 95% of the screen width, you can create the chart as "95 * width / 100", where width is a variable containing the screen width as detected by your code.
Hope this can help.
Regards
Peter Kwan |
Re: ASP.NET charts and sizing |
Posted by Rene on Sep-13-2016 06:42 |
|
perhaps the work around is:
WebChartViewer1.Visible = False
c.makeChart(root + "something.jpg")
<asp:Image ID="Image1" runat="server" ImageUrl="~/something.jpg" Width="100%" />
Peter Kwan wrote:
Hi Chris,
Unlikely HTML text which are rendered by the browser, the charts are images rendered on the server side. The server cannot automatically know the size of the screen on the browser side. You would need to run some code on the browser side (such as some Javascript code) to detect the screen size, then send the result to the server. On the server side, your code can then create the chart based on the size as detected by your code.
Once you know the width and height of the screen, the percentage can be easily converted to a number. For example, if you want to create a chart 95% of the screen width, you can create the chart as "95 * width / 100", where width is a variable containing the screen width as detected by your code.
Hope this can help.
Regards
Peter Kwan
|
|