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
donal  
#1 Posted : Tuesday, August 10, 2010 12:37:35 AM(UTC)
donal
Rank: Member

Groups: Registered
Joined: 1/6/2010(UTC)
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 5:22:05 PM(UTC)
donal
Rank: Member

Groups: Registered
Joined: 1/6/2010(UTC)
Posts: 11
Location: UK

Bump!
Someone must know how to do this?
Cheers,
Don
Baydalka Volodymyr  
#3 Posted : Thursday, August 12, 2010 2:49:33 PM(UTC)
Baydalka Volodymyr
Rank: Member

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

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-2017 ArtfulBits. All rights reserved.