ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Resizing Charts
Posted by Richard White on Oct-18-2006 04:16
Hi, i was just wondering how east it is to resize the charts, maybe set themto a % of the window. can anyone show me an example or discuss how this can be done (or the best practise for doing this)

thanks very much

  Re: Resizing Charts
Posted by Peter Kwan on Oct-18-2006 05:49
Hi Richard,

The "chart resizing" that most people expect means completely redrawing the chart. For example, if you have use the Windows Performance Monitor, when you resize the chart, the entire chart is complete redrawn and look differently.

It is because a chart usually contains small text (like text at 8 points in size). Even if your resize it a little bit (like to 75% in size), the text will become 6 points - too small to be visible. If you resize it bigger (like to 200%), the text will become 16 points - bigger than most people expect.

So resizing really means something (like the plot area) is resizing, while something else (like the text) is not resized. If the chart is larger, people may expect the grid lines look finer (instead of 1 axis label per 100 units, may be the axis becomes 1 label per 50 units, etc.).

So in your charting code, you need to determine which part of the chart is parameterized based on the screen size. For example, instead of hard coding the chart sizes and plot area sizes, you may set it to a percentage of the screen size, while the font sizes may be constant.

Basically, when your web page knows the screen size, it can pass it to the server (as a query parameter), so it can create the chart accordingly.

Regards
Peter Kwan

  Re: Resizing Charts
Posted by Richard White on Oct-18-2006 06:47
thanks Peter, this sounds very logical. Just a quick question though, I have tried to set the plot area to a percentage value but it is outputting an error - saying % is not valid

Do you have a simple example that i can try with the plot area

thanks Peter

  Re: Resizing Charts
Posted by Peter Kwan on Oct-18-2006 07:15
Hi Richard,

I mean you need to use something like:

c = createObject("java", "ChartDirector.XYChart");

//set chart width and height to 80% of screen with and height
c.init(fix(screenWidth * 0.8), fix(screenHeight * 0.8));

........


Of course, you need to know the screenWidth and screenHeight in the first place, which is not automatically available on the server side. Possibly when sending the HTTP request to the server, the URL needs to be designed to include these information as query parameters, so the server can know the screen size. (You need to be familiar with browser side Javascript to extract these information from the browser.)

Regards
Peter Kwan

  Re: Resizing Charts
Posted by Richard White on Oct-18-2006 09:14
oh i see, thanks peter, yes i am sort of moderate at javascript (still learning web applications but getting there) but thanks again ill work on it

regards

richard

  Re: Resizing Charts
Posted by Rene on Sep-13-2016 06:49
Dim root As String = System.Web.Hosting.HostingEnvironment.MapPath("~")
WebChartViewer1.Visible = False
c.makeChart(root + "A_Documentsgraphsomething.jpg")
<asp:Image ID="Image1" runat="server" ImageUrl="~/A_Documents/graph/something.jpg" Width="100%" />

this works perfectly for me

René