Dates Range on the bottom axis - properties

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Re: Dates Range on the bottom axis - properties

Post by qcrnd » Tue May 11, 2010 8:12 am

Hi ,

See the attachment - In my chart I have 3 area series and on the lest I have the values of the series.
I want to show only the dates that have value in the series.
chart.JPG
chart.JPG (38.14 KiB) Viewed 7579 times
Thanks

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Dates Range on the bottom axis - properties

Post by Sandra » Tue May 11, 2010 9:39 am

Hello qcrnd,


Please, you could say us if you checked my previous code and what problem are you have found in it?


On the other hand, I have made other example that works fine here. Please, check next code if works as you want.

Code: Select all

    public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            Steema.TeeChart.Styles.Area area = new Steema.TeeChart.Styles.Area(tChart1.Chart);
            Steema.TeeChart.Styles.Area area1 = new Steema.TeeChart.Styles.Area(tChart1.Chart);
            Steema.TeeChart.Styles.Area area2 = new Steema.TeeChart.Styles.Area(tChart1.Chart);

            area.XValues.DateTime = true;
            area1.XValues.DateTime = true;
            area2.XValues.DateTime = true;

            area.Pointer.Visible = true;
            area1.Pointer.Visible = true;
            area2.Pointer.Visible = true;
            area.AreaLines.Visible = false;
            area1.AreaLines.Visible = false;
            area2.AreaLines.Visible = false;
            area.Pointer.Pen.Color = area.LinePen.Color;
            area1.Pointer.Pen.Color = area1.LinePen.Color;
            area2.Pointer.Pen.Color = area2.LinePen.Color;
            area.Pointer.InflateMargins = false;

            Random rnd = new Random();

            for (int i = 0; i < 3; ++i)
            {
                if (i == 0)
                {
                    area.Add(DateTime.Now.AddDays(i), 80, DateTime.Now.AddDays(i).ToShortDateString());
                    area1.Add(DateTime.Now.AddDays(i), 80, DateTime.Now.AddDays(i).ToShortDateString());
                    area2.Add(DateTime.Now.AddDays(i), 80, DateTime.Now.AddDays(i).ToShortDateString());

                }
                else if (i == 1)
                {
                    area.Add(DateTime.Now.AddDays(i), 40, DateTime.Now.AddDays(i).ToShortDateString());
                    area1.Add(DateTime.Now.AddDays(i), 40, DateTime.Now.AddDays(i).ToShortDateString());
                    area2.Add(DateTime.Now.AddDays(i), 40, DateTime.Now.AddDays(i).ToShortDateString());
                }
                else if (i == 2)
                {
                    area.Add(DateTime.Now.AddDays(i + 10), 80, DateTime.Now.AddDays(i + 10).ToShortDateString());
                    area1.Add(DateTime.Now.AddDays(i + 10), 80, DateTime.Now.AddDays(i + 10).ToShortDateString());
                    area2.Add(DateTime.Now.AddDays(i + 10), 80, DateTime.Now.AddDays(i + 10).ToShortDateString());

                }
            }

            tChart1.Panel.MarginBottom = 20;
            tChart1.Axes.Bottom.Labels.Angle = 90;
            area.MultiArea = Steema.TeeChart.Styles.MultiAreas.Stacked;
        }
Also, I have attached an image, because you could see our results that we have obtained with previous code:
Chart1.JPG
Chart1.JPG (38.46 KiB) Viewed 7563 times
If you don't get same results, with our code or it doesn't works as you want, please modify code or explain exactly what we must do to reproduce your problem.


Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Re: Dates Range on the bottom axis - properties

Post by qcrnd » Wed May 12, 2010 11:00 am

Hi

Your example is good and work exactly as I want.

But in my solution on my chart I got all the days between.
Do yo know what property can cause this behavior?

Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Dates Range on the bottom axis - properties

Post by Narcís » Wed May 12, 2010 11:33 am

Hi qcrnd,

Have you tried adding axis labels directly when populating the series as Sandra did?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

qcrnd
Advanced
Posts: 214
Joined: Mon Sep 04, 2006 12:00 am

Re: Dates Range on the bottom axis - properties

Post by qcrnd » Wed May 12, 2010 1:13 pm

Hi
You are right - I missed this part .
Now it works OK:)

Thanks

Post Reply