Area table, fixed y-axis label width

I am creating an area chart with JFreeChart accumulation.

I want the label width of my y axis to be fixed, and I don't want to shift the chart as the width increases. See the image explaining the problem.

error

I ran into the same issue as the JFreeChart forum . According to the forum, this has been fixed but not yet released. Any body knows how to fix it. We cannot wait for the next release. Does anyone know which hack we can apply?

Hoping for some solution.

+4
source share
3 answers

A possible solution is to override findMaximumTickLabelWidth () for the range of the chart. The maximum width can be hardcoded to a specific value or can be taken as the maximum value of the maximum width and the estimated maximum width.

+2
source

As an alternative, consider CombinedDomainCategoryPlot , illustrated here . A CombinedDomainXYPlot shown here .

+1
source

There is another way to align charts. You can reserve some space on the left, top right or bottom of your chart to display the range axes.

  AxisSpace space = new AxisSpace(); space.setRight(50); //reserved space on the left side of the plot space.setLeft(50); plot.setFixedRangeAxisSpace(space); plot2.setFixedRangeAxisSpace(space); 

I know this is not the best solution for multiple graphs. But you can quickly solve the problem.

+1
source

Source: https://habr.com/ru/post/1443205/


All Articles