2015-06-11 39 views
0

我想自定義我的面積圖顏色,我該怎麼辦?更改莫里斯面積圖

這是我的代碼:

$.getJSON("http://10.30.6.69:1200/WebAPI.aspx/?api=RequestPostFiveMins", function (data4) { 

    new Morris.Area({ 
     backgroundColor: '#ccc', 
     labelColor: '#060', 

     // ID of the element in which to draw the chart. 
     element: 'POSTFIVEMINS', 
     // Chart data records -- each entry in this array corresponds to a point on 
     // the chart. 
     data: data4, 
     // The name of the data record attribute that contains x-values. 
     xkey: 'Time', 
     // A list of names of data record attributes that contain y-values. 
     ykeys: ['Total', 'Success', 'Error'], 
     // Labels for the ykeys -- will be displayed when you hover over the 
     // chart. 
     labels: ['Total', 'Success', 'Error'], 
     parseTime: false, 
     hideHover: 'auto', 



}).progress(function() { 
    $(document.getElementById("POSTFIVEMINSID").style.display = ""); 
}).done(function() { 
    $(document.getElementById("POSTFIVEMINSID").style.display = "none"); 
}); 
+0

總計是藍色的,成功是綠色,錯誤是這樣的紅色 –

+0

爲什麼不接受答案?畢竟它沒有幫助你嗎? – D4V1D

回答

1

嘗試添加lineColors屬性,它需要一個包含彩色陣系列線/分

new Morris.Area({ 
    // ... 
    lineColors: ['#0B62A4', '#F79263', '#A7B3BC'], 
    // ... 
});