monofilm Posted May 26, 2009 Report Share Posted May 26, 2009 As you can see at the image below X-Axis labels occupy more than 50% of image space. I'm wondering is it possible to limit X-Axis labels height by 50 pixels for example? Source: DataTable table = new DataTable(); table.Columns.Add("x", typeof(int)); table.Columns.Add("y", typeof(string)); DataRow row = table.NewRow(); row["x"] = 0; row["y"] = "verylongstringverylongstringverylongstring"; table.Rows.Add(row); row = table.NewRow(); row["x"] = 1; row["y"] = "verylongstringverylongstringverylongstring"; table.Rows.Add(row); row = table.NewRow(); row["x"] = 4; row["y"] = "verylongstringverylongstringverylongstring"; table.Rows.Add(row); Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("x", ChartFX.WebForms.FieldUsage.Value)); Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("y", ChartFX.WebForms.FieldUsage.Label)); Chart1.DataSource = table; Chart1.DataBind(); Chart1.PlotAreaMargin.Bottom = 20; Chart1.PlotAreaMargin.Left = 20; Chart1.PlotAreaMargin.Right = 20; Chart1.PlotAreaMargin.Top = 20; Quote Link to comment Share on other sites More sharing options...
TatianaG Posted May 26, 2009 Report Share Posted May 26, 2009 Unfortunately, Chart FX API does not provide a property to customize Label text area height. You should reduce the text you are currently sending to axis labels. As a workaround, you can change label angle (chart1.AxisX.LabelAngle = 45;). I hope this helps. Quote Link to comment Share on other sites More sharing options...
AndreG Posted May 27, 2009 Report Share Posted May 27, 2009 I might have found something that could help you. There is a property in the Axis class called MaxSizePercentage. It will limit the space taken by the axis as a percentage, but in a brute way. It will clip the begining of the string. To avoid that you could force the clipping of the end of the string using LabelTrimming. Chart1.AxisX.MaxSizePercentage = 30;Chart1.AxisX.LabelTrimming = System.Drawing.StringTrimming.EllipsisWord; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.