Hi,
I have a small sample application in which I create a Horizontal Bar Series.
I use the following code to create it:
horizBar1.Clear();
horizBar1.Add(50);
horizBar1.Add(80);
horizBar1.Add(70);
horizBar1.Add(60);
I want to add labels to the bars like this:
horizBar1.Labels.Clear();
horizBar1.Labels.Add("fifty");
horizBar1.Labels.Add("eighty");
horizBar1.Labels.Add("seventy");
horizBar1.Labels.Add("sixty");
but the labels do not correspond with the bar values: bar with value '50' should correspond with label "fifty".
The result of the above code is:
What is the relation of the labels and the bars?
I know you can add the label when you add the data point (horizBar1.Add() method), but at the point where I create the bars, the labels are not known yet and need to be added afterwards.
Thanks for your help.
Adding labels to series (Horizontal Bar)
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Adding labels to series (Horizontal Bar)
Hello,
Using the latest public release, the following code:
Gives me the following:
Does this code give you different results? Which version of TeeChart.dll are you using?
Using the latest public release, the following code:
Code: Select all
HorizBar horizBar1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
horizBar1 = new HorizBar(tChart1.Chart);
horizBar1.Clear();
horizBar1.Add(50);
horizBar1.Add(80);
horizBar1.Add(70);
horizBar1.Add(60);
horizBar1.Labels.Clear();
horizBar1.Labels.Add("fifty");
horizBar1.Labels.Add("eighty");
horizBar1.Labels.Add("seventy");
horizBar1.Labels.Add("sixty");
}
Does this code give you different results? Which version of TeeChart.dll are you using?
Best Regards,
Christopher Ireland / 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: Adding labels to series (Horizontal Bar)
Hi Christopher,
I am using the latest version 4.1.2015.5142.
I found my mistake: for some reason, I accidentaly modified the XValues.Order in the TeeChart Editor. It should be set to 'None' before adding values and labels.
Thanks for your help to figure this out.
I am using the latest version 4.1.2015.5142.
I found my mistake: for some reason, I accidentaly modified the XValues.Order in the TeeChart Editor. It should be set to 'None' before adding values and labels.
Thanks for your help to figure this out.