Jump to content
Software FX Community

Chart disappears when labels are too long


Recommended Posts


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

Link to comment
Share on other sites

 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.


Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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.

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...