Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#ZedGraph
Hello,
I'm using ZedGraph in my project and its awesome! But there is still one thing I cant figure out. Im looking for some possibility of plotting description of LineItem directly in chart, like on fig.:
 
http://www.imagesup.net/?di=113548312290[^]
 
I tried to use TextObj, but still I have a problem correctly calculate the angle, it doesnt correspond to the slope of line:
 
// centre of line
PointPair pt = new PointPair(0.5 * (ptA.X + ptB.X), 0.5 * (ptA.Y + ptB.Y));
 
TextObj text = new TextObj("desc", pt.X, pt.Y, CoordType.AxisXYScale, AlignH.Center, AlignV.Center);
text.ZOrder = ZOrder.A_InFront;
 
double dX = ptB.X - ptA.X;
double dY = ptB.Y - ptA.Y;
 
float alfa = (float)(Math.Atan2(dY, dX) * (180.0 / Math.PI));
 
text.FontSpec.Angle = alfa;
 
graph.GraphPane.GraphObjList.Add(text);
Posted 6-Dec-12 12:46pm

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 448
1 Sergey Alexandrovich Kryukov 425
2 Abhinav S 408
3 sanket saxena 285
4 Tadit Dash 160
0 Sergey Alexandrovich Kryukov 8,482
1 OriginalGriff 4,830
2 Peter Leow 3,794
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid