[英]How to change the filling area color in Morris.js
I'm trying to set a custom color for the area chart in morris.js. 我正在尝试为morris.js中的区域图设置自定义颜色。 I've used the
lineColors
option but the area color below the line is some kind opaque. 我使用了
lineColors
选项,但线下面的区域颜色是某种不透明的。 Setting the fillingOpacity
to 1 doesn't change anything. 将
fillingOpacity
设置为1不会更改任何内容。
Is there a way to properly set a custom color for the filling area below the drawn lines? 有没有办法为绘制线下方的填充区域正确设置自定义颜色?
Use the fillOpacity
property (not fillingOpacity
). 使用
fillOpacity
属性(不是fillingOpacity
)。 Set a value between 0 and 1. If you set the property to 1, there's no transparency. 设置0到1之间的值。如果将属性设置为1,则不存在透明度。
Morris.Area({ element: 'chart', data: [ { y: '2015-01', a: 1, b: 2 }, { y: '2015-02', a: 2, b: 3 }, { y: '2015-03', a: 2, b: 2 }, { y: '2015-04', a: 1, b: 4 }, { y: '2015-05', a: 2, b: 5 }, { y: '2015-06', a: 3, b: 3 }, { y: '2015-07', a: 1, b: 2 } ], xkey: 'y', ykeys: ['a', 'b'], labels: ['Individual Score', 'Team Score'], fillOpacity: 0.4, hideHover: 'auto', behaveLikeLine: true, resize: true, pointFillColors: ['#ffffff'], pointStrokeColors: ['black'], lineColors: ['red', 'blue'], });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script> <link href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css" rel="stylesheet"/> <div id="chart"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.