2017-05-19 92 views
0

您好我使用axlsx用於生成EXCEL在導軌傳說顏色不正確的axlsx堆積條形圖

在堆疊組barchat傳說文件的顏色是不妥當的。

它沒有把我的顏色。

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 

請看圖片的細節。其採取默認的顏色不是我 enter image description here

回答

0

您alpha通道指定顏色:

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

要麼移除或設置爲1應該解決這個問題。

+0

感謝您的答覆。其實它並沒有把標籤當作傳說。它採用標題作爲傳說。因此它採用默認顏色。 – Vikiesakki

0

試試這個,下面爲我工作

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

請嘗試與堆疊的聊天。對於堆疊的barchat它不工作。你可以發佈你的代碼。 – Vikiesakki