bug on legend position Top with a long legend title
Posted: Thu Feb 17, 2011 11:06 pm
Hi,
Bug 1)
I don't have a problem with a legend whose position is either Left or Right. When I change the legend position to either Top or Bottom with a long legend title, the width of the legend bounds isn't correctly rendered. In other words, the long legend title can't fit into the legend whose position is either Top or Bottom. The following is a sample code of what i am talking about. Is there a way to make the legend width suitable with the legend title when the position is Top or Bottom, just like when the position is either Right or Left?
Bug 2)
I noticed that the icon for the legend item gets smaller when the position is Top/Bottom when compared to the position of Left/Right? Is there a way to have a same size of the icon for the legend item when its position is either Top or Bottom? You will see the different size of the icon within the legend when you change the position from Left/Right to Top/Bottom.
Bug 1)
I don't have a problem with a legend whose position is either Left or Right. When I change the legend position to either Top or Bottom with a long legend title, the width of the legend bounds isn't correctly rendered. In other words, the long legend title can't fit into the legend whose position is either Top or Bottom. The following is a sample code of what i am talking about. Is there a way to make the legend width suitable with the legend title when the position is Top or Bottom, just like when the position is either Right or Left?
Bug 2)
I noticed that the icon for the legend item gets smaller when the position is Top/Bottom when compared to the position of Left/Right? Is there a way to have a same size of the icon for the legend item when its position is either Top or Bottom? You will see the different size of the icon within the legend when you change the position from Left/Right to Top/Bottom.
Code: Select all
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
panel.setSize(600, 600);
TChart chart = new TChart();
panel.add(chart);
Bar b = new Bar(chart.getChart());
b.add(0, 10, Color.BLACK);
b.add(1, 20, Color.BLACK);
b.add(2, 30, Color.BLACK);
b.setTitle("first series");
Bar b1 = new Bar(chart.getChart());
b1.add(0, 10, Color.RED);
b1.add(1, 10, Color.RED);
b1.add(2, 10, Color.RED);
b1.setMultiBar(MultiBars.STACKED);
b1.setTitle("second series");
String title = "here is a quite long legend title to see if this can fit into legend top";
chart.getLegend().getTitle().setText(title);
chart.getLegend().setAlignment(LegendAlignment.TOP);
// chart.getLegend().setAlignment(LegendAlignment.BOTTOM);
frame.add(panel);
frame.setSize(600, 600);
frame.setVisible(true);
}