DateTime axis and bar graph
DateTime axis and bar graph
I have a bar graph which is showing yearly values for April in several years. My bottom axis is set as DateTime axis with yearly increment, but as labels it will show either December or January of the selected years. Why? I need labels showing the true dates I've selected.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
You should be able to do what you request using code below. However, we found a bug in this code which only draws a label for the first point on the series. The bug has been added to the defect list (TF02013438) to be fixed for next releases. In the meantime you'll have to use custom labels commenting out the lines about tChart1.Axes.Bottom.Labels.Items in the code snippet.
You should be able to do what you request using code below. However, we found a bug in this code which only draws a label for the first point on the series. The bug has been added to the defect list (TF02013438) to be fixed for next releases. In the meantime you'll have to use custom labels commenting out the lines about tChart1.Axes.Bottom.Labels.Items in the code snippet.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
//tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneYear);
tChart1.Axes.Bottom.Labels.Angle = 90;
//tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
tChart1.Legend.Visible = false;
Steema.TeeChart.Styles.Points points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
points1.XValues.DateTime = true;
DateTime dt = DateTime.Parse("01/04/2008");
Random y = new Random();
//tChart1.Axes.Bottom.Labels.Items.Clear();
for (int i = 0; i < 10; i++)
{
dt = dt.AddYears(1);
points1.Add(dt, y.Next(), dt.ToShortDateString());
//tChart1.Axes.Bottom.Labels.Items.Add(dt.ToOADate(), dt.ToShortDateString());
}
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Thanks for your suggestion, but it will not work for us. We do not need a work around a problem, we need your app working correctly. The thing is, our user is the one, who is selecting the dates to display and the increment, in which the axis should display the labels. Whatever they are selecting, they expect to work. So we are stuck with your standard selections and they'd better work.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Profitstar,
In that case you'll have to wait for TF02013438 being fixed. New maintenance release announcements and what's being fixed on them are announced on this forum and at our RSS news feed.
In that case you'll have to wait for TF02013438 being fixed. New maintenance release announcements and what's being fixed on them are announced on this forum and at our RSS news feed.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |