Legend Alignment

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

Legend Alignment

Post by cathy » Thu Jul 10, 2008 8:05 pm

Using the Java version of Teechart, I am mimicing what my company has previously done with the ocx version of Teechart. We are developing a large web based Java application and using midtier Java code, creating graphs and exporting to jpg files which are inserted into pdfs viewed by the user.

The graph I'm currently working on is a piechart. When I use the legend set alignment to TOP the legend prints centered above the piechart. The VB code manually positions the legend using the following code

.Legend.Top = .Header.Top + 20
.Legend.Left = 10

Then in the onbeforedrawseries method uses annotation to add in another column of text to the right of the legend.

If I use the following Java Code

myChart.getLegend().setCustomPosition(true);
myChart.getLegend().setLeft(10);
myChart.getLegend().setTop(myChart.getHeader().getTop()+20);

instead of the setalignment(TOP), my piechart and legend print on top of each other.

The VB code also has this method
Private Sub TChart1_OnSeriesBeforeDrawValues(ByVal SeriesIndex As Long)

If TChart1.Series(SeriesIndex).SeriesType = scPie Then
With TChart1
.ChartRect .Canvas.Width / 10, ((.Series(SeriesIndex).CountLegendItems + 5) * _
(.Legend.Font.Height)), .Canvas.Width - (.Canvas.Width / 10), .Canvas.Height

End With

End If

Is that what is moving the piechart down????

I have experimented with the java annotate and can insert text. Do I have to use the event dobeforedrawseries? Or can I do everything I need to do in one method. I'm not sure how or why I would need to add eventing in java backend code.

I cannot easily post my desired look and feel (ie the VB graph) using a website. I'm going to email what I'm trying to achieve to Mr. Calvet.

Any help would be most appreciated.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jul 11, 2008 8:09 am

Hi cathy,

Yes, exactly. You need to position the pie series as done with the ActiveX version. You'll find an example of how to do that at Chart Styles\Standard\Pie\Multiple Pies example in TeeChart.Features.jar shipped with TeeChart's installation.

BTW: You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply