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 Search | Active Topics | Log In | Register

How to set chart legend? Options · View
p.t.
#1 Posted : Monday, May 30, 2011 8:47:32 PM
Rank: Newbie

Groups: Registered

Joined: 5/26/2011
Posts: 8
Location: USA
Hi,

I've been evaluating this product for days now, it's a great product. But could you please help me with one problem?

I'm using the following code to generate the following chart. My question is: Why the legeds are point values? As you can see, I have set the series name to "My Name", why it's not showing as the legend? Thank you. (I've changed angle brackets to '@' because the forum does not allow them.)

Edited: I just found that if I added a second series, then the lendges would be correct. But if there is only one series, then the legends are all point values. Why is that???

Code:
ChartView cv = new ChartView(this);
cv.setLayoutParams(new LinearLayout.LayoutParams
        (LayoutParams.FILL_PARENT, 250));
cv.getAreas().add(new ChartArea());
ChartCollection@ChartLegend@ legends = cv.getLegends();
ChartLegend legend = new ChartLegend();
legends.add(legend);
ChartNamedCollection@ChartSeries@ seriesCollection = cv.getSeries();
ChartSeries series = new ChartSeries(
        "My Name", ChartTypes.get("Line"));
seriesCollection.add(series);
series.getPoints().setData(
        new double[] { 10, 134, 78, 21, 55, 31, 120, 81 } );


Baydalka Volodymyr
#2 Posted : Tuesday, May 31, 2011 11:30:25 AM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
Hi,

That is default behavior of legend. If there is only one series, legend display points instead of series. You may change it with following code :

Code:
legend.setItemsProvider(new LegendItemsProvider.SeriesItemsProvider());



Best regards,
Volodymyr Baydalka
Andriod development and support team
p.t.
#3 Posted : Tuesday, May 31, 2011 7:35:30 PM
Rank: Newbie

Groups: Registered

Joined: 5/26/2011
Posts: 8
Location: USA
That worked beautifully! Thank you!
Users browsing this topic
Guest (2)
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-2016 ArtfulBits. All rights reserved.