'Change color of item labels on range on Category chart

I want to change the color of labels showing in black, but I am unable to find a solution.

I tried using below code, but it has no effect

CategoryAxis yaxis = plot.getDomainAxis();
yaxis.setLabelPaint(Color.WHITE);

I want to change the font color of range and category.

image



Solution 1:[1]

Given a category chart that has a CategoryItemLabelGenerator, such as the BarChartDemo1 variation cited here.

  • You can change the color used by the renderer for the item labels, illustrated below with white labels on a gray background:

      CategoryItemLabelGenerator generator =
          new StandardCategoryItemLabelGenerator(…);
      renderer.setDefaultItemLabelGenerator(generator);
      renderer.setDefaultItemLabelPaint(Color.WHITE);
      renderer.setDefaultItemLabelsVisible(true);
    
  • You can change the axis label color using setLabelPaint(), as shown here.

  • You can change the axis tick mark color using setTickMarkPaint(), as shown here.

image

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 trashgod