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

Custom Bar Chart Options · View
rlandfair
#1 Posted : Friday, February 19, 2010 12:40:52 AM
Rank: Newbie

Groups: Registered

Joined: 2/19/2010
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 1:07:18 PM
Rank: Guest

Groups:

Joined: 7/9/2009
Posts: 3,383
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 8:50:17 PM
Rank: Newbie

Groups: Registered

Joined: 2/19/2010
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 3:02:14 PM
Rank: Developers Team


Groups: Registered, Administrators

Joined: 7/28/2009
Posts: 447
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,
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.