Hello,
I'm trying to increase the distance between the Y Axis and the axis label in a bar chart.
I tried setting the Axis.Y.Margin.Far and the Axis.Y.Labels.Layout.Padding properties with no success...
Can you help me with this?
Thank you in advance
Hi,
One possible approach could be if you are using FillSceneGraph event. For example:
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { TextList.Clear(); foreach (Primitive pr in e.SceneGraph) { if (pr.GetType() == typeof(Text) && pr.Row != -1 && pr.Column != -1) { ((Text)pr).Visible = false; Text textLable = new Text(new Point(((Text)pr).bounds.X +100, ((Text)pr).bounds.Y + 5), "My custom text + " + ((Text)pr).GetTextString()); TextList.Add(textLable); } } foreach (var item in TextList.Distinct()) e.SceneGraph.Add(item); }
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
TextList.Clear();
foreach (Primitive pr in e.SceneGraph)
if (pr.GetType() == typeof(Text) && pr.Row != -1 && pr.Column != -1)
((Text)pr).Visible = false;
Text textLable = new Text(new Point(((Text)pr).bounds.X +100, ((Text)pr).bounds.Y + 5), "My custom text + " + ((Text)pr).GetTextString());
TextList.Add(textLable);
}
foreach (var item in TextList.Distinct())
e.SceneGraph.Add(item);
Please take a look at the attached video and sample for more details and let me know if you have any questions.
Regards
Thank you for your answer.
I think I didn't make myself quite clear.
What I'm trying to do is increase the distance between the Y value labels (the ctr.Axis.Y.Labels object) and the axis line.
Thank you in advance.
Could you please try to use the propertyies below:
ultraChart1.Axis.Y.Labels.Orientation =TextOrientation.Custom;
ultraChart1.Axis.Y.Labels.OrientationAngle = 45;
ultraChart1.Axis.Y.Labels.HorizontalAlign =StringAlignment.Far;
ultraChart1.Axis.Y.Labels.VerticalAlign =StringAlignment.Far;
If you think that distance between labels and axis is not enough , then you could use my suggestion from previous post where I`m using FillSceneGraph event and Offset method
Let me know if you have any questions.