eridgway Posted March 6, 2008 Report Posted March 6, 2008 Hi, Having a few problems with the point labels on my bar chart. The point labels are not staying within the boundaries of the bar chart, causing them to overwrite the x-axis label for lowest negative value, and writing over the chart border on the higher positive values. I can solve the "higher positive values" problem by switching the AxesStyle to Math (removing the top border), but I have not come up with a way to keep the "lowest negative value" from overwriting the Axis label. Suggestions?
eridgway Posted March 10, 2008 Author Report Posted March 10, 2008 Sorry, think I found my answer (get latest build) http://support.softwarefx.com/ShowArticle.aspx?Type=KB&Product=CfxNet62&Source=http://support.softwarefx.com/kb/710/2/059.htm
eridgway Posted March 10, 2008 Author Report Posted March 10, 2008 Hmm, updated but still seem to be having the problem. 6.2.1342.0 Is this not the latest version
Frank Posted March 11, 2008 Report Posted March 11, 2008 It does not look like the problem described in this article is what you are experiencing. Labels may go in the X-Axis area if there is nowhere else for them to go, Chart FX will not try to align them differently if they are close to the X-Axis. A possible solution is to decrease the Min value so that there is room for the labels within the plot area.
eridgway Posted March 14, 2008 Author Report Posted March 14, 2008 Hmm, ok. As another option, is there a way to force the labels to stay at the top of the bar, regardless if the value is negative? So on neg values, it would sit just on top of the 0-line.
Frank Posted March 17, 2008 Report Posted March 17, 2008 The point label's vertical alignment will always be inverted for negative values. What you can do is to create a conditional attribute that inverts the alignment of negative values: ConditionalAttributes ca = new ConditionalAttributes(); ca.PointLabels.LineAlignment = StringAlignment.Near;ca.Condition.From = double.NegativeInfinity; ca.Condition.To = 0; chart.ConditionalAttributes.Add(ca);
eridgway Posted April 2, 2008 Author Report Posted April 2, 2008 Hmm, couldn't get that solution to work (pointlabels is a boolean property), but here's the general fix I came up with in case anyone else runs into this issue. double dSpace = 0.125; //percentage of your chart that the point labels should take up, in this case I'm going with 1/8 of the chart double dBarMin = chtBar.AxisY.Min; double dBarMax = chtBar.AxisY.Max; double dBarTotal = dBarMax + (-1* dBarMin); //total Y size double dBottomPad = (dBarTotal * dSpace); //how much extra y-value to tag onto the lower end chtBar.AxisY.Min = chtBar.AxisY.Min - dBottomPad; Hit Test Problems.zip
Frank Posted April 3, 2008 Report Posted April 3, 2008 Sorry, I posted Chart FX 7 code, however the Chart FX 6.2 API is very similar, instead of PointLabels.VerticalAlignment you can use PointLabelAlign.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.