Jump to content
Software FX Community

PointLabels not within boundary of bar chart


eridgway

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);

 

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...