Is it possible to make chart axis like on image?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
petro
Newbie
Newbie
Posts: 8
Joined: Thu Aug 07, 2008 12:00 am
Contact:

Is it possible to make chart axis like on image?

Post by petro » Mon Jun 08, 2009 10:39 am

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.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Jun 08, 2009 11:44 am

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;
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

petro
Newbie
Newbie
Posts: 8
Joined: Thu Aug 07, 2008 12:00 am
Contact:

Post by petro » Mon Jun 08, 2009 1:59 pm

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.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Jun 08, 2009 2:38 pm

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; 
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply