I have searched far and wide, but I can't find the answer to a very simple question. I have a vertical stacked bar chart which bars are way to long - you can't see the entire chart on the screen. I just want to scale down the bars so the chart is visible as a whole. How can I do that? I tried sizing the container, the chart itself (setSize), using the renderer,... nothing worked. XYMultipleSeriesRenderer has a method setScale(float value) but it has no effect no matter the value.
Asked
Active
Viewed 84 times
1 Answers
0
Use the XYMultipleSeriesRenderer.setRange(double[] range)
method to set the range. It takes a double[]
with elements minX
, maxX
, minY
, maxY
which sets the min and max values to show on the x and y axes.

steve hannah
- 4,586
- 11
- 18
-
Tnx. It helped me a bit. Now I would like to shrnik the entire chart. I will be showing two charts at the same time (one below the other). I need them to be visible - no scroll. At the moment the only chart takes up the entire screen. I tried like this: c.setSize(new Dimension(Display.getInstance().getDisplayWidth(),(int) Display.getInstance().getDisplayHeight() / 3)), where c is ChartComponent. Do you have any idea? – MetalHead Apr 11 '17 at 08:51
-
You should generally never use `Component.setSize()` unless you know what you are doing. Size set in this way will just be overridden by the layout manager the next time its container is laid out. You should rely on the layout manager for sizing your components. For changing the "size" of charts, use the `setRange()` method to decide the range to display on axes. – steve hannah Apr 12 '17 at 17:56