2015-10-17 69 views
0

大家好我在我的項目中使用d3js和cal-Heatmap作爲日曆視圖,我能夠獲得示例工作。Cal-Heatmap僅顯示3個月另一個3個月又一行直到所有12個月

它只提供verticalOrientation =假/真的選擇,但我的要求是,我一定要顯示

horizontalOrientation (i.e verticalOrientation = false) 

但我想在連續3個月,再過3個月,行等。直到所有12個月。請幫助我實現它。

輸出目標:

enter image description here

回答

0

如果我正確理解你,你可以使用的subDomainrowLimit組合:

var cal = new CalHeatMap(); 
    cal.init({ 
    domain: "year", 
    subDomain: "x_month", 
    rowLimit: 3 
    }); 

完整的示例:

<!DOCTYPE html> 
 
<html> 
 

 
<head> 
 
    <script data-require="[email protected]" data-semver="3.5.3" src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.js"></script> 
 
    <link rel="stylesheet" href="https://rawgit.com/wa0x6e/cal-heatmap/master/cal-heatmap.css" /> 
 
    <script src="https://rawgit.com/wa0x6e/cal-heatmap/master/cal-heatmap.min.js"></script> 
 
</head> 
 

 
<body> 
 
    <div id="cal-heatmap"></div> 
 
    <script> 
 
    var cal = new CalHeatMap(); 
 
    cal.init({ 
 
     domain: "year", 
 
     subDomain: "x_month", 
 
     rowLimit: 3 
 
    }); 
 
    </script> 
 
</body> 
 

 
</html>

+0

嗨,馬克感謝給更新 我的要求是,以顯示所有的12個月內4行 像 一月二月三月 四月五月六月 七月八月九月 十月十一月十二月 喜歡我需要的一切在3列和4行的月份,但所有這些月份現在單列顯示 – KGBRS

+0

我需要這樣放。 https://www.dropbox.com/s/dufclcx59ksa9us/image.png?dl=0 – KGBRS