Module: PredictabilityEngine::VegaVisualizer::AgingWipVisualizer
- Defined in:
- lib/predictability_engine/vega_visualizer/aging_wip_visualizer.rb
Class Method Summary collapse
- .aging_bar_layer ⇒ Object
- .aging_rule_layers(mapped_pcts) ⇒ Object
- .aging_wip(items, title: 'Aging Work In Progress', pcts: PredictabilityEngine::DEFAULT_PERCENTILES) ⇒ Object
Class Method Details
.aging_bar_layer ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/predictability_engine/vega_visualizer/aging_wip_visualizer.rb', line 20 def self. { mark: { type: 'bar', stroke: 'white', strokeWidth: 0.2 }, encoding: { x: { field: 'id', type: 'nominal', title: 'Work Item ID', sort: '-y', axis: VegaVisualizer::LABEL_AXIS }, y: VegaVisualizer.quantitative_y_axis('age', title: 'Age (days)'), color: { field: 'age', type: 'quantitative', scale: { scheme: 'yelloworangered' }, legend: { orient: 'bottom', title: 'Age' } }, **VegaVisualizer.item_href_and_tooltip( [{ field: 'age', type: 'quantitative', title: 'Age (days)' }] ) } } end |
.aging_rule_layers(mapped_pcts) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/predictability_engine/vega_visualizer/aging_wip_visualizer.rb', line 32 def self.aging_rule_layers(mapped_pcts) mapped_pcts.map do |p| { data: { values: [{ val: p[:val], label: p[:label] }] }, mark: { type: 'rule', strokeDash: [4, 4] }, encoding: { y: VegaVisualizer.quantitative_y_axis('val', title: 'Age (days)'), color: { value: '#e45756' }, tooltip: [{ field: 'label', type: 'nominal', title: 'Percentile' }, { field: 'val', type: 'quantitative', title: 'Age (days)' }] } } end end |
.aging_wip(items, title: 'Aging Work In Progress', pcts: PredictabilityEngine::DEFAULT_PERCENTILES) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/predictability_engine/vega_visualizer/aging_wip_visualizer.rb', line 6 def self.aging_wip(items, title: 'Aging Work In Progress', pcts: PredictabilityEngine::DEFAULT_PERCENTILES, **) raw = Calculators::Aging.item_age_data(items) return Vega.lite.data([]).title(title || 'Aging Work In Progress') if raw.empty? data = raw.map { |row| row.merge(title_display: VegaVisualizer.wrap_tooltip_title(row[:title].to_s)) } mapped = PredictabilityEngine.mapped_percentiles(items, pcts) VegaVisualizer.apply_standard_dims( Vega.lite.data(data) .layer([, *aging_rule_layers(mapped)]), title: title ) end |