Jump to content
Software FX Community

Can Y-axis labels be replaced with text or images?

Recommended Posts

Hello, I am using Chart FX 6.5. Can the Y-axis labels be replaced with either text or images for a line chart? Right now, the Y-axis labels show integer values, but I need to put the equivalent strings or images for those integer values. Is this possible using version 6.5? If yes, could you tell which API I need to use. Thank you.

Link to post
Share on other sites
  • 1 month later...


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

It is indeed possible to replace Y-axis labels with text. However, there's a trick to using custom labels on a numerical axis that is best described using a real case scenario. For example, assume there is a numerical axis ranging from 0 to 100 with a step of 20.

You'll end up with a chart with 6 tick marks on the axis (0, 20, 40, 60, 80 and 100). If this chart is to be used to display "customer satisfaction" ratings where:

0 = Very poor

20 = Poor

40 = Average

60 = Good

80 = Very Good

100 = Excellent

The numerical axis will then display numbers that have no meaning to the user in this context. The following code will let you replace numbers with labels:


Axis axis = chart1.getAxisY();

axis.getLabel().setItem(0, "Very Poor");

axis.getLabel().setItem(1, "Poor");

axis.getLabel().setItem(2, "Average");

axis.getLabel().setItem(3, "Good");

axis.getLabel().setItem(4, "Very Good");

axis.getLabel().setItem(5, "Excellent");


However, please note that in a numerical axis the index specified in the Label property does not truly identify where the label should be placed. The LabelValue property allows you to specify where those labels should be placed in a numerical axis, so if you specify a LabelValue of 20 as follows:


chart1.getAxisY().setLabelValue((short) 20);


Each label will be placed exactly where you intended it to be on the numerical axis as depicted in the following figure:

Posted Image

As for images, I am afraid that Y-axis labels cannot be replaced with images. However, as a workaround you can achieve a similar effect by creating annotations and placing them at specific points in the chart.


Link to post
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...