Jump to content
Software FX Community

How to get labels in centre?


anamika

Recommended Posts

I have a 3D Gantt chart. On Y axis labels appear exactly on tick marks. How can I get them in centre i.e. in between two tick marks?

 

I have following code and chart:

 axisY.setMin(minAxisY);

 axisY.setMax(maxAxisY);

 axisY.setStep(stepAxisY);

 

  axisY.setGridlines(true);

  axisY.getGrid().setColor(Color.GREY);

  axisY.setTickMark(TickMark.INSIDE);

  axisY.getLine().setColor(Color.GREY);

  axisY.setTextColor(Color.GREY);

  axisY.setFont(new Font("Arial", Font.PLAIN, 8));

 

  chart.getAxisX().getLine().setColor(Color.GREY));

  chart.getAxisX().setVisible(false);

 

  chart.setBackColor(Color.WHITE);

  chart.setBorder(false);

  chart.setScheme(Scheme.SOLID);

  chart.setGallery(Gallery.GANTT);

  chart.setChart3D(false);

  chart.setRightGap(10);

  chart.setLeftGap(10);

  chart.setTopGap(10);

  chart.setBottomGap(10);

  chart.setBorderObject(new DefaultBorder(BorderType.NONE));

 

Posted Image

 

 

 

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Roughly,

  Set your current major gridlines as minor gridlines with a spacing of n/2 where n is the interval currently being displayed. Make their color and tick mark both the same color as your plotting area background. This will hide them but still render the minor axis labels. Then turn on your minor axes and set them to the color that is currently displayed. No labels are requied on these new minors.

 

Good luck. 

Link to comment
Share on other sites

There is an easier way: 

There is a flag ins the AxisStyle (AxisStyle.Centered) that will do just that. I don't know exactly what the JAVA code will be but it must be something like:

chart.getAxisY().setStyle(chart.getAxisY().getStyle() | AxisStyle.Centered);

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...