sinatra-hexacta 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af7c99e68c553f97a92ec0b45c94ada65f2203910e836c7a76920c0953c3dd3c
4
- data.tar.gz: 03de8cc91fda70f02f480603709e7a941e6e5e4b282f7f0359a35851f940678f
3
+ metadata.gz: b7b030f298091b86eff87999817b7e167b7f23f70a1cb96cc82571785ab4fecd
4
+ data.tar.gz: 89f21adaf020ba14de57ef7b890ae23013bf827e96dd2cf5d6e7cc793d8d42ad
5
5
  SHA512:
6
- metadata.gz: 2ff2d364a803e18b86e93d319a2aeb5c80a5d7e7875f3a57f830920e11edf0c39f9347be9054eee9deeab019dbd381301d4e6aeda568021b1b744b86c85de715
7
- data.tar.gz: 1c9309b67b4b182aec31225af8ccc6faa1c534e4bc6ea132744be2b35c2b6d838e013f39c9019f805ea570e132e127dab7f69d43b332901af164086b1996c43b
6
+ metadata.gz: '04543278f129084cd3c67cc5e7aa83ae5c2ee6ef7e9e5cf730927637629b8151384d0fbdc9800e5bf5ccc8748ea3d8ec88fe762289a782c59162ea2b2fc3fc0c'
7
+ data.tar.gz: 39ffb8a63ecd557b5700c8b7d8feac27ba97d884e979087fe33e2333bd44990381e2a003c3c2f72e15374d180b8f4f2d06006aa647a13660360250ffbc1d5968
@@ -1,56 +1,59 @@
1
- .ct-chart.bar-chart id="#{id}"
1
+ -if labels.empty? || series.empty?
2
+ == empty_alert({ :title => "Sin datos suficientes", :message => "No hay suficientes datos para mostrar esta información."})
3
+ -else
4
+ .ct-chart.bar-chart id="#{id}"
2
5
 
3
- .table-responsive.chart-table
4
- table.table.table-striped
5
- tbody
6
- tr
7
- -for label in labels
8
- th #{label}
9
- -for serie in series
6
+ .table-responsive.chart-table
7
+ table.table.table-striped
8
+ tbody
10
9
  tr
11
- -for element in serie
12
- td #{element}
10
+ -for label in labels
11
+ th #{label}
12
+ -for serie in series
13
+ tr
14
+ -for element in serie
15
+ td #{element}
13
16
 
14
17
 
15
- javascript:
16
- var labels = #{{labels}};
17
- var series = #{{series}};
18
+ javascript:
19
+ var labels = #{{labels}};
20
+ var series = #{{series}};
18
21
 
19
- var options = {
20
- seriesBarDistance: 30,
21
- fullWidth: true,
22
- chartPadding: {
23
- right: 40
24
- },
25
- height: '300px',
26
- showLabel: true,
27
- plugins: [
28
- Chartist.plugins.legend({
29
- legendNames: #{{names}},
30
- })
31
- ]
32
- };
22
+ var options = {
23
+ seriesBarDistance: 30,
24
+ fullWidth: true,
25
+ chartPadding: {
26
+ right: 40
27
+ },
28
+ height: '300px',
29
+ showLabel: true,
30
+ plugins: [
31
+ Chartist.plugins.legend({
32
+ legendNames: #{{names}},
33
+ })
34
+ ]
35
+ };
33
36
 
34
- var responsiveOptions = [
35
- ['screen and (max-width: 640px)', {
36
- seriesBarDistance: 5,
37
- axisX: {
38
- labelInterpolationFnc: function (value) {
39
- return value[0];
37
+ var responsiveOptions = [
38
+ ['screen and (max-width: 640px)', {
39
+ seriesBarDistance: 5,
40
+ axisX: {
41
+ labelInterpolationFnc: function (value) {
42
+ return value[0];
43
+ }
40
44
  }
41
- }
42
- }]
43
- ];
45
+ }]
46
+ ];
44
47
 
45
- new Chartist.Bar("##{id}", {
46
- labels: labels,
47
- series: series
48
- },
49
- options,
50
- responsiveOptions
51
- );
48
+ new Chartist.Bar("##{id}", {
49
+ labels: labels,
50
+ series: series
51
+ },
52
+ options,
53
+ responsiveOptions
54
+ );
52
55
 
53
- css:
54
- ##{{id}} .ct-bar {
55
- stroke-width: #{{100/(labels.count*series.count)}}%
56
- }
56
+ css:
57
+ ##{{id}} .ct-bar {
58
+ stroke-width: #{{100/(labels.count*series.count)}}%
59
+ }
@@ -9,6 +9,10 @@
9
9
  tr
10
10
  -for element in serie
11
11
  td #{element}
12
+ tr
13
+ -total = [1,serie.reduce(:+)].max
14
+ -for element in serie
15
+ td #{(element.to_f*100/total).round(0)}%
12
16
 
13
17
  javascript:
14
18
  var labels = #{{labels}};
@@ -25,7 +29,7 @@ javascript:
25
29
  Chartist.plugins.legend()
26
30
  ]
27
31
  }
28
- );
32
+ );
29
33
 
30
34
  css:
31
35
  .pie .ct-legend.ct-legend-inside {
@@ -18,8 +18,8 @@ javascript:
18
18
  var series = #{{series}};
19
19
 
20
20
  new Chartist.Bar("##{id}", {
21
- labels: labels,
22
- series: series
21
+ labels: labels,
22
+ series: series
23
23
  }, {
24
24
  stackBars: true,
25
25
  axisY: {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger