我想在此link或其他示例 - this picture中的Excel图片中绘制同类群组分析。
简短摘要:队列分析意味着您有一个矩阵(n x n),主对角线下的值为空(这是数据)。
示例:
+----------+------+------+------+-----+ | | Jan | Feb | Mar | Apr | +----------+------+------+------+-----+ | January | 100 | 90 | 80 | 30 | | February | null | 120 | 56 | 40 | | March | null | null | 90 | 70 | | April | null | null | null | 79 | +----------+------+------+------+-----+
我认为最合适的图表是带有@Data
@Entity
@Table(name = "Record")
public class CardLocal
{
@Id
@Column(name = "ID")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="LOCAL_SEQ")
@SequenceGenerator(name="LOCAL_SEQ", sequenceName="LOCAL_SEQ", allocationSize=1)
private Long ID;
@Column(name = "CARDID")
private String kartaID;
@Column(name = "DATE", insertable = false)
private String date;
@Column(name = "FOODTYPE")
private String typJidla;
@Column(name = "MOVED", insertable = false)
private boolean moved;
public CardLocal() { }
public CardLocal(String kartaID, String typJidla) {
this.kartaID = kartaID;
this.typJidla = typJidla;
}
}
和seriesType: 'area'
的 ComboChart ,但它远远没有显示在链接中上面的图片。 JsFiddle for it here。
所以我被卡住了,也许需要另一个图表/选项来实现我需要的渲染,也许数据需要以另一种方式构建,也许它不可能与任何谷歌这样做图。
任何帮助表示赞赏。谢谢。
答案 0 :(得分:0)
需要以与excel相反的方式设置数据,
使用AreaChart
将列切换为行。
请参阅以下工作代码段...
google.charts.load('current', {
packages: ['corechart']
}).then(function () {
var data = new google.visualization.DataTable();
data.addColumn('date', 'Month');
data.addColumn('number', 'Jan');
data.addColumn('number', 'Feb');
data.addColumn('number', 'Mar');
data.addColumn('number', 'Apr');
data.addColumn('number', 'May');
data.addColumn('number', 'Jun');
data.addColumn('number', 'Jul');
data.addRows([
[new Date(2017, 0, 1),147,0,0,0,0,0,0],
[new Date(2017, 1, 1),26,123,0,0,0,0,0],
[new Date(2017, 2, 1),24,29,149,0,0,0,0],
[new Date(2017, 3, 1),20,24,28,138,0,0,0],
[new Date(2017, 4, 1),20,20,22,22,130,0,0],
[new Date(2017, 5, 1),15,16,14,15,18,120,0],
[new Date(2017, 6, 1),14,14,12,14,20,29,110],
]);
var options = {
height: 400,
isStacked: true,
legend: 'none'
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
});

<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
&#13;