[英]Morris.js area graph customization
我需要一個像這樣的圖,有人可以通過在提琴上提供工作示例來幫助我嗎?
我當前的代碼是:
initCharts: function() {
if (Morris.EventEmitter) {
// Use Morris.Area instead of Morris.Line
dashboardMainChart = Morris.Area({
element: 'sales_statistics',
padding: 15,
// behaveLikeLine: false,
gridEnabled: true,
// gridLineColor: false,
axes: true,
fillOpacity: 0.3,
data: [{
period: '2011 Q1',
profit: 0
}, {
period: '2011 Q2',
profit: 20
}, {
period: '2011 Q3',
profit: 50
}, {
period: '2011 Q4',
profit: 40
}, {
period: '2011 Q4',
profit: 60
}],
lineColors: ['#91C120'],
xkey: 'period',
ykeys: ['profit'],
labels: ['Profit'],
xLabels:['week'],
pointSize: 5,
pointFillColors: ['#FFF'],
lineWidth: 3,
hideHover: 'auto',
resize: true
});
}
}
第一個問題是我想按類而不是id使用圖形目標元素,因為我想在單個頁面上多次使用它
第二,我找不到將上面的圖片放置在xLabels上的方法
第三,我想要與圖像相似的網格
element:$('.yourClass'),
xLabelFormat
選項使用星期xLabelFormat
,如下所示: xLabelFormat:function(x){day=x.getDay(); days=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; return days[day];}
circle{ stroke-width:4 } tspan[dy]{ stroke:#91C120 }
完整的演示可以在這里查看: http : //jsbin.com/nunusopaca/1/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.