mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Use chartkick globally
* Clean up legacy charting imports * Update existing donut and line charts * Create helpers for parsing out existing chart data * Move chart partials to a more common path
This commit is contained in:
parent
3bbac3667f
commit
516e53d9df
29 changed files with 331 additions and 577 deletions
13
app/views/application/_big_statistic.haml
Normal file
13
app/views/application/_big_statistic.haml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
- reverse ||= false
|
||||
- variant = variant_from_delta(delta, reverse: reverse)
|
||||
.dashbox.text-center
|
||||
%span.fa
|
||||
= fa_icon(icon)
|
||||
= value
|
||||
%p.text-nowrap
|
||||
%small
|
||||
= subtitle.pluralize(value)
|
||||
%span.label{ class: "label-#{variant}" }
|
||||
= delta
|
||||
since you last logged in
|
||||
|
||||
16
app/views/application/_donut_chart.haml
Normal file
16
app/views/application/_donut_chart.haml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
:ruby
|
||||
combined_data ||= {}
|
||||
data ||= chart_values(combined_data)
|
||||
colors ||= chart_colors(combined_data)
|
||||
|
||||
options = {
|
||||
donut: true,
|
||||
legend: 'bottom',
|
||||
download: true,
|
||||
messages: { empty: 'No data' }
|
||||
}
|
||||
options[:colors] = colors if colors.present?
|
||||
|
||||
.text-center
|
||||
%h4= title
|
||||
= pie_chart data, options
|
||||
15
app/views/application/_line_chart.html.haml
Normal file
15
app/views/application/_line_chart.html.haml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
:ruby
|
||||
options = {
|
||||
legend: 'bottom',
|
||||
download: true,
|
||||
messages: { empty: 'No data' }
|
||||
}
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.text-center
|
||||
%h4
|
||||
= title
|
||||
.row
|
||||
.col-md-12
|
||||
= line_chart data, options
|
||||
Loading…
Add table
Add a link
Reference in a new issue