james Posted April 1, 2009 Report Posted April 1, 2009 If the X-Axis labels are too long for the control size, then the ChartFX control simply appears blank. Can I tell it to not show the labels if they are too long? I'd rather have no labels than nothing at all. Quote
juanZ Posted April 3, 2009 Report Posted April 3, 2009 In Chart FX 7 for VS2005, you can use chart1.AxisX.LabelTrimming = StringTrimming.EllipsisWord; Ellipsis word will put you label text somethig like this "LongLabel..." with the "..." Hope this Helps. Juan Z. Quote
james Posted April 6, 2009 Author Report Posted April 6, 2009 Hi, Thanks for the reply. I've tried setting the LabelTrimming property but it has no effect - as I shrink the window, the chart gets smaller and smaller, while the labels stay at full size with no trimming. Eventually the chart gets down to nothing and the entire window goes blank. Is there something I need to set to stop the chart from shrinking too much? By the way, the LabelTrimming property is not mentioned anywhere in the installed documentation on my system. (ChartFX 7). Quote
juanZ Posted April 6, 2009 Report Posted April 6, 2009 I Apologize for the last response, there was a property that I did not set. Is the MaxSizePercentage, which tells Axis X the percentage of the text that will be displayed. In the sample below, you can find that there is going to be shown only the 20% of each label. Copy and paste this into you load method. chart1.Data.Series = 1; chart1.Data.Points = 6; Random r = new Random(1); int i; for (i = 0; i < 6; i++) chart1.Data[0, i] = 100 * r.NextDouble(); chart1.AxisX.Labels[0] = "Very Long Label For Chart 1"; chart1.AxisX.Labels[1] = "Very Long Label For Chart 2"; chart1.AxisX.Labels[2] = "Very Long Label For Chart 3"; chart1.AxisX.Labels[3] = "Very Long Label For Chart 4"; chart1.AxisX.Labels[4] = "Very Long Label For Chart 5"; chart1.AxisX.Labels[5] = "Very Long Label For Chart 6"; chart1.AxisX.LabelAngle = 90; chart1.AxisX.LabelTrimming = StringTrimming.EllipsisCharacter; chart1.AxisX.MaxSizePercentage = 20; You are also right about the LabelTrimming property in the resoruce center. I will notify this in order to add eventually this property to Chart FX API Doumentation. Quote
james Posted April 6, 2009 Author Report Posted April 6, 2009 The MaxSizePercentage property does make the clipping work. Just to be clear, does it represent the percentage of text to display, or the percentage of the chart area to be used by the labels? (This is also undocumented, btw) The trimming behaviour works, but I might prefer if the labels would just not be shown at all if trimming were necessary. So, if I set the MaxSizePercentage to 50, then the labels would be shown if they fit into that space, and if they do not fit then they would not be shown and the chart would fill the entire area. Is there a way to do this? Thank you for your help. Quote
juanZ Posted April 6, 2009 Report Posted April 6, 2009 MaxSizePercentagerepresents the percentage of space the label is consuming in the whole chart area. So if it is 40, the chart will ocupate 60% and the axis legends the other 40%. You must handle the way the label is trimmed.the StringTrimming enumerator, has several properties that can help you. But you cant define to show somes trimmed and others not. If the label is largest than the space available it will trim it by the rule (property set). Quote
james Posted April 6, 2009 Author Report Posted April 6, 2009 Ok. Thanks for your help Juan. The MaxSizePercentage property is helpful and I'll use that for now. Quote
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.