Incremented date and custom text in bottom axes label

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Solutions Gallery BV
Newbie
Newbie
Posts: 25
Joined: Thu Dec 27, 2007 12:00 am

Incremented date and custom text in bottom axes label

Post by Solutions Gallery BV » Mon Mar 01, 2010 9:17 am

Hello,
i have you a technical question about chart. if you look example in below.
To add customXValue, i can make like below

Code: Select all

ch1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
DateTime date = DateTime.Parse(xValue);
xValue = date.ToString("dd/MM");
series.Add(date, Convert.ToDouble(yValue), xValue + Environment.NewLine + customXValue);
ch1.Axes.Bottom.Increment = 7; // Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.HalfMonth);
ch1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM";
ch1.Series.Add(series);

But when i want to show date in X axis relativly with 7 days increment. The code,which in above does not work. Increment is not right.

But when i make to TeeChart.AxisLabelStyle.Text to TeeChart.AxisLabelStyle.Value ,Increment works right, but customXValue is not shown in chart.
My question is that. How can i make my dates increment in X axis and also how can i show my customXValue next to increment date.

Thanks,
Aytaç Kargınoğlu

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

Re: Incremented date and custom text in bottom axes label

Post by Yeray » Tue Mar 02, 2010 3:25 pm

Hi Aytaç Kargınoğlu,

The following seems to work fine for me here. Could you please modify it so that we can reproduce the problem here?

Code: Select all

            tChart1.Aspect.View3D = false;
            Steema.TeeChart.Styles.Points series = new Steema.TeeChart.Styles.Points(tChart1.Chart);
            tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;

            Random rnd = new Random();
            for (int i = 0; i < 20; i++)
            {            
                DateTime xValue = DateTime.Parse((i + 1).ToString() + "/01/2010");                
                series.Add(xValue, rnd.Next(), xValue.ToString("dd/MM"));
            }            
            tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneWeek);
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM";
            tChart1.Series.Add(series);
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

Solutions Gallery BV
Newbie
Newbie
Posts: 25
Joined: Thu Dec 27, 2007 12:00 am

Re: Incremented date and custom text in bottom axes label

Post by Solutions Gallery BV » Wed Mar 03, 2010 12:44 pm

Hi Yeray,

Firstly thank you for your responding. But i was not able to work my project. So i send you a file, which is in "http://www.steema.net/upload" and its name is "Test_Chart.rar". Please could you look my project and from where i make false?

from now thank you for interesting
Aytaç Kargınoğlu

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

Re: Incremented date and custom text in bottom axes label

Post by Yeray » Thu Mar 04, 2010 4:17 pm

Hi Aytaç Kargınoğlu,

Excuse me, I've made a mistake in the previous message. Setting the axis labels style to show the labels, the increment doesn't recognize the dates, it only considers the points.
In your application, you add 12 points per day, so setting an increment of 7 you are forcing the points between valueindex 0 and 6 not to be shown, but both them are from the same day.
Changing the increment day for the following I think it works as you expected:

Code: Select all

ch1.Axes.Bottom.Increment = 7 * 12;
Of course this forces you to add always 12 points per day. Another solution would be working with custom labels. Here is a thread where you could find many examples with custom labels.
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