ar-poncho 2.0.210 → 2.0.213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js/poncho.js +343 -89
- package/dist/js/poncho.min.js +1 -1
- package/dist/js/showdown-extensions.js +13 -11
- package/package.json +1 -1
package/dist/js/poncho.js
CHANGED
|
@@ -649,12 +649,15 @@ function ponchoChart(opt) {
|
|
|
649
649
|
var tipoGraficosMixed = [];
|
|
650
650
|
var indicePorcentajeMixed = 0;
|
|
651
651
|
var porcentajesMixed = [];
|
|
652
|
+
var labelsYCortos = [];
|
|
653
|
+
var indiceNombreCorto = 0;
|
|
652
654
|
|
|
653
655
|
//iniciaizo variables
|
|
654
656
|
var url = opt.jsonUrl ? opt.jsonUrl :
|
|
655
657
|
'https://sheets.googleapis.com/v4/spreadsheets/' + opt.idSpread + '/values/' + opt.hojaNombre + '?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY';
|
|
656
658
|
|
|
657
659
|
var posicionLeyendas = opt.posicionLeyendas ? opt.posicionLeyendas : 'top';
|
|
660
|
+
|
|
658
661
|
var mostrarLeyendas = '';
|
|
659
662
|
if (typeof opt.mostrarLeyendas == 'undefined'){
|
|
660
663
|
mostrarLeyendas = true;
|
|
@@ -678,6 +681,10 @@ function ponchoChart(opt) {
|
|
|
678
681
|
var pos = split[0] + split[1];
|
|
679
682
|
filteredTitleName.push(pos);
|
|
680
683
|
filteredTitlePos.push(index);
|
|
684
|
+
} else if (listado[0][index] == 'nombre-corto'){
|
|
685
|
+
if (tipoGrafico == 'heatmap'){
|
|
686
|
+
indiceNombreCorto = index;
|
|
687
|
+
}
|
|
681
688
|
}
|
|
682
689
|
});
|
|
683
690
|
|
|
@@ -708,8 +715,12 @@ function ponchoChart(opt) {
|
|
|
708
715
|
if (row == 1) {
|
|
709
716
|
jQuery.each(filteredTitlePos, function(index, title) {
|
|
710
717
|
if (tipoGrafico != 'pie') {
|
|
711
|
-
|
|
712
|
-
|
|
718
|
+
if (tipoGrafico == 'heatmap') {
|
|
719
|
+
etiquetas.push(listado[row][filteredTitlePos[index]]); //recupero etiquetas (eje x)
|
|
720
|
+
} else {
|
|
721
|
+
columnas.push(listado[row][filteredTitlePos[index]]); //recupero columnas para label
|
|
722
|
+
cantDatos = cantDatos + 1;
|
|
723
|
+
}
|
|
713
724
|
} else {
|
|
714
725
|
etiquetas.push(listado[row][filteredTitlePos[index]]); //recupero las etiquetas de la torta
|
|
715
726
|
}
|
|
@@ -725,11 +736,24 @@ function ponchoChart(opt) {
|
|
|
725
736
|
if (tipoGrafico == 'pie') { //recupero datos para la torta
|
|
726
737
|
valores[pos].push(listado[row][filteredTitlePos[index]]);
|
|
727
738
|
} else {
|
|
728
|
-
if (
|
|
729
|
-
|
|
730
|
-
|
|
739
|
+
if (tipoGrafico == 'heatmap') {
|
|
740
|
+
if (label == false) {
|
|
741
|
+
columnas.push(listado[row][0]); //recupero las columnas (eje y)
|
|
742
|
+
label = true;
|
|
743
|
+
cantDatos = cantDatos + 1;
|
|
744
|
+
}
|
|
745
|
+
if (index != indiceNombreCorto) valores[pos].push(listado[row][filteredTitlePos[index]]); //recupero datos
|
|
746
|
+
if (index + 2 == indiceNombreCorto) {
|
|
747
|
+
if (typeof listado[row][index + 2] == 'undefined') labelsYCortos.push("*"); //en caso que no completen nombre-corto
|
|
748
|
+
else labelsYCortos.push(listado[row][index + 2]); //recupero labels Y cortos
|
|
749
|
+
}
|
|
750
|
+
} else {
|
|
751
|
+
if (label == false) {
|
|
752
|
+
etiquetas.push(listado[row][0]); //recupero las etiquetas
|
|
753
|
+
label = true;
|
|
754
|
+
}
|
|
755
|
+
valores[pos].push(listado[row][filteredTitlePos[index]]); //recupero datos
|
|
731
756
|
}
|
|
732
|
-
valores[pos].push(listado[row][filteredTitlePos[index]]); //recupero datos
|
|
733
757
|
}
|
|
734
758
|
});
|
|
735
759
|
}
|
|
@@ -780,7 +804,20 @@ function ponchoChart(opt) {
|
|
|
780
804
|
mode: 'index',
|
|
781
805
|
intersect: false,
|
|
782
806
|
};
|
|
807
|
+
} else if (tipoGrafico == 'pie'){
|
|
808
|
+
|
|
809
|
+
//seteo tooltips
|
|
810
|
+
toltips = {
|
|
811
|
+
enabled: true,
|
|
812
|
+
callbacks: {
|
|
813
|
+
label: function(tooltipItem, data) {
|
|
814
|
+
return data["labels"][tooltipItem.index] + ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index] + '%';
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
|
|
783
819
|
} else {
|
|
820
|
+
|
|
784
821
|
//seteo tooltips
|
|
785
822
|
toltips = {
|
|
786
823
|
enabled: true,
|
|
@@ -791,7 +828,9 @@ function ponchoChart(opt) {
|
|
|
791
828
|
}
|
|
792
829
|
};
|
|
793
830
|
}
|
|
831
|
+
|
|
794
832
|
} else {
|
|
833
|
+
|
|
795
834
|
if (tipoGrafico == 'line' && cantDatos > 1){
|
|
796
835
|
//seteo tooltips
|
|
797
836
|
toltips = {
|
|
@@ -833,111 +872,202 @@ function ponchoChart(opt) {
|
|
|
833
872
|
graficoLineaSimple(etiquetas, datos, tipoGrafico, color, columnas[0], opt.ejeYenCero, opt.idComponenteGrafico, posicionLeyendas, toltips, mostrarLeyendas);
|
|
834
873
|
}
|
|
835
874
|
|
|
836
|
-
if (tipoGrafico == 'bar' || opt.tipoGrafico == 'Area'
|
|
875
|
+
if (tipoGrafico == 'bar' || opt.tipoGrafico == 'Area') {
|
|
837
876
|
graficoAreaBarraSimple(etiquetas, datos, tipoGrafico, color, columnas[0], opt.ejeYenCero, opt.idComponenteGrafico, posicionLeyendas, toltips, mostrarLeyendas);
|
|
838
877
|
}
|
|
839
878
|
|
|
879
|
+
if (tipoGrafico == 'horizontalBar') {
|
|
880
|
+
graficoBarraHorizontalSimple(etiquetas, datos, tipoGrafico, color, columnas[0], opt.ejeYenCero, opt.idComponenteGrafico, posicionLeyendas, toltips, mostrarLeyendas);
|
|
881
|
+
}
|
|
882
|
+
|
|
840
883
|
}
|
|
841
884
|
|
|
842
885
|
if (cantDatos > 1) {
|
|
843
886
|
|
|
844
|
-
|
|
845
|
-
var indiceColor = 0;
|
|
887
|
+
if (tipoGrafico == 'heatmap') {
|
|
846
888
|
|
|
847
|
-
|
|
848
|
-
colores.forEach(function(valor, indice, array) {
|
|
849
|
-
codigosColores.push(getColor(valor));
|
|
850
|
-
});
|
|
889
|
+
if ((typeof opt.heatMapColors != 'undefined' && opt.heatMapColors != "") && (typeof opt.heatMapColorsRange != 'undefined' && opt.heatMapColorsRange != "")){
|
|
851
890
|
|
|
852
|
-
|
|
891
|
+
var datosFull = [];
|
|
853
892
|
|
|
854
|
-
|
|
893
|
+
var labelX = 'labelFila';
|
|
894
|
+
var labelY = 'labelColumna';
|
|
895
|
+
var labelValor = 'labelValor';
|
|
855
896
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
897
|
+
if ((typeof opt.datosTooltip != 'undefined') && (opt.datosTooltip.length > 0)){
|
|
898
|
+
if ((typeof opt.datosTooltip[0] != 'undefined') && (typeof opt.datosTooltip[0].labelFila != 'undefined')) labelX = opt.datosTooltip[0].labelFila;
|
|
899
|
+
if ((typeof opt.datosTooltip[1] != 'undefined') && (typeof opt.datosTooltip[1].labelColumna != 'undefined')) labelY = opt.datosTooltip[1].labelColumna;
|
|
900
|
+
if ((typeof opt.datosTooltip[2] != 'undefined') && (typeof opt.datosTooltip[2].labelValor != 'undefined')) labelValor = opt.datosTooltip[2].labelValor;
|
|
901
|
+
}
|
|
860
902
|
|
|
861
|
-
|
|
903
|
+
//getDatos
|
|
904
|
+
jQuery.each(Object.keys(filteredTitleName), function(index, key) {
|
|
862
905
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
borderColor: codigosColores[indiceColor],
|
|
871
|
-
fill: false,
|
|
872
|
-
borderWidth: 2,
|
|
873
|
-
lineTension: 0,
|
|
874
|
-
backgroundColor: codigosColores[indiceColor],
|
|
875
|
-
};
|
|
876
|
-
} else if (opt.tipoGrafico == 'Bar' || opt.tipoGrafico == 'Area' || opt.tipoGrafico == 'Horizontal Bar' || opt.tipoGrafico == 'Stacked Bar') {
|
|
877
|
-
//construyo datasets
|
|
878
|
-
var dataset = {
|
|
879
|
-
label: columnas[indiceColor],
|
|
880
|
-
data: datos,
|
|
881
|
-
borderColor: codigosColores[indiceColor],
|
|
882
|
-
backgroundColor: codigosColores[indiceColor], //BARRAS y AREA
|
|
883
|
-
borderWidth: 2,
|
|
884
|
-
lineTension: 0, //linea y area
|
|
906
|
+
var pos = filteredTitleName[index];
|
|
907
|
+
|
|
908
|
+
if (valores.hasOwnProperty(pos)) {
|
|
909
|
+
|
|
910
|
+
datos = valores[pos];
|
|
911
|
+
|
|
912
|
+
datosFull.push(datos);
|
|
885
913
|
};
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
var series = [];
|
|
917
|
+
|
|
918
|
+
for (var i=0;i<columnas.length;i++) {
|
|
919
|
+
|
|
920
|
+
var data = [];
|
|
921
|
+
|
|
922
|
+
for (var l=0;l<etiquetas.length;l++) {
|
|
923
|
+
|
|
924
|
+
var datos = {
|
|
925
|
+
x: etiquetas[l],
|
|
926
|
+
y: parseInt(datosFull[l][i])
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
data.push(datos);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
var serie = {
|
|
933
|
+
name: labelsYCortos[i] != '*' ? labelsYCortos[i] : columnas[i],
|
|
934
|
+
data: data
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
series.push(serie);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
var rango = [];
|
|
941
|
+
|
|
942
|
+
//construyo range object
|
|
943
|
+
for (var i=0; i<opt.heatMapColorsRange.length -1; i++){
|
|
944
|
+
var data = {
|
|
945
|
+
from: opt.heatMapColorsRange[i],
|
|
946
|
+
to: opt.heatMapColorsRange[i + 1],
|
|
947
|
+
color: getColor(opt.heatMapColors[i])
|
|
897
948
|
};
|
|
898
|
-
|
|
949
|
+
rango.push(data);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
var mostrarYaxis = '';
|
|
953
|
+
if (typeof opt.mostrarEjeY == 'undefined'){
|
|
954
|
+
mostrarYaxis = true;
|
|
955
|
+
} else {
|
|
956
|
+
mostrarYaxis = opt.mostrarEjeY;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
graficoHeatMap(etiquetas, series, opt.idComponenteGrafico, columnas, rango, labelX, labelY, labelValor, opt.tituloGrafico, mostrarYaxis, posicionLeyendas, mostrarLeyendas);
|
|
960
|
+
|
|
961
|
+
} else {
|
|
962
|
+
//informo por consola el faltante
|
|
963
|
+
if (typeof opt.heatMapColors == 'undefined' || opt.heatMapColors == "") {
|
|
964
|
+
console.log('Completar vector con valores para los colores');
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
if (typeof opt.heatMapColorsRange == 'undefined' || opt.heatMapColorsRange == "") {
|
|
968
|
+
console.log('Completar vector con el rango de valores para los colores');
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
} else {
|
|
972
|
+
|
|
973
|
+
var datasets = [];
|
|
974
|
+
var indiceColor = 0;
|
|
975
|
+
|
|
976
|
+
//getColores
|
|
977
|
+
colores.forEach(function(valor, indice, array) {
|
|
978
|
+
codigosColores.push(getColor(valor));
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
console.log('colores --> ' + codigosColores);
|
|
982
|
+
|
|
983
|
+
var indiceMixed = 0;
|
|
984
|
+
|
|
985
|
+
//getDatos
|
|
986
|
+
jQuery.each(Object.keys(filteredTitleName), function(index, key) {
|
|
987
|
+
var pos = filteredTitleName[index];
|
|
988
|
+
if (valores.hasOwnProperty(pos)) {
|
|
989
|
+
|
|
990
|
+
datos = valores[pos];
|
|
991
|
+
|
|
992
|
+
console.log('datos --> ' + datos);
|
|
993
|
+
|
|
994
|
+
if (opt.tipoGrafico == 'Line') {
|
|
995
|
+
//construyo datasets
|
|
996
|
+
var dataset = {
|
|
997
|
+
label: columnas[indiceColor],
|
|
998
|
+
data: datos,
|
|
999
|
+
borderColor: codigosColores[indiceColor],
|
|
1000
|
+
fill: false,
|
|
1001
|
+
borderWidth: 2,
|
|
1002
|
+
lineTension: 0,
|
|
1003
|
+
backgroundColor: codigosColores[indiceColor],
|
|
1004
|
+
};
|
|
1005
|
+
} else if (opt.tipoGrafico == 'Bar' || opt.tipoGrafico == 'Area' || opt.tipoGrafico == 'Horizontal Bar' || opt.tipoGrafico == 'Stacked Bar') {
|
|
1006
|
+
//construyo datasets
|
|
899
1007
|
var dataset = {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
// This binds the dataset to the right y axis
|
|
907
|
-
yAxisID: 'right-y-axis',
|
|
908
|
-
fill: false,
|
|
1008
|
+
label: columnas[indiceColor],
|
|
1009
|
+
data: datos,
|
|
1010
|
+
borderColor: codigosColores[indiceColor],
|
|
1011
|
+
backgroundColor: codigosColores[indiceColor], //BARRAS y AREA
|
|
1012
|
+
borderWidth: 2,
|
|
1013
|
+
lineTension: 0, //linea y area
|
|
909
1014
|
};
|
|
1015
|
+
} else if (opt.tipoGrafico == 'Mixed'){
|
|
1016
|
+
var tipo = tipoGraficosMixed[indiceMixed];
|
|
1017
|
+
//construyo datasets
|
|
1018
|
+
if (tipo == 'barra') {
|
|
1019
|
+
var dataset = {
|
|
1020
|
+
label: columnas[indiceColor],
|
|
1021
|
+
data: datos,
|
|
1022
|
+
backgroundColor: codigosColores[indiceColor],
|
|
1023
|
+
// This binds the dataset to the left y axis
|
|
1024
|
+
yAxisID: 'left-y-axis',
|
|
1025
|
+
type: 'bar',
|
|
1026
|
+
};
|
|
1027
|
+
} else if (tipo == 'linea'){
|
|
1028
|
+
var dataset = {
|
|
1029
|
+
label: columnas[indiceColor],
|
|
1030
|
+
data: datos,
|
|
1031
|
+
borderColor: codigosColores[indiceColor],
|
|
1032
|
+
backgroundColor: codigosColores[indiceColor],
|
|
1033
|
+
// Changes this dataset to become a line
|
|
1034
|
+
type: 'line',
|
|
1035
|
+
// This binds the dataset to the right y axis
|
|
1036
|
+
yAxisID: 'right-y-axis',
|
|
1037
|
+
fill: false,
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
910
1040
|
}
|
|
911
|
-
}
|
|
912
|
-
|
|
913
1041
|
|
|
914
|
-
datasets.push(dataset);
|
|
915
1042
|
|
|
916
|
-
|
|
1043
|
+
datasets.push(dataset);
|
|
917
1044
|
|
|
918
|
-
|
|
1045
|
+
indiceColor = indiceColor + 1;
|
|
919
1046
|
|
|
920
|
-
|
|
921
|
-
});
|
|
1047
|
+
indiceMixed = indiceMixed + 1;
|
|
922
1048
|
|
|
923
|
-
if (tipoGrafico == 'mixed') {
|
|
924
|
-
if (porcentajesMixed.length == 2) {
|
|
925
|
-
indicePorcentajeMixed = 2; //los 2 dataset usan porcentaje
|
|
926
|
-
} else if (porcentajesMixed.length == 1){
|
|
927
|
-
if (porcentajesMixed[0] == 'eje-y1') {
|
|
928
|
-
indicePorcentajeMixed = 0; //solo el primer dataset usa porcentaje
|
|
929
|
-
} else if (porcentajesMixed[0] == 'eje-y2') {
|
|
930
|
-
indicePorcentajeMixed = 1; //solo el segundo dataset usa porcentaje
|
|
931
1049
|
}
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
console.log('etiquetas --> ' + etiquetas);
|
|
1050
|
+
});
|
|
936
1051
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1052
|
+
if (tipoGrafico == 'mixed') {
|
|
1053
|
+
if (porcentajesMixed.length == 2) {
|
|
1054
|
+
indicePorcentajeMixed = 2; //los 2 dataset usan porcentaje
|
|
1055
|
+
} else if (porcentajesMixed.length == 1){
|
|
1056
|
+
if (porcentajesMixed[0] == 'eje-y1') {
|
|
1057
|
+
indicePorcentajeMixed = 0; //solo el primer dataset usa porcentaje
|
|
1058
|
+
} else if (porcentajesMixed[0] == 'eje-y2') {
|
|
1059
|
+
indicePorcentajeMixed = 1; //solo el segundo dataset usa porcentaje
|
|
1060
|
+
}
|
|
1061
|
+
} else indicePorcentajeMixed = 3; //ningun dataset usa escala de porcentaje
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
console.log('etiquetas --> ' + etiquetas);
|
|
940
1065
|
|
|
1066
|
+
if (opt.tipoGrafico == 'Stacked Bar') graficoComplejoStacked(etiquetas, tipoGrafico, datasets, opt.idComponenteGrafico, opt.ejeYenCero, posicionLeyendas, toltips, mostrarLeyendas);
|
|
1067
|
+
else if (opt.tipoGrafico == 'Mixed') graficoComplejoMixed(etiquetas, 'bar', datasets, opt.idComponenteGrafico, opt.ejeYenCero, posicionLeyendas, indicePorcentajeMixed, columnas[0], columnas[1], mostrarLeyendas);
|
|
1068
|
+
else if (opt.tipoGrafico == 'Horizontal Bar') graficoComplejoHorizontal(etiquetas, tipoGrafico, datasets, opt.idComponenteGrafico, opt.ejeYenCero, posicionLeyendas, toltips, mostrarLeyendas);
|
|
1069
|
+
else graficoComplejo(etiquetas, tipoGrafico, datasets, opt.idComponenteGrafico, opt.ejeYenCero, posicionLeyendas, toltips, mostrarLeyendas);
|
|
1070
|
+
}
|
|
941
1071
|
|
|
942
1072
|
}
|
|
943
1073
|
|
|
@@ -981,6 +1111,7 @@ function ponchoChart(opt) {
|
|
|
981
1111
|
if (tipo == 'Horizontal Bar') grafico = 'horizontalBar';
|
|
982
1112
|
if (tipo == 'Stacked Bar') grafico = 'bar';
|
|
983
1113
|
if (tipo == 'Mixed') grafico = 'mixed';
|
|
1114
|
+
if (tipo == 'HeatMap') grafico = 'heatmap';
|
|
984
1115
|
|
|
985
1116
|
return grafico;
|
|
986
1117
|
}
|
|
@@ -1067,13 +1198,13 @@ function ponchoChart(opt) {
|
|
|
1067
1198
|
codigoColor = '#d7df23';
|
|
1068
1199
|
break;
|
|
1069
1200
|
case 'verdejade':
|
|
1070
|
-
codigoColor = '#
|
|
1201
|
+
codigoColor = '#066';
|
|
1071
1202
|
break;
|
|
1072
1203
|
case 'verdealoe':
|
|
1073
|
-
codigoColor = '#
|
|
1204
|
+
codigoColor = '#4fbb73';
|
|
1074
1205
|
break;
|
|
1075
1206
|
case 'verdecemento':
|
|
1076
|
-
codigoColor = '#
|
|
1207
|
+
codigoColor = '#b4beba';
|
|
1077
1208
|
break;
|
|
1078
1209
|
default:
|
|
1079
1210
|
console.log('No existe color ' + color);
|
|
@@ -1174,6 +1305,40 @@ function ponchoChart(opt) {
|
|
|
1174
1305
|
});
|
|
1175
1306
|
}
|
|
1176
1307
|
|
|
1308
|
+
|
|
1309
|
+
function graficoBarraHorizontalSimple(etiquetas, datos, tipoGrafico, color, label, empiezaYenCero, idGrafico, posicionLeyendas, toltips, mostrarLeyendas) {
|
|
1310
|
+
const $grafica = document.getElementById(idGrafico);
|
|
1311
|
+
const dataset = {
|
|
1312
|
+
data: datos,
|
|
1313
|
+
borderColor: color,
|
|
1314
|
+
backgroundColor: color,
|
|
1315
|
+
borderWidth: 2,
|
|
1316
|
+
lineTension: 0,
|
|
1317
|
+
label: label,
|
|
1318
|
+
};
|
|
1319
|
+
new Chart($grafica, {
|
|
1320
|
+
type: tipoGrafico,
|
|
1321
|
+
data: {
|
|
1322
|
+
labels: etiquetas,
|
|
1323
|
+
datasets: [
|
|
1324
|
+
dataset,
|
|
1325
|
+
]
|
|
1326
|
+
},
|
|
1327
|
+
options: {
|
|
1328
|
+
legend: { display: mostrarLeyendas, position: posicionLeyendas },
|
|
1329
|
+
tooltips: toltips,
|
|
1330
|
+
responsive: true,
|
|
1331
|
+
scales: {
|
|
1332
|
+
xAxes: [{
|
|
1333
|
+
ticks: {
|
|
1334
|
+
beginAtZero: empiezaYenCero,
|
|
1335
|
+
}
|
|
1336
|
+
}]
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1177
1342
|
function graficoComplejo(etiquetas, tipoGrafico, datos, idGrafico, empiezaYenCero, posicionLeyendas, toltips, mostrarLeyendas) {
|
|
1178
1343
|
const $grafica = document.getElementById(idGrafico);
|
|
1179
1344
|
new Chart($grafica, {
|
|
@@ -1198,6 +1363,30 @@ function ponchoChart(opt) {
|
|
|
1198
1363
|
});
|
|
1199
1364
|
}
|
|
1200
1365
|
|
|
1366
|
+
function graficoComplejoHorizontal(etiquetas, tipoGrafico, datos, idGrafico, empiezaYenCero, posicionLeyendas, toltips, mostrarLeyendas) {
|
|
1367
|
+
const $grafica = document.getElementById(idGrafico);
|
|
1368
|
+
new Chart($grafica, {
|
|
1369
|
+
type: tipoGrafico,
|
|
1370
|
+
data: {
|
|
1371
|
+
labels: etiquetas,
|
|
1372
|
+
datasets: datos
|
|
1373
|
+
},
|
|
1374
|
+
options: {
|
|
1375
|
+
legend: { display: mostrarLeyendas, position: posicionLeyendas, labels: { textAlign: 'center' } },
|
|
1376
|
+
tooltips: toltips,
|
|
1377
|
+
responsive: true,
|
|
1378
|
+
maintainAspectRatio: true,
|
|
1379
|
+
scales: {
|
|
1380
|
+
xAxes: [{
|
|
1381
|
+
ticks: {
|
|
1382
|
+
beginAtZero: empiezaYenCero,
|
|
1383
|
+
}
|
|
1384
|
+
}],
|
|
1385
|
+
},
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1201
1390
|
|
|
1202
1391
|
function graficoComplejoStacked(etiquetas, tipoGrafico, datos, idGrafico, empiezaYenCero, posicionLeyendas, toltips, mostrarLeyendas) { //Stacked Bar
|
|
1203
1392
|
const $grafica = document.getElementById(idGrafico);
|
|
@@ -1290,6 +1479,72 @@ function ponchoChart(opt) {
|
|
|
1290
1479
|
});
|
|
1291
1480
|
}
|
|
1292
1481
|
|
|
1482
|
+
function graficoHeatMap(etiquetas, datos, idGrafico, labelsY, rango, labelX, labelY, labelValor, titulo, mostrarYaxis, posicionLeyendas, mostrarLeyendas) {
|
|
1483
|
+
|
|
1484
|
+
const $grafica = document.getElementById(idGrafico);
|
|
1485
|
+
|
|
1486
|
+
var options = {
|
|
1487
|
+
series: datos,
|
|
1488
|
+
chart: {
|
|
1489
|
+
height: 650,
|
|
1490
|
+
type: 'heatmap',
|
|
1491
|
+
},
|
|
1492
|
+
dataLabels: {
|
|
1493
|
+
enabled: false
|
|
1494
|
+
},
|
|
1495
|
+
title: {
|
|
1496
|
+
text: titulo
|
|
1497
|
+
},
|
|
1498
|
+
tooltip: {
|
|
1499
|
+
custom: function({series, seriesIndex, dataPointIndex, w}) {
|
|
1500
|
+
return '<div class="arrow_box">' +
|
|
1501
|
+
'<span>' + labelX + ": " + labelsY[seriesIndex] + '<br>' +
|
|
1502
|
+
labelY + ": " + w.globals.labels[dataPointIndex] + '<br>' +
|
|
1503
|
+
labelValor + ": " + series[seriesIndex][dataPointIndex] + '</span>' +
|
|
1504
|
+
'</div>'
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
plotOptions: {
|
|
1508
|
+
heatmap: {
|
|
1509
|
+
shadeIntensity: 0.5,
|
|
1510
|
+
radius: 0,
|
|
1511
|
+
useFillColorAsStroke: false,
|
|
1512
|
+
colorScale: {
|
|
1513
|
+
ranges: rango
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
yaxis: {
|
|
1518
|
+
show: mostrarYaxis,
|
|
1519
|
+
},
|
|
1520
|
+
legend: {
|
|
1521
|
+
show: mostrarLeyendas,
|
|
1522
|
+
position: posicionLeyendas,
|
|
1523
|
+
},
|
|
1524
|
+
responsive: [{
|
|
1525
|
+
breakpoint: 1000,
|
|
1526
|
+
options: {
|
|
1527
|
+
yaxis: {
|
|
1528
|
+
show: false,
|
|
1529
|
+
},
|
|
1530
|
+
legend: {
|
|
1531
|
+
show: mostrarLeyendas,
|
|
1532
|
+
position: "top",
|
|
1533
|
+
},
|
|
1534
|
+
},
|
|
1535
|
+
}]
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1538
|
+
var chart = new ApexCharts($grafica, options);
|
|
1539
|
+
chart.render();
|
|
1540
|
+
|
|
1541
|
+
const collection = document.getElementsByClassName("apexcharts-toolbar");
|
|
1542
|
+
for (let i = 0; i < collection.length; i++) {
|
|
1543
|
+
collection[i].style.display = "none";
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1293
1548
|
function graficaTitulo(idTag, titulo) {
|
|
1294
1549
|
if (document.getElementById(idTag)) {
|
|
1295
1550
|
document.getElementById(idTag).innerHTML = titulo;
|
|
@@ -1305,7 +1560,6 @@ function ponchoChart(opt) {
|
|
|
1305
1560
|
|
|
1306
1561
|
}
|
|
1307
1562
|
|
|
1308
|
-
|
|
1309
1563
|
//#####################################################################
|
|
1310
1564
|
//####################### GAPI LEGACY #################################
|
|
1311
1565
|
//#####################################################################
|
package/dist/js/poncho.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function ponchoTable(e){var a,o,t=[],r=[],n=[],i=[],s="",l=[],c="";function d(o){jQuery.getJSON(o,function(o){t=o.values,jQuery.each(Object.keys(t[0]),function(e,a){t[0][a]&&(r.push(t[0][a]),n.push(a),s+="<th>"+t[1][a]+"</th>",l.push(t[1][a]))}),jQuery("#ponchoTable caption").html(e.tituloTabla),jQuery("#ponchoTable thead tr").empty(),jQuery("#ponchoTable thead tr").append(s),jQuery.each(t,function(e,o){if(e>1){var n="",s="";jQuery.each(r,function(o,c){var d="",p=t[e][o];if(r[o].includes("btn-")&&p){var u=t[0][o].replace("btn-","").replace("-"," ");p='<a aria-label="'+u+'" class="btn btn-primary btn-sm margin-btn" target="_blank" href="'+p+'">'+u+"</a>"}if(r[o].includes("filtro-")&&p){a=o;var f=t[1][o];jQuery("#tituloFiltro").html(f),i.push(p)}if(r[o].includes("fecha-")&&p){var g=p.split("/");p='<span style="display:none;">'+new Date(g[2],g[1]-1,g[0]).toISOString().split("T")[0]+"</span>"+p}p||(p="",d="hidden-xs"),n+=p,p=(new showdown.Converter).makeHtml(p),s+='<td class="'+d+'" data-title="'+l[o]+'">'+p+"</td>"}),""!=n&&(c+="<tr>",c+=s,c+="</tr>")}}),jQuery.each(i.filter(function(e,a,o){return a===o.indexOf(e)}),function(e,a){jQuery("#ponchoTableFiltro").append("<option>"+a+"</option>")}),jQuery("#ponchoTable tbody").empty(),jQuery("#ponchoTableSearchCont").show(),jQuery("#ponchoTable tbody").append(c),jQuery("#ponchoTable").removeClass("state-loading"),function(){function o(e){return e.replace(/έ/g,"ε").replace(/[ύϋΰ]/g,"υ").replace(/ό/g,"ο").replace(/ώ/g,"ω").replace(/ά/g,"α").replace(/[ίϊΐ]/g,"ι").replace(/ή/g,"η").replace(/\n/g," ").replace(/[áÁ]/g,"a").replace(/[éÉ]/g,"e").replace(/[íÍ]/g,"i").replace(/[óÓ]/g,"o").replace(/[úÚ]/g,"u").replace(/ê/g,"e").replace(/î/g,"i").replace(/ô/g,"o").replace(/è/g,"e").replace(/ï/g,"i").replace(/ü/g,"u").replace(/ã/g,"a").replace(/õ/g,"o").replace(/ç/g,"c").replace(/ì/g,"i")}var t=jQuery.fn.DataTable.ext.type.search;t.string=function(e){return e?"string"==typeof e?o(e):e:""},t.html=function(e){return e?"string"==typeof e?o(e.replace(/<.*?>/g,"")):e:""},jQuery.isFunction(jQuery.fn.DataTable.ext.order.intl)&&(jQuery.fn.DataTable.ext.order.intl("es"),jQuery.fn.DataTable.ext.order.htmlIntl("es"));var r=jQuery("#ponchoTable").DataTable({lengthChange:!1,autoWidth:!1,pageLength:e.cantidadItems,columnDefs:[{type:"html-num",targets:e.tipoNumero},{targets:e.ocultarColumnas,visible:!1}],ordering:e.orden,order:[[e.ordenColumna-1,e.ordenTipo]],dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'i>><'row'<'col-sm-12'tr>><'row'<'col-md-offset-3 col-md-6 col-sm-offset-2 col-sm-8'p>>",language:{sProcessing:"Procesando...",sLengthMenu:"Mostrar _MENU_ registros",sZeroRecords:"No se encontraron resultados",sEmptyTable:"Ningún dato disponible en esta tabla",sInfo:"_TOTAL_ resultados",sInfoEmpty:"No hay resultados",sInfoFiltered:"",sInfoPostFix:"",sSearch:"Buscar:",sUrl:"",sInfoThousands:".",sLoadingRecords:"Cargando...",oPaginate:{sFirst:"<<",sLast:">>",sNext:">",sPrevious:"<"},oAria:{sSortAscending:": Activar para ordenar la columna de manera ascendente",sSortDescending:": Activar para ordenar la columna de manera descendente",paginate:{first:"Ir a la primera página",previous:"Ir a la página anterior",next:"Ir a la página siguiente",last:"Ir a la última página"}}}});jQuery(document).ready(function(){jQuery("#ponchoTableSearch").keyup(function(){r.search(jQuery.fn.DataTable.ext.type.search.string(this.value)).draw()})}),jQuery("#ponchoTable_filter").parent().parent().remove(),jQuery("#ponchoTableFiltro option").length>1&&jQuery("#ponchoTableFiltroCont").show();jQuery("#ponchoTableFiltro").on("change",function(){var e=jQuery.fn.DataTable.ext.type.search.string(jQuery(this).val());""!=e?r.column(a).every(function(){this.search(e?"^"+e+"$":"",!0,!1).draw()}):r.search("").columns().search("").draw()})}()})}jQuery.fn.DataTable.isDataTable("#ponchoTable")&&jQuery("#ponchoTable").DataTable().destroy(),e.jsonUrl?d(e.jsonUrl):(o=e.hojaNumero,jQuery.getJSON("https://sheets.googleapis.com/v4/spreadsheets/"+e.idSpread+"/?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",function(a){var t=a.sheets[o-1].properties.title;d("https://sheets.googleapis.com/v4/spreadsheets/"+e.idSpread+"/values/"+t+"?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY")}))}jQuery("#ponchoTable").addClass("state-loading");var opt={tipoMapa:"roadmap"};function ponchoMaps(e){var a,o={center:{lat:-39.6930895,lng:-57.2432742},zoom:5,mapTypeId:e.tipoMapa,styles:[{featureType:"administrative.country",stylers:[{visibility:"on"}]},{featureType:"poi",stylers:[{visibility:"off"}]}]},t=new google.maps.Map(document.getElementById("map"),o);jQuery.getJSON("https://spreadsheets.google.com/feeds/list/"+e.idSpreadheet+"/"+e.hojaNumero+"/public/values?alt=json",function(o){var r=["metricas.mod@gmail.com","modernizacion.ux@gmail.com","contenidosgobar@gmail.com"];jQuery.each(o.feed.author,function(e,a){-1==r.indexOf(a.email.$t)&&(jQuery("body").remove(),window.location.replace("http://www.argentina.gob.ar"))}),a=o.feed.entry;var n=[],i=[],s=['<?xml version="1.0"?>','<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="286.818px" height="396.798px" viewBox="63.14 8.15 286.818 396.798" enable-background="new 63.14 8.15 286.818 396.798" xml:space="preserve">','<path stroke="#FFF" stroke-width="10" fill="{{ color }}" d="M206.549,20.359L206.549,20.359c-74.459,0-134.584,60.126-134.584,134.584c0,25.961,8.293,50.751,19.832,71.122l87.71,151.801c5.499,9.916,16.586,14.874,27.043,14.874c10.458,0,21.003-4.958,27.043-14.874l87.71-151.711c11.629-20.373,19.832-44.712,19.832-71.124C341.133,80.574,281.008,20.359,206.549,20.359z M206.549,206.978c-33.804,0-61.41-27.606-61.41-61.41s27.606-61.41,61.41-61.41s61.41,27.606,61.41,61.41C267.959,179.484,240.353,206.978,206.549,206.978z"/>',"</svg>"].join("\n"),l={azul:{hex:"#0072BB"},verde:{hex:"#2E7D33"},rojo:{hex:"#C62828"},gris:{hex:"#707070"},fucsia:{hex:"#EC407A"},arandano:{hex:"#C2185B"},uva:{hex:"#6A1B99"},cielo:{hex:"#039BE5"},verdin:{hex:"#6EA100"},lima:{hex:"#CDDC39"},maiz:{hex:"#FFCE00"},tomate:{hex:"#EF5350"},"naranja oscuro":{hex:"#EF6C00"},"verde azulado":{hex:"#008388"}};jQuery.each(a,function(a,o){var r=o.gsx$color.$t.toLowerCase(),d=s.replace("{{ color }}",l[r].hex),p=new google.maps.LatLng(o.gsx$latitud.$t,o.gsx$longitud.$t),u=new google.maps.Marker({position:p,title:o.gsx$nombre.$t,icon:{url:"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(d),scaledSize:new google.maps.Size(40,40)},optimized:!1});n.push(u);var f="",g="",h="",b="",m="",v="";(""==o.gsx$provincia.$t&&""==o.gsx$localidad.$t||(m='<div class="separarGuiones"><i class="fa fa-map-marker"></i><span>'+o.gsx$direccion.$t+"</span><span>"+o.gsx$localidad.$t+"</span><span>"+o.gsx$provincia.$t+"</span></div>"),""!=o.gsx$telefono.$t&&(f="<div><i class='fa fa-phone'></i>"+o.gsx$telefono.$t+"</div>"),""!=o.gsx$email.$t&&(g="<div><i class='fa fa-envelope'></i>"+o.gsx$email.$t+"</div>"),""!=o.gsx$descripcion.$t)&&(b="<div>"+(new showdown.Converter).makeHtml(o.gsx$descripcion.$t)+"</div>");""!=o.gsx$boton.$t&&(h="<hr><a class='btn btn-success btn-sm' href="+o.gsx$boton.$t+">"+e.textoBoton+"</a>"),null!=o.gsx$foto&&(v='<img width="100%" src="'+o.gsx$foto.$t+'">'),i[a]=new google.maps.InfoWindow({content:'<div class="media"><div class="media-body"><small class="text-primary">'+o.gsx$tipo.$t+"</small><h4>"+o.gsx$nombre.$t+"</h4> "+v+b+m+f+g+h+"</div></div>",maxWidth:300}),n[a].addListener("click",function(){c(),i[a].open(t,n[a])}),jQuery("#map-container").removeClass("state-loading"),u.setMap(t)});var c=function(){for(var e=0;e<i.length;e++)i[e].close()};if("si"==e.agrupar)new MarkerClusterer(t,n,{enableRetinaIcons:!0,imageSizes:[20,30,40,50,60,70],maxZoom:10,gridSize:50,styles:[{textColor:"white",url:"https://www.argentina.gob.ar/sites/default/files/cluster_ponchomaps.png",width:45,height:45}]})})}var content_popover=document.getElementById("content-popover");function popshow(){content_popover.classList.toggle("hidden")}function pophidde(){content_popover.classList.add("hidden")}var ponchoUbicacion=function(e){var a,o,t,r,n="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geoprovincias.json",i="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geolocalidades.json",s=jQuery('input[name="submitted['+e.provincia+']"]'),l=jQuery('input[name="submitted['+e.localidad+']"]');function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e,a,o,t=!1,r=!1){var n=jQuery("<select></select>").attr("id",a).attr("name",e).addClass("form-control form-select").prop("required",t);return r&&n.append("<option value=''>Seleccione una opción</option>"),jQuery.each(o,function(e,a){n.append("<option value='"+a.id+"'>"+a.nombre+"</option>")}),n}function p(e,a){var o=l.prop("required"),t=d("sLocalidades","sLocalidades",[],o,!0);return a&&(t=d("sLocalidades","sLocalidades",e.filter(function(e){return String(e.provincia.id)==String(a)}).map(function(e){return e.departamento.nombre&&(e.nombre=c(e.departamento.nombre.toLowerCase())+" - "+c(e.nombre.toLowerCase())),e}).sort(function(e,a){var o=e.nombre.toUpperCase(),t=a.nombre.toUpperCase();return o.localeCompare(t)}),o)),t}n=e.urlProvincias?e.urlProvincias:n,i=e.urlLocalidades?e.urlLocalidades:i,jQuery.getJSON(n,function(e){a=function(e){return a=[],e.results.forEach(function(e,o){a.push(e)}),a}(e),(t=function(e){var a=[];a=e.sort(function(e,a){var o=e.nombre.toUpperCase(),t=a.nombre.toUpperCase();return o.localeCompare(t)});var o=s.prop("required");return d("sProvincias","sProvincias",a,o,!0)}(a)).on("change",function(e){if(s.val(""),l.val(""),r.children("option:not(:first)").remove(),""!=t.val()){s.val(t.find(":selected").text());var a=p(o,t.val()),n=a.find("option");r.append(n),r.val("")}}),s.after(t),jQuery(t).select2()}),jQuery.getJSON(i,function(e){o=function(e){return o=[],e.results.forEach(function(e,a){o.push(e)}),o}(e),(r=p(o,"")).on("change",function(e){l.val(""),""!=r.val()&&l.val(r.find(":selected").text())}),l.after(r),jQuery(r).select2()}),s.hide(),l.hide()};function ponchoChart(e){"use strict";var a=[],o=[],t=[],r="",n=[],i=[],s=[],l=[],c=[],d=0,p="",u=[],f=0,g=[],h=e.jsonUrl?e.jsonUrl:"https://sheets.googleapis.com/v4/spreadsheets/"+e.idSpread+"/values/"+e.hojaNombre+"?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",b=e.posicionLeyendas?e.posicionLeyendas:"top",m="";m=void 0===e.mostrarLeyendas||e.mostrarLeyendas;var v=function(e){var a="";"Line"==e&&(a="line");"Bar"==e&&(a="bar");"Pie"==e&&(a="pie");"Area"==e&&(a="line");"Horizontal Bar"==e&&(a="horizontalBar");"Stacked Bar"==e&&(a="bar");"Mixed"==e&&(a="mixed");return a}(e.tipoGrafico);function y(e){var a="";switch(e){case"celeste":a="#2897d4";break;case"verde":a="#2e7d33";break;case"rojo":a="#c62828";break;case"amarillo":a="#f9a822";break;case"azul":a="#0072bb";break;case"negro":a="#333";break;case"uva":a="#6a1b99";break;case"gris":a="#525252";break;case"grisintermedio":a="#f2f2f2";break;case"celesteargentina":a="#37bbed";break;case"fucsia":a="#ec407a";break;case"arandano":a="#c2185b";break;case"uva":a="#6a1b99";break;case"cielo":a="#039be5";break;case"verdin":a="#6ea100";break;case"lima":a="#cddc39";break;case"maíz":a="#ffce00";break;case"tomate":a="#ef5350";break;case"naranjaoscuro":a="#EF6C00";break;case"verdeazulado":a="#008388";break;case"escarapela":a="#2cb9ee";break;case"lavanda":a="#9284be";break;case"mandarina":a="#f79525";break;case"palta":a="#50b7b2";break;case"cereza":a="#ed3d8f";break;case"limon":case"verdejade":case"verdealoe":case"verdecemento":a="#d7df23";break;default:console.log("No existe color "+e)}return a}!function(){var a=!1;(e.idSpread&&e.hojaNombre||e.jsonUrl)&&void 0!==e.tipoGrafico&&""!=e.tipoGrafico&&void 0!==e.idComponenteGrafico&&""!=e.idComponenteGrafico&&""!=v&&(a=!0);return a}()?(void 0!==e.idSpread&&""!=e.idSpread||console.log("Completar valor para la opción de Configuración idSpread"),void 0!==e.hojaNombre&&""!=e.hojaNombre||console.log("Completar valor para la opción de Configuración hojaNombre"),void 0!==e.tipoGrafico&&""!=e.tipoGrafico||console.log("Completar valor para la opción de Configuración tipoGrafico"),void 0!==e.idComponenteGrafico&&""!=e.idComponenteGrafico||console.log("Completar valor para la opción de Configuración idComponenteGrafico"),""==v&&console.log("Ingrese un tipo de gafico válido")):jQuery.getJSON(h,function(h){var x,j,C=h.values;if(jQuery.each(Object.keys(C[0]),function(e,a){if("eje-y"==C[0][e].substr(0,5)){var r=C[0][e].split("-"),n=r[0]+r[1];o.push(n),t.push(e)}}),jQuery.each(C,function(e,o){if(0==e&&jQuery.each(t,function(a,o){var r=C[e][t[a]].split("-"),i=r[0]+r[1];l[i]=[],n.push(r[2]),"mixed"==v&&(r.length>3&&("barra"==r[3]||"linea"==r[3])?u.push(r[3]):(0==a&&u.push("barra"),1==a&&u.push("linea")))}),1==e&&jQuery.each(t,function(o,r){"pie"!=v?(s.push(C[e][t[o]]),d+=1):a.push(C[e][t[o]])}),e>1){var r=!1;jQuery.each(t,function(o,n){var i=C[0][t[o]].split("-"),s=i[0]+i[1];"pie"==v?l[s].push(C[e][t[o]]):(0==r&&(a.push(C[e][0]),r=!0),l[s].push(C[e][t[o]]))})}}),"pie"==v){var k=[];jQuery.each(Object.keys(o),function(e,a){var t=o[e];l.hasOwnProperty(t)&&k.push(l[t])}),c=k}else 1==d&&jQuery.each(Object.keys(o),function(e,a){var t=o[e];l.hasOwnProperty(t)&&(c=l[t])});if("mixed"==v){var w=e.porcentajesMixed?e.porcentajesMixed:"";w.length>0&&(g=w.split(","))}if(p=1==e.porcentajes?"line"==v&&d>1?{enabled:!0,callbacks:{label:function(e,a){return a.datasets[e.datasetIndex].label+": "+a.datasets[e.datasetIndex].data[e.index]+"%"}},mode:"index",intersect:!1}:{enabled:!0,callbacks:{label:function(e,a){return a.datasets[e.datasetIndex].label+": "+a.datasets[e.datasetIndex].data[e.index]+"%"}}}:"line"==v&&d>1?{enabled:!0,mode:"index",intersect:!1}:{enabled:!0},"pie"==v&&(n.forEach(function(e,a,o){i.push(y(e))}),console.log("etiquetas --\x3e "+a),console.log("datos --\x3e "+c),console.log("colores --\x3e "+i),function(e,a,o,t,r,n,i,s){const l=document.getElementById(r);new Chart(l,{type:o,data:{labels:e,datasets:[{data:a,borderColor:t,backgroundColor:t,borderWidth:2}]},options:{legend:{display:s,position:n},responsive:!0,tooltips:i}})}(a,c,v,i,e.idComponenteGrafico,b,p,m)),1==d&&(console.log("etiquetas --\x3e "+a),console.log("datos --\x3e "+c),r=y(n[0]),console.log("color --\x3e "+r),"Line"==e.tipoGrafico&&function(e,a,o,t,r,n,i,s,l,c){const d=document.getElementById(i);new Chart(d,{type:o,data:{labels:e,datasets:[{data:a,borderColor:t,borderWidth:2,lineTension:0,fill:!1,label:r}]},options:{legend:{display:c,position:s},tooltips:l,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:n}}]}}})}(a,c,v,r,s[0],e.ejeYenCero,e.idComponenteGrafico,b,p,m),"bar"!=v&&"Area"!=e.tipoGrafico&&"horizontalBar"!=v||function(e,a,o,t,r,n,i,s,l,c){const d=document.getElementById(i);new Chart(d,{type:o,data:{labels:e,datasets:[{data:a,borderColor:t,backgroundColor:t,borderWidth:2,lineTension:0,label:r}]},options:{legend:{display:c,position:s},tooltips:l,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:n}}]}}})}(a,c,v,r,s[0],e.ejeYenCero,e.idComponenteGrafico,b,p,m)),d>1){var Q=[],T=0;n.forEach(function(e,a,o){i.push(y(e))}),console.log("colores --\x3e "+i);var $=0;jQuery.each(Object.keys(o),function(a,t){var r=o[a];if(l.hasOwnProperty(r)){if(c=l[r],console.log("datos --\x3e "+c),"Line"==e.tipoGrafico)var n={label:s[T],data:c,borderColor:i[T],fill:!1,borderWidth:2,lineTension:0,backgroundColor:i[T]};else if("Bar"==e.tipoGrafico||"Area"==e.tipoGrafico||"Horizontal Bar"==e.tipoGrafico||"Stacked Bar"==e.tipoGrafico)n={label:s[T],data:c,borderColor:i[T],backgroundColor:i[T],borderWidth:2,lineTension:0};else if("Mixed"==e.tipoGrafico){var d=u[$];if("barra"==d)n={label:s[T],data:c,backgroundColor:i[T],yAxisID:"left-y-axis",type:"bar"};else if("linea"==d)n={label:s[T],data:c,borderColor:i[T],backgroundColor:i[T],type:"line",yAxisID:"right-y-axis",fill:!1}}Q.push(n),T+=1,$+=1}}),"mixed"==v&&(2==g.length?f=2:1==g.length?"eje-y1"==g[0]?f=0:"eje-y2"==g[0]&&(f=1):f=3),console.log("etiquetas --\x3e "+a),"Stacked Bar"==e.tipoGrafico?function(e,a,o,t,r,n,i,s){const l=document.getElementById(t);new Chart(l,{type:a,data:{labels:e,datasets:o},options:{legend:{display:s,position:n,labels:{textAlign:"center"}},tooltips:i,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:r},stacked:!0}],xAxes:[{stacked:!0}]}}})}(a,v,Q,e.idComponenteGrafico,e.ejeYenCero,b,p,m):"Mixed"==e.tipoGrafico?function(e,a,o,t,r,n,i,s,l,c){const d=document.getElementById(t);new Chart(d,{type:a,data:{labels:e,datasets:o},options:{legend:{display:c,position:n,labels:{textAlign:"center"}},tooltips:{enabled:!0,mode:"single",callbacks:{label:function(e,a){var o="";return 2==i?o="%":e.datasetIndex==i&&(o="%"),a.datasets[e.datasetIndex].label+": "+e.yLabel+" "+o}}},responsive:!0,scales:{yAxes:[{id:"left-y-axis",type:"linear",position:"left",ticks:{beginAtZero:r,callback:function(e){var a="";return 1!=i&&2!=i||(a="%"),e+a}},scaleLabel:{display:!0,labelString:l,fontColor:"black"}},{id:"right-y-axis",type:"linear",position:"right",ticks:{beginAtZero:r,callback:function(e){var a="";return 0!=i&&2!=i||(a="%"),e+a}},scaleLabel:{display:!0,labelString:s,fontColor:"black"}}]}}})}(a,"bar",Q,e.idComponenteGrafico,e.ejeYenCero,b,f,s[0],s[1],m):function(e,a,o,t,r,n,i,s){const l=document.getElementById(t);new Chart(l,{type:a,data:{labels:e,datasets:o},options:{legend:{display:s,position:n,labels:{textAlign:"center"}},tooltips:i,responsive:!0,maintainAspectRatio:!0,scales:{yAxes:[{ticks:{beginAtZero:r}}]}}})}(a,v,Q,e.idComponenteGrafico,e.ejeYenCero,b,p,m)}""!=e.tituloGrafico&&void 0!==e.tituloGrafico&&(x=e.idTagTituloGrafico,j=e.tituloGrafico,document.getElementById(x)&&(document.getElementById(x).innerHTML=j))})}function gapi_legacy(e){const a=e.values[0],o=/ |\/|_/gi;let t=[];return e.values.forEach((e,r)=>{if(r>0){let r={};for(var n in a){var i=e.hasOwnProperty(n)?e[n].trim():"";r[`gsx$${a[n].toLowerCase().replace(o,"")}`]={$t:i}}t.push(r)}}),{feed:{entry:t}}}
|
|
1
|
+
function ponchoTable(e){var a,o,t=[],r=[],n=[],s=[],i="",l=[],c="";function d(o){jQuery.getJSON(o,function(o){t=o.values,jQuery.each(Object.keys(t[0]),function(e,a){t[0][a]&&(r.push(t[0][a]),n.push(a),i+="<th>"+t[1][a]+"</th>",l.push(t[1][a]))}),jQuery("#ponchoTable caption").html(e.tituloTabla),jQuery("#ponchoTable thead tr").empty(),jQuery("#ponchoTable thead tr").append(i),jQuery.each(t,function(e,o){if(e>1){var n="",i="";jQuery.each(r,function(o,c){var d="",p=t[e][o];if(r[o].includes("btn-")&&p){var u=t[0][o].replace("btn-","").replace("-"," ");p='<a aria-label="'+u+'" class="btn btn-primary btn-sm margin-btn" target="_blank" href="'+p+'">'+u+"</a>"}if(r[o].includes("filtro-")&&p){a=o;var h=t[1][o];jQuery("#tituloFiltro").html(h),s.push(p)}if(r[o].includes("fecha-")&&p){var g=p.split("/");p='<span style="display:none;">'+new Date(g[2],g[1]-1,g[0]).toISOString().split("T")[0]+"</span>"+p}p||(p="",d="hidden-xs"),n+=p,p=(new showdown.Converter).makeHtml(p),i+='<td class="'+d+'" data-title="'+l[o]+'">'+p+"</td>"}),""!=n&&(c+="<tr>",c+=i,c+="</tr>")}}),jQuery.each(s.filter(function(e,a,o){return a===o.indexOf(e)}),function(e,a){jQuery("#ponchoTableFiltro").append("<option>"+a+"</option>")}),jQuery("#ponchoTable tbody").empty(),jQuery("#ponchoTableSearchCont").show(),jQuery("#ponchoTable tbody").append(c),jQuery("#ponchoTable").removeClass("state-loading"),function(){function o(e){return e.replace(/έ/g,"ε").replace(/[ύϋΰ]/g,"υ").replace(/ό/g,"ο").replace(/ώ/g,"ω").replace(/ά/g,"α").replace(/[ίϊΐ]/g,"ι").replace(/ή/g,"η").replace(/\n/g," ").replace(/[áÁ]/g,"a").replace(/[éÉ]/g,"e").replace(/[íÍ]/g,"i").replace(/[óÓ]/g,"o").replace(/[úÚ]/g,"u").replace(/ê/g,"e").replace(/î/g,"i").replace(/ô/g,"o").replace(/è/g,"e").replace(/ï/g,"i").replace(/ü/g,"u").replace(/ã/g,"a").replace(/õ/g,"o").replace(/ç/g,"c").replace(/ì/g,"i")}var t=jQuery.fn.DataTable.ext.type.search;t.string=function(e){return e?"string"==typeof e?o(e):e:""},t.html=function(e){return e?"string"==typeof e?o(e.replace(/<.*?>/g,"")):e:""},jQuery.isFunction(jQuery.fn.DataTable.ext.order.intl)&&(jQuery.fn.DataTable.ext.order.intl("es"),jQuery.fn.DataTable.ext.order.htmlIntl("es"));var r=jQuery("#ponchoTable").DataTable({lengthChange:!1,autoWidth:!1,pageLength:e.cantidadItems,columnDefs:[{type:"html-num",targets:e.tipoNumero},{targets:e.ocultarColumnas,visible:!1}],ordering:e.orden,order:[[e.ordenColumna-1,e.ordenTipo]],dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'i>><'row'<'col-sm-12'tr>><'row'<'col-md-offset-3 col-md-6 col-sm-offset-2 col-sm-8'p>>",language:{sProcessing:"Procesando...",sLengthMenu:"Mostrar _MENU_ registros",sZeroRecords:"No se encontraron resultados",sEmptyTable:"Ningún dato disponible en esta tabla",sInfo:"_TOTAL_ resultados",sInfoEmpty:"No hay resultados",sInfoFiltered:"",sInfoPostFix:"",sSearch:"Buscar:",sUrl:"",sInfoThousands:".",sLoadingRecords:"Cargando...",oPaginate:{sFirst:"<<",sLast:">>",sNext:">",sPrevious:"<"},oAria:{sSortAscending:": Activar para ordenar la columna de manera ascendente",sSortDescending:": Activar para ordenar la columna de manera descendente",paginate:{first:"Ir a la primera página",previous:"Ir a la página anterior",next:"Ir a la página siguiente",last:"Ir a la última página"}}}});jQuery(document).ready(function(){jQuery("#ponchoTableSearch").keyup(function(){r.search(jQuery.fn.DataTable.ext.type.search.string(this.value)).draw()})}),jQuery("#ponchoTable_filter").parent().parent().remove(),jQuery("#ponchoTableFiltro option").length>1&&jQuery("#ponchoTableFiltroCont").show();jQuery("#ponchoTableFiltro").on("change",function(){var e=jQuery.fn.DataTable.ext.type.search.string(jQuery(this).val());""!=e?r.column(a).every(function(){this.search(e?"^"+e+"$":"",!0,!1).draw()}):r.search("").columns().search("").draw()})}()})}jQuery.fn.DataTable.isDataTable("#ponchoTable")&&jQuery("#ponchoTable").DataTable().destroy(),e.jsonUrl?d(e.jsonUrl):(o=e.hojaNumero,jQuery.getJSON("https://sheets.googleapis.com/v4/spreadsheets/"+e.idSpread+"/?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",function(a){var t=a.sheets[o-1].properties.title;d("https://sheets.googleapis.com/v4/spreadsheets/"+e.idSpread+"/values/"+t+"?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY")}))}jQuery("#ponchoTable").addClass("state-loading");var opt={tipoMapa:"roadmap"};function ponchoMaps(e){var a,o={center:{lat:-39.6930895,lng:-57.2432742},zoom:5,mapTypeId:e.tipoMapa,styles:[{featureType:"administrative.country",stylers:[{visibility:"on"}]},{featureType:"poi",stylers:[{visibility:"off"}]}]},t=new google.maps.Map(document.getElementById("map"),o);jQuery.getJSON("https://spreadsheets.google.com/feeds/list/"+e.idSpreadheet+"/"+e.hojaNumero+"/public/values?alt=json",function(o){var r=["metricas.mod@gmail.com","modernizacion.ux@gmail.com","contenidosgobar@gmail.com"];jQuery.each(o.feed.author,function(e,a){-1==r.indexOf(a.email.$t)&&(jQuery("body").remove(),window.location.replace("http://www.argentina.gob.ar"))}),a=o.feed.entry;var n=[],s=[],i=['<?xml version="1.0"?>','<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="286.818px" height="396.798px" viewBox="63.14 8.15 286.818 396.798" enable-background="new 63.14 8.15 286.818 396.798" xml:space="preserve">','<path stroke="#FFF" stroke-width="10" fill="{{ color }}" d="M206.549,20.359L206.549,20.359c-74.459,0-134.584,60.126-134.584,134.584c0,25.961,8.293,50.751,19.832,71.122l87.71,151.801c5.499,9.916,16.586,14.874,27.043,14.874c10.458,0,21.003-4.958,27.043-14.874l87.71-151.711c11.629-20.373,19.832-44.712,19.832-71.124C341.133,80.574,281.008,20.359,206.549,20.359z M206.549,206.978c-33.804,0-61.41-27.606-61.41-61.41s27.606-61.41,61.41-61.41s61.41,27.606,61.41,61.41C267.959,179.484,240.353,206.978,206.549,206.978z"/>',"</svg>"].join("\n"),l={azul:{hex:"#0072BB"},verde:{hex:"#2E7D33"},rojo:{hex:"#C62828"},gris:{hex:"#707070"},fucsia:{hex:"#EC407A"},arandano:{hex:"#C2185B"},uva:{hex:"#6A1B99"},cielo:{hex:"#039BE5"},verdin:{hex:"#6EA100"},lima:{hex:"#CDDC39"},maiz:{hex:"#FFCE00"},tomate:{hex:"#EF5350"},"naranja oscuro":{hex:"#EF6C00"},"verde azulado":{hex:"#008388"}};jQuery.each(a,function(a,o){var r=o.gsx$color.$t.toLowerCase(),d=i.replace("{{ color }}",l[r].hex),p=new google.maps.LatLng(o.gsx$latitud.$t,o.gsx$longitud.$t),u=new google.maps.Marker({position:p,title:o.gsx$nombre.$t,icon:{url:"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(d),scaledSize:new google.maps.Size(40,40)},optimized:!1});n.push(u);var h="",g="",b="",f="",m="",v="";(""==o.gsx$provincia.$t&&""==o.gsx$localidad.$t||(m='<div class="separarGuiones"><i class="fa fa-map-marker"></i><span>'+o.gsx$direccion.$t+"</span><span>"+o.gsx$localidad.$t+"</span><span>"+o.gsx$provincia.$t+"</span></div>"),""!=o.gsx$telefono.$t&&(h="<div><i class='fa fa-phone'></i>"+o.gsx$telefono.$t+"</div>"),""!=o.gsx$email.$t&&(g="<div><i class='fa fa-envelope'></i>"+o.gsx$email.$t+"</div>"),""!=o.gsx$descripcion.$t)&&(f="<div>"+(new showdown.Converter).makeHtml(o.gsx$descripcion.$t)+"</div>");""!=o.gsx$boton.$t&&(b="<hr><a class='btn btn-success btn-sm' href="+o.gsx$boton.$t+">"+e.textoBoton+"</a>"),null!=o.gsx$foto&&(v='<img width="100%" src="'+o.gsx$foto.$t+'">'),s[a]=new google.maps.InfoWindow({content:'<div class="media"><div class="media-body"><small class="text-primary">'+o.gsx$tipo.$t+"</small><h4>"+o.gsx$nombre.$t+"</h4> "+v+f+m+h+g+b+"</div></div>",maxWidth:300}),n[a].addListener("click",function(){c(),s[a].open(t,n[a])}),jQuery("#map-container").removeClass("state-loading"),u.setMap(t)});var c=function(){for(var e=0;e<s.length;e++)s[e].close()};if("si"==e.agrupar)new MarkerClusterer(t,n,{enableRetinaIcons:!0,imageSizes:[20,30,40,50,60,70],maxZoom:10,gridSize:50,styles:[{textColor:"white",url:"https://www.argentina.gob.ar/sites/default/files/cluster_ponchomaps.png",width:45,height:45}]})})}var content_popover=document.getElementById("content-popover");function popshow(){content_popover.classList.toggle("hidden")}function pophidde(){content_popover.classList.add("hidden")}var ponchoUbicacion=function(e){var a,o,t,r,n="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geoprovincias.json",s="/profiles/argentinagobar/themes/contrib/poncho/resources/jsons/geolocalidades.json",i=jQuery('input[name="submitted['+e.provincia+']"]'),l=jQuery('input[name="submitted['+e.localidad+']"]');function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e,a,o,t=!1,r=!1){var n=jQuery("<select></select>").attr("id",a).attr("name",e).addClass("form-control form-select").prop("required",t);return r&&n.append("<option value=''>Seleccione una opción</option>"),jQuery.each(o,function(e,a){n.append("<option value='"+a.id+"'>"+a.nombre+"</option>")}),n}function p(e,a){var o=l.prop("required"),t=d("sLocalidades","sLocalidades",[],o,!0);return a&&(t=d("sLocalidades","sLocalidades",e.filter(function(e){return String(e.provincia.id)==String(a)}).map(function(e){return e.departamento.nombre&&(e.nombre=c(e.departamento.nombre.toLowerCase())+" - "+c(e.nombre.toLowerCase())),e}).sort(function(e,a){var o=e.nombre.toUpperCase(),t=a.nombre.toUpperCase();return o.localeCompare(t)}),o)),t}n=e.urlProvincias?e.urlProvincias:n,s=e.urlLocalidades?e.urlLocalidades:s,jQuery.getJSON(n,function(e){a=function(e){return a=[],e.results.forEach(function(e,o){a.push(e)}),a}(e),(t=function(e){var a=[];a=e.sort(function(e,a){var o=e.nombre.toUpperCase(),t=a.nombre.toUpperCase();return o.localeCompare(t)});var o=i.prop("required");return d("sProvincias","sProvincias",a,o,!0)}(a)).on("change",function(e){if(i.val(""),l.val(""),r.children("option:not(:first)").remove(),""!=t.val()){i.val(t.find(":selected").text());var a=p(o,t.val()),n=a.find("option");r.append(n),r.val("")}}),i.after(t),jQuery(t).select2()}),jQuery.getJSON(s,function(e){o=function(e){return o=[],e.results.forEach(function(e,a){o.push(e)}),o}(e),(r=p(o,"")).on("change",function(e){l.val(""),""!=r.val()&&l.val(r.find(":selected").text())}),l.after(r),jQuery(r).select2()}),i.hide(),l.hide()};function ponchoChart(e){"use strict";var a=[],o=[],t=[],r="",n=[],s=[],i=[],l=[],c=0,d="",p=[],u=0,h=[],g=[],b=0,f=e.jsonUrl?e.jsonUrl:"https://sheets.googleapis.com/v4/spreadsheets/"+e.idSpread+"/values/"+e.hojaNombre+"?alt=json&key=AIzaSyCq2wEEKL9-6RmX-TkW23qJsrmnFHFf5tY",m=e.posicionLeyendas?e.posicionLeyendas:"top",v="";v=void 0===e.mostrarLeyendas||e.mostrarLeyendas;var y=function(e){var a="";"Line"==e&&(a="line");"Bar"==e&&(a="bar");"Pie"==e&&(a="pie");"Area"==e&&(a="line");"Horizontal Bar"==e&&(a="horizontalBar");"Stacked Bar"==e&&(a="bar");"Mixed"==e&&(a="mixed");"HeatMap"==e&&(a="heatmap");return a}(e.tipoGrafico);function x(e){var a="";switch(e){case"celeste":a="#2897d4";break;case"verde":a="#2e7d33";break;case"rojo":a="#c62828";break;case"amarillo":a="#f9a822";break;case"azul":a="#0072bb";break;case"negro":a="#333";break;case"uva":a="#6a1b99";break;case"gris":a="#525252";break;case"grisintermedio":a="#f2f2f2";break;case"celesteargentina":a="#37bbed";break;case"fucsia":a="#ec407a";break;case"arandano":a="#c2185b";break;case"uva":a="#6a1b99";break;case"cielo":a="#039be5";break;case"verdin":a="#6ea100";break;case"lima":a="#cddc39";break;case"maíz":a="#ffce00";break;case"tomate":a="#ef5350";break;case"naranjaoscuro":a="#EF6C00";break;case"verdeazulado":a="#008388";break;case"escarapela":a="#2cb9ee";break;case"lavanda":a="#9284be";break;case"mandarina":a="#f79525";break;case"palta":a="#50b7b2";break;case"cereza":a="#ed3d8f";break;case"limon":a="#d7df23";break;case"verdejade":a="#066";break;case"verdealoe":a="#4fbb73";break;case"verdecemento":a="#b4beba";break;default:console.log("No existe color "+e)}return a}!function(){var a=!1;(e.idSpread&&e.hojaNombre||e.jsonUrl)&&void 0!==e.tipoGrafico&&""!=e.tipoGrafico&&void 0!==e.idComponenteGrafico&&""!=e.idComponenteGrafico&&""!=y&&(a=!0);return a}()?(void 0!==e.idSpread&&""!=e.idSpread||console.log("Completar valor para la opción de Configuración idSpread"),void 0!==e.hojaNombre&&""!=e.hojaNombre||console.log("Completar valor para la opción de Configuración hojaNombre"),void 0!==e.tipoGrafico&&""!=e.tipoGrafico||console.log("Completar valor para la opción de Configuración tipoGrafico"),void 0!==e.idComponenteGrafico&&""!=e.idComponenteGrafico||console.log("Completar valor para la opción de Configuración idComponenteGrafico"),""==y&&console.log("Ingrese un tipo de gafico válido")):jQuery.getJSON(f,function(f){var C,j,k=f.values;if(jQuery.each(Object.keys(k[0]),function(e,a){if("eje-y"==k[0][e].substr(0,5)){var r=k[0][e].split("-"),n=r[0]+r[1];o.push(n),t.push(e)}else"nombre-corto"==k[0][e]&&"heatmap"==y&&(b=e)}),jQuery.each(k,function(e,o){if(0==e&&jQuery.each(t,function(a,o){var r=k[e][t[a]].split("-"),s=r[0]+r[1];l[s]=[],n.push(r[2]),"mixed"==y&&(r.length>3&&("barra"==r[3]||"linea"==r[3])?p.push(r[3]):(0==a&&p.push("barra"),1==a&&p.push("linea")))}),1==e&&jQuery.each(t,function(o,r){"pie"!=y?"heatmap"==y?a.push(k[e][t[o]]):(i.push(k[e][t[o]]),c+=1):a.push(k[e][t[o]])}),e>1){var r=!1;jQuery.each(t,function(o,n){var s=k[0][t[o]].split("-"),d=s[0]+s[1];"pie"==y?l[d].push(k[e][t[o]]):"heatmap"==y?(0==r&&(i.push(k[e][0]),r=!0,c+=1),o!=b&&l[d].push(k[e][t[o]]),o+2==b&&(void 0===k[e][o+2]?g.push("*"):g.push(k[e][o+2]))):(0==r&&(a.push(k[e][0]),r=!0),l[d].push(k[e][t[o]]))})}}),"pie"==y){var w=[];jQuery.each(Object.keys(o),function(e,a){var t=o[e];l.hasOwnProperty(t)&&w.push(l[t])}),L=w}else 1==c&&jQuery.each(Object.keys(o),function(e,a){var t=o[e];l.hasOwnProperty(t)&&(L=l[t])});if("mixed"==y){var T=e.porcentajesMixed?e.porcentajesMixed:"";T.length>0&&(h=T.split(","))}if(d=1==e.porcentajes?"line"==y&&c>1?{enabled:!0,callbacks:{label:function(e,a){return a.datasets[e.datasetIndex].label+": "+a.datasets[e.datasetIndex].data[e.index]+"%"}},mode:"index",intersect:!1}:"pie"==y?{enabled:!0,callbacks:{label:function(e,a){return a.labels[e.index]+": "+a.datasets[e.datasetIndex].data[e.index]+"%"}}}:{enabled:!0,callbacks:{label:function(e,a){return a.datasets[e.datasetIndex].label+": "+a.datasets[e.datasetIndex].data[e.index]+"%"}}}:"line"==y&&c>1?{enabled:!0,mode:"index",intersect:!1}:{enabled:!0},"pie"==y&&(n.forEach(function(e,a,o){s.push(x(e))}),console.log("etiquetas --\x3e "+a),console.log("datos --\x3e "+L),console.log("colores --\x3e "+s),function(e,a,o,t,r,n,s,i){const l=document.getElementById(r);new Chart(l,{type:o,data:{labels:e,datasets:[{data:a,borderColor:t,backgroundColor:t,borderWidth:2}]},options:{legend:{display:i,position:n},responsive:!0,tooltips:s}})}(a,L,y,s,e.idComponenteGrafico,m,d,v)),1==c&&(console.log("etiquetas --\x3e "+a),console.log("datos --\x3e "+L),r=x(n[0]),console.log("color --\x3e "+r),"Line"==e.tipoGrafico&&function(e,a,o,t,r,n,s,i,l,c){const d=document.getElementById(s);new Chart(d,{type:o,data:{labels:e,datasets:[{data:a,borderColor:t,borderWidth:2,lineTension:0,fill:!1,label:r}]},options:{legend:{display:c,position:i},tooltips:l,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:n}}]}}})}(a,L,y,r,i[0],e.ejeYenCero,e.idComponenteGrafico,m,d,v),"bar"!=y&&"Area"!=e.tipoGrafico||function(e,a,o,t,r,n,s,i,l,c){const d=document.getElementById(s);new Chart(d,{type:o,data:{labels:e,datasets:[{data:a,borderColor:t,backgroundColor:t,borderWidth:2,lineTension:0,label:r}]},options:{legend:{display:c,position:i},tooltips:l,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:n}}]}}})}(a,L,y,r,i[0],e.ejeYenCero,e.idComponenteGrafico,m,d,v),"horizontalBar"==y&&function(e,a,o,t,r,n,s,i,l,c){const d=document.getElementById(s);new Chart(d,{type:o,data:{labels:e,datasets:[{data:a,borderColor:t,backgroundColor:t,borderWidth:2,lineTension:0,label:r}]},options:{legend:{display:c,position:i},tooltips:l,responsive:!0,scales:{xAxes:[{ticks:{beginAtZero:n}}]}}})}(a,L,y,r,i[0],e.ejeYenCero,e.idComponenteGrafico,m,d,v)),c>1)if("heatmap"==y)if(void 0!==e.heatMapColors&&""!=e.heatMapColors&&void 0!==e.heatMapColorsRange&&""!=e.heatMapColorsRange){var Q=[],I="labelFila",$="labelColumna",A="labelValor";void 0!==e.datosTooltip&&e.datosTooltip.length>0&&(void 0!==e.datosTooltip[0]&&void 0!==e.datosTooltip[0].labelFila&&(I=e.datosTooltip[0].labelFila),void 0!==e.datosTooltip[1]&&void 0!==e.datosTooltip[1].labelColumna&&($=e.datosTooltip[1].labelColumna),void 0!==e.datosTooltip[2]&&void 0!==e.datosTooltip[2].labelValor&&(A=e.datosTooltip[2].labelValor)),jQuery.each(Object.keys(o),function(e,a){var t=o[e];l.hasOwnProperty(t)&&(L=l[t],Q.push(L))});for(var E=[],S=0;S<i.length;S++){f=[];for(var G=0;G<a.length;G++){var L={x:a[G],y:parseInt(Q[G][S])};f.push(L)}var B={name:"*"!=g[S]?g[S]:i[S],data:f};E.push(B)}var M=[];for(S=0;S<e.heatMapColorsRange.length-1;S++){f={from:e.heatMapColorsRange[S],to:e.heatMapColorsRange[S+1],color:x(e.heatMapColors[S])};M.push(f)}var F="";F=void 0===e.mostrarEjeY||e.mostrarEjeY,function(e,a,o,t,r,n,s,i,l,c,d,p){const u=document.getElementById(o);new ApexCharts(u,{series:a,chart:{height:650,type:"heatmap"},dataLabels:{enabled:!1},title:{text:l},tooltip:{custom:function({series:e,seriesIndex:a,dataPointIndex:o,w:r}){return'<div class="arrow_box"><span>'+n+": "+t[a]+"<br>"+s+": "+r.globals.labels[o]+"<br>"+i+": "+e[a][o]+"</span></div>"}},plotOptions:{heatmap:{shadeIntensity:.5,radius:0,useFillColorAsStroke:!1,colorScale:{ranges:r}}},yaxis:{show:c},legend:{show:p,position:d},responsive:[{breakpoint:1e3,options:{yaxis:{show:!1},legend:{show:p,position:"top"}}}]}).render();const h=document.getElementsByClassName("apexcharts-toolbar");for(let e=0;e<h.length;e++)h[e].style.display="none"}(0,E,e.idComponenteGrafico,i,M,I,$,A,e.tituloGrafico,F,m,v)}else void 0!==e.heatMapColors&&""!=e.heatMapColors||console.log("Completar vector con valores para los colores"),void 0!==e.heatMapColorsRange&&""!=e.heatMapColorsRange||console.log("Completar vector con el rango de valores para los colores");else{var z=[],O=0;n.forEach(function(e,a,o){s.push(x(e))}),console.log("colores --\x3e "+s);var N=0;jQuery.each(Object.keys(o),function(a,t){var r=o[a];if(l.hasOwnProperty(r)){if(L=l[r],console.log("datos --\x3e "+L),"Line"==e.tipoGrafico)var n={label:i[O],data:L,borderColor:s[O],fill:!1,borderWidth:2,lineTension:0,backgroundColor:s[O]};else if("Bar"==e.tipoGrafico||"Area"==e.tipoGrafico||"Horizontal Bar"==e.tipoGrafico||"Stacked Bar"==e.tipoGrafico)n={label:i[O],data:L,borderColor:s[O],backgroundColor:s[O],borderWidth:2,lineTension:0};else if("Mixed"==e.tipoGrafico){var c=p[N];if("barra"==c)n={label:i[O],data:L,backgroundColor:s[O],yAxisID:"left-y-axis",type:"bar"};else if("linea"==c)n={label:i[O],data:L,borderColor:s[O],backgroundColor:s[O],type:"line",yAxisID:"right-y-axis",fill:!1}}z.push(n),O+=1,N+=1}}),"mixed"==y&&(2==h.length?u=2:1==h.length?"eje-y1"==h[0]?u=0:"eje-y2"==h[0]&&(u=1):u=3),console.log("etiquetas --\x3e "+a),"Stacked Bar"==e.tipoGrafico?function(e,a,o,t,r,n,s,i){const l=document.getElementById(t);new Chart(l,{type:a,data:{labels:e,datasets:o},options:{legend:{display:i,position:n,labels:{textAlign:"center"}},tooltips:s,responsive:!0,scales:{yAxes:[{ticks:{beginAtZero:r},stacked:!0}],xAxes:[{stacked:!0}]}}})}(a,y,z,e.idComponenteGrafico,e.ejeYenCero,m,d,v):"Mixed"==e.tipoGrafico?function(e,a,o,t,r,n,s,i,l,c){const d=document.getElementById(t);new Chart(d,{type:a,data:{labels:e,datasets:o},options:{legend:{display:c,position:n,labels:{textAlign:"center"}},tooltips:{enabled:!0,mode:"single",callbacks:{label:function(e,a){var o="";return 2==s?o="%":e.datasetIndex==s&&(o="%"),a.datasets[e.datasetIndex].label+": "+e.yLabel+" "+o}}},responsive:!0,scales:{yAxes:[{id:"left-y-axis",type:"linear",position:"left",ticks:{beginAtZero:r,callback:function(e){var a="";return 1!=s&&2!=s||(a="%"),e+a}},scaleLabel:{display:!0,labelString:l,fontColor:"black"}},{id:"right-y-axis",type:"linear",position:"right",ticks:{beginAtZero:r,callback:function(e){var a="";return 0!=s&&2!=s||(a="%"),e+a}},scaleLabel:{display:!0,labelString:i,fontColor:"black"}}]}}})}(a,"bar",z,e.idComponenteGrafico,e.ejeYenCero,m,u,i[0],i[1],v):"Horizontal Bar"==e.tipoGrafico?function(e,a,o,t,r,n,s,i){const l=document.getElementById(t);new Chart(l,{type:a,data:{labels:e,datasets:o},options:{legend:{display:i,position:n,labels:{textAlign:"center"}},tooltips:s,responsive:!0,maintainAspectRatio:!0,scales:{xAxes:[{ticks:{beginAtZero:r}}]}}})}(a,y,z,e.idComponenteGrafico,e.ejeYenCero,m,d,v):function(e,a,o,t,r,n,s,i){const l=document.getElementById(t);new Chart(l,{type:a,data:{labels:e,datasets:o},options:{legend:{display:i,position:n,labels:{textAlign:"center"}},tooltips:s,responsive:!0,maintainAspectRatio:!0,scales:{yAxes:[{ticks:{beginAtZero:r}}]}}})}(a,y,z,e.idComponenteGrafico,e.ejeYenCero,m,d,v)}""!=e.tituloGrafico&&void 0!==e.tituloGrafico&&(C=e.idTagTituloGrafico,j=e.tituloGrafico,document.getElementById(C)&&(document.getElementById(C).innerHTML=j))})}function gapi_legacy(e){const a=e.values[0],o=/ |\/|_/gi;let t=[];return e.values.forEach((e,r)=>{if(r>0){let r={};for(var n in a){var s=e.hasOwnProperty(n)?e[n].trim():"";r[`gsx$${a[n].toLowerCase().replace(o,"")}`]={$t:s}}t.push(r)}}),{feed:{entry:t}}}
|
|
@@ -462,6 +462,7 @@ if(showdown){ // IF showdown
|
|
|
462
462
|
});
|
|
463
463
|
|
|
464
464
|
|
|
465
|
+
|
|
465
466
|
/**
|
|
466
467
|
* Crea la etiqueta details con un summary.
|
|
467
468
|
*
|
|
@@ -473,28 +474,28 @@ if(showdown){ // IF showdown
|
|
|
473
474
|
{
|
|
474
475
|
type: 'lang',
|
|
475
476
|
filter: function(text, converter, options) {
|
|
476
|
-
const regex =
|
|
477
|
+
const regex = /^\[\[details(-open|-close)?\s?\{\[([\s\S]*?)\]\[([\s\S]*?)\]\}\]\]$/mg;
|
|
477
478
|
const main_regex = new RegExp(regex, "gmi");
|
|
478
479
|
|
|
479
480
|
text = text.replace(main_regex, function(e){
|
|
480
481
|
const main_regex = new RegExp(regex, "gmi")
|
|
481
|
-
|
|
482
|
-
|
|
482
|
+
let rgx = main_regex.exec(e);
|
|
483
|
+
let cols = {
|
|
483
484
|
'2': '6',
|
|
484
485
|
'3': '4',
|
|
485
486
|
'4': '3',
|
|
486
487
|
'1': '12'
|
|
487
488
|
};
|
|
488
|
-
|
|
489
|
+
let open = (rgx[1] == '-open')? 'true' : false;
|
|
489
490
|
|
|
490
|
-
|
|
491
|
+
let details = document.createElement('details');
|
|
491
492
|
if(open){
|
|
492
493
|
details.setAttribute('open', 'true');
|
|
493
494
|
}
|
|
494
|
-
|
|
495
|
-
|
|
495
|
+
// Summary o título
|
|
496
|
+
let summary = document.createElement('summary');
|
|
496
497
|
summary.innerHTML = cleanner(
|
|
497
|
-
converter.makeHtml(rgx[
|
|
498
|
+
converter.makeHtml(rgx[2]),
|
|
498
499
|
[
|
|
499
500
|
'h1',
|
|
500
501
|
'h2',
|
|
@@ -507,12 +508,13 @@ if(showdown){ // IF showdown
|
|
|
507
508
|
'i'
|
|
508
509
|
]
|
|
509
510
|
);
|
|
510
|
-
|
|
511
|
-
div
|
|
511
|
+
// Contenido
|
|
512
|
+
let div = document.createElement('div');
|
|
513
|
+
div.innerHTML = converter.makeHtml(rgx[3]);
|
|
512
514
|
details.appendChild(summary);
|
|
513
515
|
details.appendChild(div);
|
|
514
516
|
|
|
515
|
-
|
|
517
|
+
let html = details.outerHTML;
|
|
516
518
|
return html;
|
|
517
519
|
});
|
|
518
520
|
return text;
|
package/package.json
CHANGED