Hi,
I'm trying to put on some custom labels on my chart, and I've been succeeding in parts..
I've gotten the custom label on the items using
Dim cta As Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance
cta = New Infragistics.UltraChart.Resources.Appearance.ChartTextAppearance()cta.ChartTextFont = New Font("Arial", 7)cta.ItemFormatString = "<DATA_VALUE_ITEM:00.00>"cta.FontColor = Color.Whitecta.Visible = Truecta.Row = -2cta.Column = -2cta.PositionFromRadius = 100cta.HorizontalAlign = StringAlignment.Centercta.VerticalAlign = StringAlignment.NearchrtData.ColumnChart.ChartText.Add(cta)
but I want to succeed in adding a total ABOVE the columns.
Any ideas? Thanks in advance for the time spent.
What I got..
What I Want..
The chart doesn't have this built-in, so you will have to add these labels manually. I suggest using FillSceneGraph event for this. For example:private void ultraChart1_FillSceneGraph(object sender, FillSceneGraphEventArgs e){ if (e.Grid.Count <= 0) return;
List<string> labels = new List<string>(); IAdvanceAxis xAxis = (IAdvanceAxis)e.Grid["X"]; IAdvanceAxis yAxis = (IAdvanceAxis)e.Grid["Y"];
IChartData chartData = e.ChartCore.GetCurrentDataRef(); int rowCount = chartData.GetRowCount(); int columnCount = chartData.GetColumnCount();
for (int i=0; i<rowCount; i++) { double value = 0.0;
for (int j = 0; j < columnCount; j++) { value += chartData.GetValue(i, j); }
Point location = new Point((int)xAxis.Map(i + 0.5), (int)yAxis.Map(value)); Text label = new Text();
SizeF labelSize = Platform.GetStringSizePixels(value.ToString(), label.labelStyle.Font); location.X -= (int)labelSize.Width / 2; location.Y -= (int)labelSize.Height;
label.SetTextString(value.ToString()); label.bounds = new Rectangle(location, new Size((int)labelSize.Width, (int)labelSize.Height));
e.SceneGraph.Add(label); }}
after having it converted to vb.NET I succeeded in adding the wanted labels. Thanks for the help.
Hello anandraj,
You can refer to the following forum thread that explains how this can be done - http://community.infragistics.com/forums/t/52899.aspx
I hope that this information will help you to implement your scenario.
Hi
the textLabel overlaps in 3D column chart.
how can i fix this?
unable to fix at coding.
see the below image
Sorry, but adding ChartText items isn't supported for 3d charts. Text primitives can still be added to the chart's SceneGraph using FillSceneGraph method, similar to the post above. The trick, however, will lie in calculating the label's position, since the 3d charts can be rotated/scaled.
i want to add charttext on 3D column chart.
it shows value on mouse over in tool tip, i want to show data on column of 3D chart.
how can i show values in 3D column chart?