Hi Infragistics Team
I've been working with in infragistics line graph, but need to customize axis labels, to bring them a color.The chart that I have now looks like this:
But what I need is to paint a white box on each label values as shown below:
Is this possible?
thanks
Hi,
You can use the FillSceneGraph event to add a box primitive to be used as the background color for your data point labels. eg. (Line Chart)
void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { Polyline line = null;
foreach (Primitive p in e.SceneGraph) { if (p is Polyline) { line = p as Polyline; break; } }
if (line == null) return;
foreach (DataPoint point in line.points) { Text label = new Text(); string str = point.Value.ToString();
label.SetTextString(str); SizeF labelSize = Platform.GetLabelSizePixels(str, label.labelStyle);
Rectangle bounds = new Rectangle( point.point.X - (int)labelSize.Width / 2, point.point.Y - (int)labelSize.Height, (int)labelSize.Width, (int)labelSize.Height);
label.bounds = bounds;
Box background = new Box(bounds); background.PE.Fill = Color.PaleGoldenrod; background.PE.StrokeWidth = 0; background.PE.ElementType = PaintElementType.SolidFill; e.SceneGraph.Add(background); e.SceneGraph.Add(label);
} }
I'm working on figuring out if primitives/rectangle suppor shadow effects. Let me know if you have any questions regarding this matter.
Hi Michael DiFilippo thanks for your answer.
The code supplied was correct for this problem.