我做了什么:
我已使用API查询并通过PHP从Google Analytics获取json
格式的数据。我使用chartjs.org
来显示图表。它正如其文档中所描述的那样正常工作。
GA管理员:
但在GA管理员中,结果按月分组。这是因为如果时间跨度增加,则图表的x轴标签将变得拥挤。如何实现下图并按月分组数据?
我的js数据:
var salesChartData = {
labels: ["2016 Jun, 11","2016 Jun, 12","2016 Jun, 13","2016 Jun, 14","2016 Jun, 15","2016 Jun, 16","2016 Jun, 17","2016 Jun, 18","2016 Jun, 19","2016 Jun, 20","2016 Jun, 21","2016 Jun, 22","2016 Jun, 23","2016 Jun, 24","2016 Jun, 25","2016 Jun, 26","2016 Jun, 27","2016 Jun, 28","2016 Jun, 29","2016 Jun, 30","2016 Jul, 01","2016 Jul, 02","2016 Jul, 03"],
datasets: [
{
label: "Electronics",
fillColor: "rgba(5, 141, 199,.1)",
strokeColor: "#058dc7",
pointColor: "#058dc7",
pointStrokeColor: "#058dc7",
pointHighlightFill: "#0371a0",
pointHighlightStroke: "#0371a0",
data: ["18","4","39","25","19","23","19","11","7","21","14","19","24","29","6","8","29","29","15","18","13","3","4"],
}
]
};
上述代码需要更改哪些内容才能实现GA等图表?