Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing colors of bars in bar chart #259

Closed
aritram opened this issue May 21, 2014 · 2 comments
Closed

Changing colors of bars in bar chart #259

aritram opened this issue May 21, 2014 · 2 comments
Labels
C-feature-request Category: A feature request or an enhancement question

Comments

@aritram
Copy link

aritram commented May 21, 2014

  1. How do I customise bar chart when x-axis data is String, so that I can get different color for each bar plotted.
  2. While making bar chart vertical, "rotate:true" x-axis tick does not get rotated.
@jimmyle2008
Copy link

You do a setTimeout(function(){
// then loop through each rect in svg for the chart
$('.c3-bars-data1 path').each(function(){
//set your fill here for each rect
var rect = $(this);
//y1_data and y2_data are the originally data series i had in the chart

var y1_point = y1_data[i];
var y2_point = y2_data[i];
    if(y1_point >= y2_point){
    rect.css({fill:'#f45239'});
}

})
},300)

@masayuki0812
Copy link
Member

Hi, You can do that by using data.color option. Please see this fiddle: https://jsfiddle.net/gUf6a/1/ . And the option to rotate axis is axis.rotated, not axis.rotate.

As discussed in #245 , I think a new feature would be needed to achieve your purpose completely. I'm going to add that in near future as #16 , so please give me some time and sorry for inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request or an enhancement question
Projects
None yet
Development

No branches or pull requests

3 participants