简体   繁体   中英

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

You specify colors with alpha-channel:

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

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

试试这个,下面为我工作

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM