Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. chart1.ChartAreas["area1"].AxisX.LabelStyle.Format = "000.000\%";
  2.  
  3. chart1.ChartAreas[0].AxisY.LabelStyle.Format = "###,##0.00000";
  4.  
  5. // propare a few short names
  6. ChartArea CA = chart1.ChartAreas[0];
  7. Series S1 = chart1.Series[0];
  8.  
  9. // this would be option one:
  10. S1.IsValueShownAsLabel = true;
  11.  
  12. // we clear any previous CustomLabels
  13. CA.AxisY.CustomLabels.Clear();
  14. // we create a version of our points collection which sorted by Y-Values:
  15. List<DataPoint> ptS = S1.Points.OrderBy(x => x.YValues[0]).ToList();
  16.  
  17. // now, for option three we add the custom labels:
  18. for (int p = 0; p < ptS.Count; p++)
  19. {
  20. CustomLabel L = new CustomLabel(ptS[p].YValues[0] - 0.5,
  21. ptS[p].YValues[0] + 0.5,
  22. ptS[p].YValues[0].ToString("##0.0000"),
  23. 0, LabelMarkStyle.None);
  24. CA.AxisY.CustomLabels.Add(L);
  25.  
  26. // this is option two: tooltips for each point
  27. ptS[p].ToolTip = ptS[p].YValues[0].ToString("##0.0000");
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement