mirror of
https://github.com/tomgi/git_stats.git
synced 2025-01-03 11:12:11 +01:00
Merge pull request #27 from tomgi/activity_by_date_crash
There was a dependency on internal lazy_high_charts implementation, that changed in last release. Removed that and now it should work with every version of lazy_high_charts.
This commit is contained in:
commit
bb2fb24107
1 changed files with 11 additions and 7 deletions
|
@ -35,21 +35,25 @@ module GitStats
|
||||||
|
|
||||||
def date_chart(params)
|
def date_chart(params)
|
||||||
common_options(params)
|
common_options(params)
|
||||||
date_series(name: params[:title], data: params[:data])
|
series(date_series(name: params[:title], data: params[:data]))
|
||||||
end
|
end
|
||||||
|
|
||||||
def multi_date_chart(params)
|
def multi_date_chart(params)
|
||||||
common_options(params)
|
common_options(params)
|
||||||
default_legend
|
default_legend
|
||||||
params[:data].each do |s|
|
params[:data].each do |s|
|
||||||
date_series(s)
|
series(date_series(s))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def date_column_chart(params)
|
def date_column_chart(params)
|
||||||
date_chart(params)
|
common_options(params)
|
||||||
data[0][:type] = 'column'
|
series(date_series(name: params[:title], data: params[:data]).merge(
|
||||||
data[0][:dataGrouping] = {units: [['day', [1]], ['week', [1]]], forced: true}
|
{
|
||||||
|
type: 'column',
|
||||||
|
dataGrouping: {units: [['day', [1]], ['week', [1]]], forced: true}
|
||||||
|
}
|
||||||
|
))
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_legend
|
def default_legend
|
||||||
|
@ -101,11 +105,11 @@ module GitStats
|
||||||
end
|
end
|
||||||
|
|
||||||
def date_series(params)
|
def date_series(params)
|
||||||
series(
|
{
|
||||||
name: params[:name],
|
name: params[:name],
|
||||||
type: "spline",
|
type: "spline",
|
||||||
data: Hash[params[:data]].fill_empty_days!.map { |date, value| [date.to_datetime.to_i * 1000, value] }.sort_by { |d| d[0] }
|
data: Hash[params[:data]].fill_empty_days!.map { |date, value| [date.to_datetime.to_i * 1000, value] }.sort_by { |d| d[0] }
|
||||||
)
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def column_chart(params)
|
def column_chart(params)
|
||||||
|
|
Loading…
Reference in a new issue