Page 1 of 1

DateTime axis and bar graph

Posted: Mon Oct 06, 2008 10:19 pm
by 14045174
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.

Posted: Tue Oct 07, 2008 3:56 pm
by narcis
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.

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());
      }
    }

Posted: Tue Oct 07, 2008 4:04 pm
by 14045174
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.

Posted: Tue Oct 07, 2008 4:13 pm
by narcis
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.