Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I would like to write the line in the pane that divide graph into two parts. I already knew the method to do this. The coordinates between the start and end of the line are required. I could not find how to get the maximum coordinate (xxxxxx)of Y axis in my graph. Here is my code snippet.
// Add a line to graph 
LineObj line = new LineObj(Color.Black, 2009, 0, 2009, xxxxxx);
line.Location.CoordinateFrame = CoordType.AxisXYScale;
line.Line.Style = System.Drawing.Drawing2D.DashStyle.DashDot;
myPane.GraphObjList.Add(line);

Thank you very much.
Posted
Updated 27-Dec-10 20:33pm
v2
Comments
JF2015 28-Dec-10 2:33am    
Added code formatting.
wizardzz 28-Dec-10 11:32am    
How are you populating the graph? Could you possibly get the maximum value when you retrieve, parse, or bind the data?
Wipoosit Udomsrisuk 29-Dec-10 1:40am    
Hi wizardzz,

I used the following code to populate the graph. First create PointPairList of (x,y) value by adding Array of double of x and y (GraphDataXJapan[] and GraphDataYJapan[]) into it.
After that, create the curve using that PointPairList. I do not know how to get the maximum Y coordinate of Y-axis.

PointPairList listJapan = new PointPairList();
listJapan.Add(GraphDataXJapan, GraphDataYJapan);
LineItem curveJapan = myPane.AddCurve("Japan", listJapan, Color.Blue,
SymbolType.Circle);

I am not sure I answered your question because I am quite new with Zed Graph library.

1 solution

use (with name of your GraphPane):

.Rect.Size.Height (or Width ... I never know what is X or Y ...)
 
Share this answer
 
Comments
Wipoosit Udomsrisuk 2-Jan-11 23:00pm    
Hi Thomas,

Thanks for your reply. I tried it but it gets the height of the graph pane which is in pixels. What I need is the graph coordinate.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900