Module: Artisan::Reports::HighChartsDataRetriever

Defined in:
lib/artisan/reports/high_charts_data_retriever.rb

Class Method Summary collapse

Class Method Details

.build_average_standard_deviation_per_iteration_chart(project) ⇒ Object



30
31
32
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 30

def self.build_average_standard_deviation_per_iteration_chart(project)
  return build_iteration_chart(project, :standard_deviation, '#F87217')
end

.build_average_story_size_per_iteration_chart(project) ⇒ Object



26
27
28
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 26

def self.build_average_story_size_per_iteration_chart(project)
  return build_iteration_chart(project, :estimate, '#2B65EC')
end

.build_burn_up_chart(project) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 9

def self.build_burn_up_chart(project)
  chart_data = ::Artisan::Reports::BurnUpChart.new(project)

  LazyHighCharts::HighChart.new do |f|
    f.chart(:defaultSeriesType => 'line', :backgroundColor => nil, :margin => [0,0,0,0])
    f.yAxis(:gridLineWidth => nil, :labels => 'none')
    f.xAxis(:gridLineWidth => nil, :labels => false, :lineColor => 'transparent', :tickLength => nil)
    f.tooltip(:shadow => false, :backgroundColor => 'rgba(0,0,0,0.7)', :borderWidth => 0, :style => { :color => '#ffffff', :padding => [7,7,7,7], :fontSize => 13 }, :crosshairs => { :color => '#999', :dashStyle => 'solid'})
    f.title(:text => nil)
    f.options[:legend][:enabled] = false
    f.plotOptions(:line => { :lineWidth=> 1, :shadow => false, :marker => { :symbol => 'circle', :radius => 2, :states => { :hover => { :enabled => true, :fillColor => '#000000'} } } })

    f.series(:data => chart_data.project_data.slice(0, chart_data.project_data.length-1), :color => '#b8be43')
    f.series(:data => chart_data.completed_data.slice(0, chart_data.project_data.length-1), :color => '#800000')
  end
end

.build_iteration_chart(project, stat, color) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 34

def self.build_iteration_chart(project, stat, color)
  chart_data = Artisan::Reports::AverageStatPerIterationData.new(project)

  return LazyHighCharts::HighChart.new do |f|
    f.chart(:defaultSeriesType => 'line', :backgroundColor => nil, :margin => [0,0,0,0])
    f.yAxis(:gridLineWidth => nil, :labels => 'none')
    f.xAxis(:gridLineWidth => nil, :labels => false, :lineColor => 'transparent', :tickLength => nil)
    f.tooltip(:shadow => false, :backgroundColor => 'rgba(0,0,0,0.7)', :borderWidth => 0, :style => { :color => '#ffffff', :padding => [7,7,7,7], :fontSize => 13 }, :crosshairs => { :color => '#999', :dashStyle => 'solid'})
    f.title(:text => nil)
    f.options[:legend][:enabled] = false
    f.plotOptions(:line => { :lineWidth=> 1, :shadow => false, :marker => { :symbol => 'circle', :radius => 2, :states => { :hover => { :enabled => true, :fillColor => '#000000'} } } })

    f.series(:data => chart_data.average_of(stat), :color => color)
  end
end

.build_percentage_of_commitments_met_chart(project) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 50

def self.build_percentage_of_commitments_met_chart(project)
  chart_data = Artisan::Reports::PercentageOfCommitmentsMetData.new(project)

  LazyHighCharts::HighChart.new do |f|
    f.options[:chart][:backgroundColor] = 'transparent'
    f.options[:chart][:defaultSeriesType] = 'pie'
    f.series(:data=>[{y: go_no_higher_than_100(chart_data.percentage_of_commitments_met), color: 'green'}, {y: go_no_lower_than_0(chart_data.percentage_of_commitments_not_met), color: '#CCC'}], :innerSize => '65%')
    f.tooltip(:enabled => false)
    f.title(:text => '')
    f.plotOptions(:series => {:stacking => true, :shadow => false, :dataLabels => { :enabled => false }})
  end
end

.go_no_higher_than_100(number) ⇒ Object



68
69
70
71
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 68

def self.go_no_higher_than_100(number)
  return 0 if number.nil?
  number > 100 ? 100 : number
end

.go_no_lower_than_0(number) ⇒ Object



73
74
75
76
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 73

def self.go_no_lower_than_0(number)
  return 0 if number.nil?
  number < 0 ? 0 : number
end

.percentage_of_commitments_met(project) ⇒ Object



63
64
65
66
# File 'lib/artisan/reports/high_charts_data_retriever.rb', line 63

def self.percentage_of_commitments_met(project)
  chart_data = Artisan::Reports::PercentageOfCommitmentsMetData.new(project)
  chart_data.percentage_of_commitments_met.to_i
end