Vikiesakki
Vikiesakki

Reputation: 31

Legends colors are not proper in axlsx stacked bar chart

Hi i am using axlsx for generate excel file in rails

In stacked group barchat legends colors are not proper.

Its not taking my color.

sheet.add_chart(Axlsx::Bar3DChart, :start_at => "G2", :end_at => "O15", :title => "#{business_unit}",:barDir => :col,:grouping=> :stacked) do |chart|
    chart.add_series :data => sheet["B3:B6"], :labels => sheet["A3:A6"], :title => sheet["B2"], :colors => ['222','222','222','222']
    chart.add_series :data => sheet["C3:C6"], :labels => sheet["A3:A6"], :title => sheet["C2"], :colors => ['ffff00','ffff00','ffff00','ffff00']
    chart.add_series :data => sheet["D3:D6"], :labels => sheet["A3:A6"], :title => sheet["D2"], :colors => ['ff0000','ff0000','ff0000','ff0000']
    chart.add_series :data => sheet["E3:E6"], :labels => sheet["A3:A6"], :title => sheet["E2"], :colors => ['0f52d6','0f52d6','0f52d6','0f52d6']
   end

Please see the picture for detail. Its taking default colour not mine enter image description here

Upvotes: 1

Views: 357

Answers (2)

Pratap
Pratap

Reputation: 337

Try this, Below working for me

:colors => ['FF0000', '00FF00', '0000FF']

Upvotes: 0

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 121000

You specify colors with alpha-channel:

#                                      ⇓⇓⇓⇓⇓⇓⇓⇓
:colors => ['ffff00','ffff00','ffff00','ffff00']

Either removing it or setting to 1 should fix the problem.

Upvotes: 0

Related Questions