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 +4 -4
- data/lib/sinatra/views/charts/bar.slim +50 -47
- data/lib/sinatra/views/charts/pie.slim +5 -1
- data/lib/sinatra/views/charts/stacked_bar.slim +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7b030f298091b86eff87999817b7e167b7f23f70a1cb96cc82571785ab4fecd
|
4
|
+
data.tar.gz: 89f21adaf020ba14de57ef7b890ae23013bf827e96dd2cf5d6e7cc793d8d42ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '04543278f129084cd3c67cc5e7aa83ae5c2ee6ef7e9e5cf730927637629b8151384d0fbdc9800e5bf5ccc8748ea3d8ec88fe762289a782c59162ea2b2fc3fc0c'
|
7
|
+
data.tar.gz: 39ffb8a63ecd557b5700c8b7d8feac27ba97d884e979087fe33e2333bd44990381e2a003c3c2f72e15374d180b8f4f2d06006aa647a13660360250ffbc1d5968
|
@@ -1,56 +1,59 @@
|
|
1
|
-
|
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
|
-
|
5
|
-
|
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
|
12
|
-
|
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
|
-
|
17
|
-
|
18
|
+
javascript:
|
19
|
+
var labels = #{{labels}};
|
20
|
+
var series = #{{series}};
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
new Chartist.Bar("##{id}", {
|
49
|
+
labels: labels,
|
50
|
+
series: series
|
51
|
+
},
|
52
|
+
options,
|
53
|
+
responsiveOptions
|
54
|
+
);
|
52
55
|
|
53
|
-
css:
|
54
|
-
|
55
|
-
|
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 {
|