Page 1 of 1
Bottom datatime axis increament set to One Month problems
Posted: Wed May 21, 2008 8:52 am
by 9637403
If you create a bar chart using some monthly data with a date along the xaxis and set the Increment to One Month you end up with a date (the month) against each bar are desired. However, if you then change the label angle to 90 teh asix goes to half month showing dates at the bars and the 15th of each month also.
Version 3.5.3061.15671
Posted: Wed May 21, 2008 11:54 am
by narcis
Hi Adrian,
I'm not able to reproduce the issue here using code below. Would you be so king to modify it or send us a simple example project we can run "as-is" to reproduce the issue here?
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
Random y = new Random();
for (int i = 1; i <= 6; i++)
{
bar1.Add(DateTime.Parse("01/" + i.ToString() + "/2008"), y.Next());
}
tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneMonth);
tChart1.Axes.Bottom.Labels.DateTimeFormat = "MMMM";
tChart1.Axes.Bottom.Labels.Angle = 90;
}
You can either post your files at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
Thanks in advance.
Posted: Wed May 21, 2008 1:10 pm
by 13047134
I will but I'm a bit pushed for time at the moment. You might like to try setting all the axis options using the editor, this is where the problem appears for me. So create a simple chart with several bars where the xvalyes are dates 01/Jan/2000, 01/Feb/2000 etc. then change the axis using the editor according to the above.
Posted: Wed May 21, 2008 1:27 pm
by narcis
Hi Adrian,
Thanks for the information.
In that case it's most likely because you haven't set bottom axis Increment to be one month. I could reproduce the issue here using code below. Commenting out the Increment line works fine. At designtime you can set increment to 30, it's equivalent to DateTimeSteps.OneMonth.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
Random y = new Random();
for (int i = 1; i <= 6; i++)
{
bar1.Add(DateTime.Parse("01/" + i.ToString() + "/2008"), y.Next());
}
//tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneMonth);
tChart1.Axes.Bottom.Labels.DateTimeFormat = "MMMM";
tChart1.Axes.Bottom.Labels.Angle = 90;
}
Hope this helps!
Posted: Wed May 21, 2008 9:36 pm
by 13047134
Hi Narcis,
In my application the charts are created at run time by the users. they specify what data source is to be used and which columns from the datasource are to be used for the x and Y columns. once this basic information is provided an initial chart is created. They then use the chart editor to specify formatting etc. It's this bit that is not working for One Month increments, I can't programatically set the One Month increment because I don't know what they want, it needs to be set via the chart editor by the user at run time but this is not working. I was working in previous releases... You have broken something in this latest release... If you set the Increment to TWO MONTHS it works... I'm thinking you have got an offset wrong somewhere.
Posted: Wed May 21, 2008 9:38 pm
by 13047134
I've also just noticed that charts saved into a ten file with a previous version where the X axis s One Month and showing the values correctly when loaded into this version still show the values correctly but the increment value is now TWO MONTHS
Posted: Thu May 22, 2008 8:45 am
by narcis
Hi Adrian,
Thanks for the information. I could reproduce the problem here running the code snippet in my last post and then try to set bottom axis Increment to OneMonth at runtime using the chart editor. I've added the defect (TF02013063) to the bug list to be fixed for next releases. I have also been able to reproduce the issue here using 4th April release (Build 3.2.3016.15520/1/2). With which version did you get that working?
Thanks in advance.