我试图绘制一个 highcharts 图表。我想要 x 轴上的数据时间和 y 轴上的计数。到目前为止我所拥有的:
series: [{
name: 'Success',
pointInterval: <%= 1.day * 1000 %>,
pointStart: <%= DateTime.strptime(params[:start_date], '%m/%d/%Y').at_midnight.to_i * 1000 %>,
data: <%= ServerStatus.success.find(:all, :select => 'generated_at, count', :conditions => {:generated_at => DateTime.strptime("07/25/2013", '%m/%d/%Y').beginning_of_day..DateTime.strptime("07/25/2013", '%m/%d/%Y').end_of_day}, :order => 'generated_at ASC').to_json %>
生成:
数据:[{"count":2222,"generated_at":"2013-07-25T00:00:00Z"},{"count":65,"generated_at":"2013-07-25T00:00:00Z"} ,{"count":335,"generated_at":"2013-07-25T00:00:00Z"},{"count":320,"generated_at":"2013-07-25T00:00:00Z"},{ "count":156,"generated_at":"2013-07-25T00:00:00Z"}]
我怎样才能以 highcharts 期望的方式格式化它,我相信这是[datetime, count]