Bug on legend width in line chart?

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Jonathan
Newbie
Newbie
Posts: 60
Joined: Tue Mar 11, 2008 12:00 am
Location: Austin

Bug on legend width in line chart?

Post by Jonathan » 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.

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);
	}
Attachments
increased line width in line ligend when line width is 50.png
increased line width in line ligend when line width is 50.png (45.81 KiB) Viewed 8421 times
increased line width in line ligend.png
increased line width in line ligend.png (45.67 KiB) Viewed 8412 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Bug on legend width in line chart?

Post by Yeray » Fri May 20, 2011 12:12 pm

Hello Jonathan,

Yes, you can modify the legend symbols pen as in the example at "All features\Welcome!\Miscellaneous\Legend\Symbols Border" in the feature demo program included with the installation folder \Examples\Swing\Features\TeeChart.Features.jar.
Here it is the code snipped:

Code: Select all

        tChart1.getLegend().getSymbol().setDefaultPen(false);
        tChart1.getLegend().getSymbol().getPen().setWidth(1);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply