whitespace COMPANY whitespace SERVICES whitespace PRODUCTS whitespace PURCHASE whitespace SUPPORT whitespace CONTACTS whitespace Home whitespace Contact Us whitespace Site Map whitespace
whitespace
SUPPORT
whitespace
FORUM
whitespace
FAQS
whitespace
SUBSCRIPTION
whitespace
REQUEST ON-LINE
whitespace
whitespace

Technical Support Forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
regulatre  
#1 Posted : Monday, November 15, 2010 6:17:03 PM(UTC)
regulatre
Rank: Member

Groups: Registered
Joined: 11/10/2010(UTC)
Posts: 14
Location: New York

I'm defining my charts in my layout XML and then setting up my chart at runtime as follows (see below). I don't know how to add series legends to the bottom of each chart though... It was working when I used a chart XML file to define the chart, but I need to define them at runtime.


Code:

ChartSeries cs = new ChartSeries(dataLabel,ChartTypes.FastLine);
cv.getSeries().add(cs);
ChartArea area = new ChartArea();
area.getDefaultXAxis().getScale().setMargin(ChartAxisScale.MARGIN_NONE);
area.getDefaultYAxis().setLabelsMode(LabelsMode.SeriesLabels);
area.getDefaultYAxis().getScale().setRange(minValue, maxValue);
area.getDefaultXAxis().getScale().setMinimum(0d);
area.getDefaultXAxis().getScale().setMaximum(100d);
cv.getAreas().add(area);

Baydalka Volodymyr  
#2 Posted : Monday, November 15, 2010 7:01:36 PM(UTC)
Baydalka Volodymyr
Rank: Member

Groups: Registered
Joined: 7/28/2009(UTC)
Posts: 447
Man

Hi,

Please, use following code :

Code:
ChartLegend legend = new ChartLegend();

cv.getLegends().add(legend);


If you need more than one legend, just add a new one with a unique name. Use this name to bind series to legend.

Code:
ChartLegend legend2 = new ChartLegend();

legend.setName("secondLegend");
series.setLegend("secondLegend");

cv.getLegends().add(legend2);


Best regards,
Volodymyr Baydalka
Andriod development and support team
regulatre  
#3 Posted : Tuesday, November 16, 2010 5:19:18 AM(UTC)
regulatre
Rank: Member

Groups: Registered
Joined: 11/10/2010(UTC)
Posts: 14
Location: New York

That didn't work :(

I tried it exactly as you type it and it didn't work. Then I copy and pasted some code from an example, which didn't work either:

Code:

ChartLegend legend = new ChartLegend();
legend.setDock( Dock.Right );
legend.getTextPaint().setAntiAlias( true );
legend.getTextPaint().setColor( Color.BLACK );
cv.getLegends().add(legend);


In both cases there is no visible legend.

I would just like to have a legend that contains an item for each series in my chart

I also tried the following, which had no affect on my chart:

Code:

ChartSeries cs = new ChartSeries(dataLabel,ChartTypes.FastLine);
cs.setLabel("SeriesLabel123");				cs.setLegend("Legend123");				
cv.getSeries().add(cs);


Any suggestions?

Thanks!

Baydalka Volodymyr  
#4 Posted : Tuesday, November 16, 2010 8:21:05 PM(UTC)
Baydalka Volodymyr
Rank: Member

Groups: Registered
Joined: 7/28/2009(UTC)
Posts: 447
Man

Hi,

Please, check the following sample.

Best regards,
File Attachment(s):
aiChartsLegend.zip (14kb) downloaded 22 time(s).

You cannot view/download attachments. Try to login or register.
Volodymyr Baydalka
Andriod development and support team
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Company | Services | Practices | Technologies | Career | Contacts | Privacy
© 2005-2017 ArtfulBits. All rights reserved.