Hi,
I would like to add a label to each bar in multiple bar series. I use custom AxesLabelItems with the same x-value of the bar. If a bar of another series have the same x-value, the label of the previous bar will overlaped.
Example code:
Chart1.Axes.Bottom.Labels.Angle = 90;
Bar bar1 = new Bar(Chart1);
bar1.MultiBar = Multibars.Side;
bar1.Add(1, 0.6);
bar1.Add(2, 0.7);
bar1.Add(3, 0.9);
AxisItemLabel lbl1 = new AxisItemLabel(Chart1);
lbl1.Transparent = true;
lbl1.Value = 1;
lbl1.Text = "Bar 1 - Label 1";
bar1.Labels.Items.Add(lbl1);
Bar bar2 = new Bar(Chart1);
bar2.MultiBar = Multibars.Side;
bar2.Add(1, 0.3);
bar2.Add(2, 0.5);
bar2.Add(3, 0.4);
AxisItemLabel lbl2 = new AxisItemLabel(Chart1);
lbl2.Transparent = true;
lbl2.Value = 1;
lbl2.Text = "Bar2 - Label 2";
bar2.Labels.Items.Add(lbl2);
In this case the label of bar2 series overlapped the label of bar1. How can I place the labels exactly below the bars?
Thanks in advance,
Thomas
Question to labels in bar series
Hi Thomas
We don't understand what are you trying to achieve here.
Our fist suggestion would be that you used default series marks and added marks content in one of the Add method's overrides that allow adding a label for each point. Otherwise, by default, Y values would be displayed in series marks. Even this can be changed using bar1.Marks.Style property. Below there's an example of this.
On the other hand, if you are interested in setting custom axis labels you may be interested in checking the "What's New?\Welcome!\Axes\Labels\Custom labels" example at the features demo. You'll find the demo at TeeChart's program group.
If that's your case and your custom labels overlap, you'll find more information about how to prevent this at this post.
We don't understand what are you trying to achieve here.
Our fist suggestion would be that you used default series marks and added marks content in one of the Add method's overrides that allow adding a label for each point. Otherwise, by default, Y values would be displayed in series marks. Even this can be changed using bar1.Marks.Style property. Below there's an example of this.
Code: Select all
tChart1.Axes.Bottom.Labels.Angle = 90;
Bar bar1 = new Bar(tChart1.Chart);
bar1.MultiBar = MultiBars.Side;
bar1.Add(1, 0.6,"myLabel1"); //Add a value and Label
bar1.Add(2, 0.7,"myLabel2");
bar1.Add(3, 0.9,"myLabel3");
bar1.Marks.Visible = true;
Bar bar2 = new Bar(tChart1.Chart);
bar2.MultiBar = MultiBars.Side;
bar2.Add(1, 0.3,"myLabel4");
bar2.Add(2, 0.5,"myLabel5");
bar2.Add(3, 0.4,"myLabel6");
bar2.Marks.Visible = true;
If that's your case and your custom labels overlap, you'll find more information about how to prevent this at this post.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Thomas,
Please have a look at the message Edu pointed in his first reply. This message contains several ideas on how to deal with custom labels and their positions in the chart. Please notice that this thread has several pages and what are you interested in may be in the last pages.
Thanks in advance.
Please have a look at the message Edu pointed in his first reply. This message contains several ideas on how to deal with custom labels and their positions in the chart. Please notice that this thread has several pages and what are you interested in may be in the last pages.
Thanks in advance.
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 |