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

Pie Chart Legend Options · View
donal
#1 Posted : Monday, August 09, 2010 10:37:35 PM
Rank: Member

Groups: Registered

Joined: 1/6/2010
Posts: 11
Location: UK
Hello,
I've just started using aiCharts, but am having a problem.

How do I set the individual legend names for each data element in the Pie chart?

I can get the legend to display the value of each data element, however, I want a name for each element to be displayed.

Code:

    ChartArea area = mChartView.addArea();
    ChartSeries series = new ChartSeries(ChartTypes.Pie);
   
    series.getPoints().setData(myDataArray));
   
    series.setName("A Series of data for a Pie chart");
    series.setShowLabel(true);
    series.setArea(area.getName());
    mChartView.getSeries().add(series);

    ChartLegend legend = new ChartLegend();
    legend.setItemsProvider(new LegendItemsProvider.SeriesItemsProvider());
    mChartView.getLegends().add(legend);


Where do I set the names of each of the data elements?

Cheers,
Don
donal
#2 Posted : Tuesday, August 10, 2010 3:22:05 PM
Rank: Member

Groups: Registered

Joined: 1/6/2010
Posts: 11
Location: UK
Bump!
Someone must know how to do this?
Cheers,
Don
Baydalka Volodymyr
#3 Posted : Thursday, August 12, 2010 12:49:33 PM
Rank: Developers Team


Groups: Registered, Administrators

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

1) Legend represents point labels. Consider changing labels in series points via series.getPoints().get(index).setLabel()
2) You add legend items manually.

Code:
CustomItemsProvider<ChartLegendItem> items = new CustomItemsProvider<ChartLegendItem>();

items.getItems().add(new ChartLegendItem( "item 1" ));
items.getItems().add(new ChartLegendItem( "item 2" ));
        
chartView.getLegends().add(new ChartLegend(items));


Best ragards,
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-2016 ArtfulBits. All rights reserved.