Bug on legend width in line chart?
Posted: Wed May 18, 2011 2:44 pm
Hi,
I have a line chart. When user wants to increase the line width, it will also increase the line width(thickness) in the legend. Is there a way to reset the line width=1 by default only in legend such that it looks better?
Here is a run-as sample code. I also attach a result of this code. The first and second ones are when the line width is 50 and 5, respectively.
I have a line chart. When user wants to increase the line width, it will also increase the line width(thickness) in the legend. Is there a way to reset the line width=1 by default only in legend such that it looks better?
Here is a run-as sample code. I also attach a result of this code. The first and second ones are when the line width is 50 and 5, respectively.
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);
Line l = new Line(chart.getChart());
l.add(10, 10);
l.add(20, 20);
l.add(30, 30);
l.getPointer().setStyle(PointerStyle.DIAMOND);
l.getPointer().setVisible(true);
l.setTitle("Line");
l.getLinePen().setWidth(5);
chart.getLegend().getSymbol().setWidthUnits(LegendSymbolSize.PIXELS);
frame.add(panel);
frame.setSize(600, 600);
frame.setVisible(true);
}