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
rlandfair  
#1 Posted : Friday, February 19, 2010 2:40:52 AM(UTC)
rlandfair
Rank: Newbie

Groups: Registered
Joined: 2/19/2010(UTC)
Posts: 5
Location: Colorado

Is there a way I can set the color of each individul bar of a bar/column chart?
pturchenko  
#2 Posted : Friday, February 19, 2010 3:07:18 PM(UTC)
Guest
Rank: Guest

Groups: Guests
Joined: 7/9/2009(UTC)
Posts: 3,342

Yes. You can customize every single point of ChartSeries. Use following snippet:

// Getting 6th point of chart series
ChartPoint point = series.getPoints().get(5);
// Setting particular color that will be used to draw this point.
point.setColor(Color.GREEN);
rlandfair  
#3 Posted : Friday, February 19, 2010 10:50:17 PM(UTC)
rlandfair
Rank: Newbie

Groups: Registered
Joined: 2/19/2010(UTC)
Posts: 5
Location: Colorado

pturchenko wrote:
Yes. You can customize every single point of ChartSeries. Use following snippet:

// Getting 6th point of chart series
ChartPoint point = series.getPoints().get(5);
// Setting particular color that will be used to draw this point.
point.setColor(Color.GREEN);


My ChartPoint does not have a setColor method. It does have a setBackColor and setBorderColor method. The setBackColor method does not do anything, the bars all remain red. The setBorderColor actually changes the border to the color I select. What should I try?

Here is my code:

ChartView chartView = new ChartView( this );
ChartArea area = chartView.addArea();
ChartSeries series = new ChartSeries( "MachineStatuses", ChartTypes.Column );

series.setArea( area.getName() );

series.getPoints().setData( new double[]
{ 26, 18, 42, 33 } );
series.setShowLabel( true );

ChartPoint point = series.getPoints().get(0);
point.setBackFilterEnabled(false);

point.setBorderColor(Color.CYAN);
point.setBackColor(Color.BLUE);

chartView.getSeries().add( series );

ChartAxis[] axes = {area.getDefaultXAxis(),area.getDefaultYAxis()};

axes[0].setLabelsMode(LabelsMode.NoLabels);

setContentView( chartView );
Baydalka Volodymyr  
#4 Posted : Saturday, February 20, 2010 5:02:14 PM(UTC)
Baydalka Volodymyr
Rank: Member

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

Hi,

Thank you for bug report. We have already fixed this bug. If you have subscription you may send request to get the last build or just wait to next release.

Also you may use this workaround to change point color

Code:
ShapeDrawable drawable = new ShapeDrawable();
drawable.getPaint().setColor(Color.BLUE);
point.setBackDrawable(drawable);


Best regards,

Edited by user Saturday, February 20, 2010 5:03:17 PM(UTC)  | Reason: Not specified

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.