Hi,
Is there a way to show indices on the Top Axis and DateTime value on the bottomAxis of the same series?
I am using fastline series styles in TeeChart.NET V3. And I have added the points with the corresponding DateTime value. So I have managed to show DateTime on the bottom axis. Now I am not sure how to go about displaying the indices on the TopAxis. By indices, I mean the integer index of all the values, like the way it would have shown had I not supplied the DateTime value.
Regards,
Gaurav
Indices and DateTime together
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Gaurav,
In that case you need to do something like the code snippet below. You need to use GetAxisLabel event and set top axis label style to text so that ValueIndex event's argument has a valid value.
Hope this helps!
In that case you need to do something like the code snippet below. You need to use GetAxisLabel event and set top axis label style to text so that ValueIndex event's argument has a valid value.
Code: Select all
public Form1()
{
InitializeComponent();
Steema.TeeChart.Styles.FastLine fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
fastLine1.XValues.DateTime = true;
fastLine1.HorizAxis = Steema.TeeChart.Styles.HorizontalAxis.Both;
fastLine1.FillSampleValues();
tChart1.Axes.Top.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);
}
void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
{
if (sender == tChart1.Axes.Top)
{
e.LabelText = e.ValueIndex.ToString();
}
}
Best Regards,
Narcís Calvet / 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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Aptitude,
In that case you can try using custom labels for the top axis as shown below. However, this may only work if bottom axis labels are placed exactly in a data point.
In that case you can try using custom labels for the top axis as shown below. However, this may only work if bottom axis labels are placed exactly in a data point.
Code: Select all
public Form1()
{
InitializeComponent();
tChart1.Aspect.View3D = false;
Steema.TeeChart.Styles.FastLine fastLine1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
fastLine1.XValues.DateTime = true;
fastLine1.HorizAxis = Steema.TeeChart.Styles.HorizontalAxis.Both;
fastLine1.FillSampleValues();
tChart1.Axes.Top.Labels.Items.Clear();
tChart1.GetNextAxisLabel += new Steema.TeeChart.GetNextAxisLabelEventHandler(tChart1_GetNextAxisLabel);
Bitmap bmp = tChart1.Bitmap;
}
void tChart1_GetNextAxisLabel(object sender, Steema.TeeChart.GetNextAxisLabelEventArgs e)
{
if (sender == tChart1.Axes.Bottom)
{
tChart1.Axes.Top.Labels.Items.Add(e.LabelIndex);
}
}
Best Regards,
Narcís Calvet / 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 |