I want to get a graph having the X-Axis at the top of the graph rectangle and having the X-Axis texts above the X-Axis. I am nearly finished with the following code
[code]
myPane = MTA_Graph.GraphPane;
// Set the titles and axis labels
myPane.Title.Text = "My Test Date Graph";
myPane.XAxis.Title.Text = "Analysezeitpunkt";
myPane.YAxis.Title.Text = "Meilenstein Termine";
myPane.Chart.Border.IsVisible = false;
PointPairList list = new PointPairList();
for (int i = 0; i < 36; i++)
{
double x = (double)new XDate(2011, 5, i + 11);
double y = (double)new XDate(2011, 5, i + 13);
list.Add(x, y);
}
LineItem myCurve = myPane.AddCurve("Milestone1", list, Color.Red, SymbolType.Diamond);
// Set the XAxis to date type
myPane.XAxis.Type = AxisType.Date;
myPane.XAxis.Scale.Format = "yyyy-MM";
myPane.XAxis.Scale.Min = (double)new XDate(2011, 1, 1);
myPane.XAxis.Scale.Max = (double)new XDate(2012, 1, 1);
myPane.XAxis.Scale.MajorUnit = DateUnit.Month;
myPane.XAxis.Scale.MajorStep = 1.0;
myPane.XAxis.Scale.MinorUnit = DateUnit.Month;
myPane.XAxis.Scale.MinorStep = 0.25;
myPane.XAxis.Scale.FontSpec.Angle = 90;
myPane.XAxis.Scale.IsLabelsInside = true;
myPane.XAxis.Cross = (double)new XDate(2012, 1, 1);
myPane.XAxis.Title.IsTitleAtCross = false;
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.XAxis.MajorTic.IsOpposite = false;
myPane.XAxis.MinorTic.IsOpposite = false;
// Y-Achsen Definition
myPane.YAxis.Type = AxisType.Date;
myPane.YAxis.Scale.Format = "yyyy-MM";
myPane.YAxis.Scale.Min = (double)new XDate(2011, 1, 1);
myPane.YAxis.Scale.Max = (double)new XDate(2012, 1, 1);
myPane.YAxis.Scale.MajorUnit = DateUnit.Month;
myPane.YAxis.Scale.MajorStep = 1.0;
myPane.YAxis.MajorGrid.IsVisible = true;
myPane.YAxis.Scale.MinorUnit = DateUnit.Month;
myPane.YAxis.Scale.MinorStep = 0.25;
myPane.YAxis.MajorTic.IsOpposite = false;
myPane.YAxis.MinorTic.IsOpposite = false;
myPane.Legend.Position = LegendPos.BottomCenter;
// Calculate the Axis Scale Ranges
MTA_Graph.AxisChange();
[/code]
The problem i get with this code is that my X-Axis Value texts are not shown completely and are plotted over the title of the chart. The text need more space outside the control.
See the attached screenshot.
Regards matsb2011
Screenshot wrong rendering