Is it possible to have always visible in the x-axis the initial and final date?
By example in the attached screenshot we can see fist visible date in the axis is "01/01/2009 16:00" but, the chart starts but I would like to see in the x- axis "01/01/2009 13:00" just in the begininng of the chart. Is it possible?
Thanks
Initial and final date in the x-axis
Initial and final date in the x-axis
- Attachments
-
- initial-finaldate.png (39.35 KiB) Viewed 10189 times
Re: Initial and final date in the x-axis
Hello wakeup,
A solution would be change the labels styles of x-axis as do in next line of code:
Could you tell us if previous code works in your end?
Thanks,
A solution would be change the labels styles of x-axis as do in next line of code:
Code: Select all
tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.PointValue;
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Initial and final date in the x-axis
Now it show the time of the first inserted point, but if I don't have automatic scale in x-axis it doen't show the first value of the axis in the 0/0 coordinate...
Thanks
Thanks
Re: Initial and final date in the x-axis
Hello wakeup,
Other solution allow you achieve as you want is, use custom labels as I do in next lines of code:
Could you tell us if previous code works in your end? On the other hand to know more about DateTimeFormat please, taking a look in this link.
Thanks,
Other solution allow you achieve as you want is, use custom labels as I do in next lines of code:
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
DateTime dt = DateTime.Today;
Random rnd = new Random();
for (int i = 0; i < 20; i++)
{
line1.Add(dt, rnd.Next(1000));
dt = dt.AddDays(1);
dt = dt.AddHours(1);
}
line1.Pointer.Visible = true;
line1.XValues.DateTime = true;
AddCustomLabels();
tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yyyy HH:mm";
tChart1.Axes.Bottom.Labels.MultiLine = true;
tChart1.Axes.Bottom.Labels.Angle = 90;
}
private void AddCustomLabels()
{
tChart1.Axes.Bottom.Labels.Items.Clear();
for (int i = 0; i < tChart1[0].Count; i++)
{
tChart1.Axes.Bottom.Labels.Items.Add(tChart1[0].XValues[i], DateTime.FromOADate(tChart1[0].XValues[i]).ToString("dd/MM/yyyy HH:mm"));
}
}
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Initial and final date in the x-axis
It is not exatly what I want because the first date would be the first point, and I would like to see the minimum of the x-axis scale. I think I could change the code to do it manually, but then I would lose the automatic way of teechart to write dates... and it is very usefull because in the manual way the dates sometimes are one over other...
So it there isn't any automatic way, I think it is better to forget it, it's not a very important requeriment.
Thanks
So it there isn't any automatic way, I think it is better to forget it, it's not a very important requeriment.
Thanks
Re: Initial and final date in the x-axis
Hello wakeup,
I am not sure this suggestion help you, but you can try to change the Minimum and Maximum offset of Bottom axis and use SetMinMax to adjust the axis as you want. You can do something as next:
On the other hand, custom labels are the easiest solution to customize the labels as you want and do as you expect.
Thank,
I am not sure this suggestion help you, but you can try to change the Minimum and Maximum offset of Bottom axis and use SetMinMax to adjust the axis as you want. You can do something as next:
Code: Select all
tChart1.Axes.Bottom.SetMinMax(DateTime.FromOADate(tChart1[0].XValues.Minimum), DateTime.FromOADate(tChart1[0].XValues.Maximum));
tChart1.Axes.Bottom.MinimumOffset = 1;
tChart1.Axes.Bottom.MaximumOffset = 10;
On the other hand, custom labels are the easiest solution to customize the labels as you want and do as you expect.
Thank,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |