2017-07-17 62 views
1

我有一個使用這些選項的折線圖,但背景並沒有改變顏色,都使用默認顏色。我錯過了什麼嗎?ng2-Chart背景顏色沒有反映正確的值

public lineChartColors:Array<any> = [ 
    { 
    borderColor: 'rgba(128,139,157,1)', 
    pointBackgroundColor: 'rgba(148,159,177,1)', 
    pointBorderColor: '#fff', 
    pointHoverBackgroundColor: '#fff', 
    pointHoverBorderColor: 'rgba(148,159,177,0.8)' 
    }, 
    { 
    borderColor: 'rgba(47,63,46,1)', 
    pointBackgroundColor: 'rgba(77,83,96,1)', 
    pointBorderColor: '#fff', 
    pointHoverBackgroundColor: '#fff', 
    pointHoverBorderColor: 'rgba(77,83,96,1)' 
    }, 
    { 
    borderColor: 'rgba(128,129,157,1)', 
    pointBackgroundColor: 'rgba(148,159,177,1)', 
    pointBorderColor: '#fff', 
    pointHoverBackgroundColor: '#fff', 
    pointHoverBorderColor: 'rgba(148,159,177,0.8)' 
    } 
]; 

回答

0

的pointBackgroundColor和的backgroundColor是兩種不同的選擇,如果你在的backgroundColor添加它應該反映你想要的

public lineChartColors:Array<any> = [ 
    { 
    pointBackgroundColor: 'rgba(//someColor)', //add this 
    borderColor: 'rgba(128,139,157,1)', 
    pointBorderColor: '#fff', 
    pointHoverBackgroundColor: '#fff', 
    pointHoverBorderColor: 'rgba(148,159,177,0.8)' 
    }, ... 
+1

哎,即做到了,謝謝! – Failbot