Page 1 of 1

Is it possible to make chart axis like on image?

Posted: Mon Jun 08, 2009 10:39 am
by 13049886
Is it possible to implement two types of labels for one chart axis like on image bellow(red rectangle)?

Image

I need two axis labels, one for longer period and second for shorter period.

If image didn't appear:
http://piccy.info/view/c1fbbd7a689b18b5 ... 1cc7e0442/

I use the TeeChart 3.5.

Posted: Mon Jun 08, 2009 11:44 am
by yeray
Hi petro,

The axes weren't thought to be drawn like you want but you could try using top axis to display one labels and bottom axis to display the others:

Code: Select all

        private void InitializeChart()
        {
            chartController1.Chart = tChart1;
            tChart1.Aspect.View3D = false;

            Error error1 = new Error(tChart1.Chart);
            Random rnd = new Random();

            error1.XValues.DateTime = true;
            for (int i = 0; i < 50; i++)
            {
                error1.Add(DateTime.Now.AddDays(i).ToOADate(), rnd.Next(10)+ 25, rnd.Next(5)+20); 
            }

            error1.HorizAxis = HorizontalAxis.Both;

            tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd";
            tChart1.Axes.Bottom.Ticks.Length = 5;
            tChart1.Axes.Bottom.TickOnLabelsOnly = true;
            tChart1.Axes.Bottom.MinorTicks.Visible = false;


            tChart1.Axes.Top.Labels.DateTimeFormat = "MMMM";
            tChart1.Axes.Top.Ticks.Length = 30;
            tChart1.Axes.Top.OtherSide = false;
            tChart1.Axes.Top.TickOnLabelsOnly = true;
            tChart1.Axes.Top.MinorTicks.Visible = false;
        }

Posted: Mon Jun 08, 2009 1:59 pm
by 13049886
9348257 wrote:Hi petro,

The axes weren't thought to be drawn like you want but you could try using top axis to display one labels and bottom axis to display the others:
Thank's for solution.
I'll experiment with CustomAxis, so I think I can get appropriate result.

Posted: Mon Jun 08, 2009 2:38 pm
by yeray
petro wrote:I'll experiment with CustomAxis, so I think I can get appropriate result.
Here note that you won't be able to assign more than one axis as horizontal axis for the same series. Only with the default top and bottom axis it is possible with:

Code: Select all

error1.HorizAxis = HorizontalAxis.Both;