This commit is contained in:
2022-12-14 09:44:34 -07:00
2 changed files with 96 additions and 53 deletions

View File

@@ -500,9 +500,6 @@
const chartconfig = {
chart: {
animation: {
duration: 500
},
marginRight: 50
},
title: {
@@ -513,9 +510,10 @@
enabled: false
},
xAxis: {
type: "category"
type: 'category'
},
yAxis: {
//min: 0,
opposite: true,
tickPixelInterval: 150,
title: {
@@ -524,17 +522,17 @@
stackLabels: {
enabled: true,
formatter: function () {
return Highcharts.numberFormat(this.total, null, null, ',');
return Highcharts.numberFormat(this.total, 2, null, ',');
}
},
labels: {
style: {
color: 'red'
},
formatter: function () {
return Highcharts.numberFormat(this.value, null, null, ',');
}
}
// labels: {
// style: {
// color: 'red'
// },
// formatter: function () {
// return Highcharts.numberFormat(this.value, null, null, ',');
// }
// }
},
//tooltip: {
// formatter: function (tooltip) {
@@ -551,19 +549,19 @@
//},
plotOptions: {
series: {
animation: false,
animation: true,
groupPadding: 0,
pointPadding: 0.1,
borderWidth: 0,
colorByPoint: true,
//dataSorting: {
// enabled: false,
// enabled: true,
// matchByName: true
//},
stacking: 'normal',
type: "bar",
type: 'bar',
dataLabels: {
enabled: true,
enabled: false,
// format: '${y}'
// formatter: function () {
// var defaultlabel = Highcharts.getOptions().plotOptions[this.point.series.type].dataLabels.formatter.call(this);
@@ -573,6 +571,14 @@
// formatter: function () {
// return this.total;
// },
},
animation: {
duration: 750
}
},
pie: {
dataLabels: {
enabled: true
}
}
},
@@ -603,6 +609,10 @@
newData.push([point.Texto, point.Valor, point.Unidad]);
}
});
//newData.sort(function (a, b) {
// return a[0] > b[0] ? 1 : -1;
//});
console.log(JSON.stringify(newData))
return newData;
}

View File

@@ -192,30 +192,27 @@ Partial Class General_RepIndicadorResumen
'DtVxP.Columns.Add("Color")
DtVxP.Columns.Add("Unidad")
'RowColorIndex = 0
If GvVxP.DataSource IsNot Nothing Then
For Each Dr As DataRow In CType(GvVxP.DataSource, DataTable).FiltraParametros("", "SubTotalMN DESC").Rows
If Not Dr("Orden").ToString = "" Then
Dim Row = DtVxP.NewRow()
Row("Texto") = Dr("GPO").ToString
Row("Valor") = Dr("SubTotalMN").ToString.FormatoNumero
Row("Unidad") = "MXN" '$"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
DtVxP.Rows.Add(Row)
'RowColorIndex += 1
'If RowColorIndex = 17 Then
' RowColorIndex = 0
'End If
End If
Next
End If
'Dim vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
'Dim group_vxp = vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
' .Texto = Function(x) x.Texto.ToString,
' .Valor = Math.Round(Function(x) x.Valor, 2),
' .Unidad = "MXN"
'})
Dim top_vxp = From s In DtVxP.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_vxp = From s In DtVxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
For Each Dr As DataRow In CType(GvVxP.DataSource, DataTable).FiltraParametros("", "SubTotalMN DESC").Rows
If Not Dr("Orden").ToString = "" Then
Dim Row = DtVxP.NewRow()
Row("Texto") = Dr("GPO").ToString
Row("Valor") = Dr("SubTotalMN").ToString.FormatoNumero
Row("Unidad") = "MXN" '$"{GlobalDTMonedas().FiltraParametros($"CveMoneda = {Dr("CveMoneda").ToString}").Rows(0)("Abreviatura").ToString}"
DtVxP.Rows.Add(Row)
'RowColorIndex += 1
'If RowColorIndex = 17 Then
' RowColorIndex = 0
'End If
End If
Next
Dim vxp = From s In DtVxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_vxp = vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = g.Key,
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Unidad = "MXN"
}).ToDataTable
Dim top_vxp = From s In group_vxp.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_vxp = From s In group_vxp.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_resto_vxp = resto_vxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
@@ -238,8 +235,14 @@ Partial Class General_RepIndicadorResumen
Row("Unidad") = "Kg"
DtCompProductores.Rows.Add(Row)
Next
Dim top_comp_productores = From s In DtCompProductores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_comp_productores = From s In DtCompProductores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim comp_productores = From s In DtCompProductores.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_comp_productores = comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = g.Key,
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Unidad = "MXN"
}).ToDataTable
Dim top_comp_productores = From s In group_comp_productores.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_comp_productores = From s In group_comp_productores.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_resto_comp_productores = resto_comp_productores.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
@@ -261,8 +264,14 @@ Partial Class General_RepIndicadorResumen
DtCompAcreed.Rows.Add(Row)
End If
Next
Dim top_comp_acreed = From s In DtCompAcreed.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_comp_acreed = From s In DtCompAcreed.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim comp_acreed = From s In DtCompAcreed.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_comp_acreed = comp_acreed.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = g.Key,
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Unidad = "MXN"
}).ToDataTable
Dim top_comp_acreed = From s In group_comp_acreed.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_comp_acreed = From s In group_comp_acreed.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_resto_comp_acreed = resto_comp_acreed.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
@@ -284,8 +293,14 @@ Partial Class General_RepIndicadorResumen
DtCxC.Rows.Add(Row)
End If
Next
Dim top_cxc = From s In DtCxC.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxc = From s In DtCxC.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim cxc = From s In DtCxC.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_cxc = cxc.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = g.Key,
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Unidad = "MXN"
}).ToDataTable
Dim top_cxc = From s In group_cxc.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxc = From s In group_cxc.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_resto_cxc = resto_cxc.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
@@ -308,8 +323,14 @@ Partial Class General_RepIndicadorResumen
DtCxCR.Rows.Add(Row)
End If
Next
Dim top_cxcr = From s In DtCxCR.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxcr = From s In DtCxCR.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim cxcr = From s In DtCxCR.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_cxcr = cxcr.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = g.Key,
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Unidad = "MXN"
}).ToDataTable
Dim top_cxcr = From s In group_cxcr.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxcr = From s In group_cxcr.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_resto_cxcr = resto_cxcr.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
@@ -331,8 +352,14 @@ Partial Class General_RepIndicadorResumen
DtCxP192.Rows.Add(Row)
End If
Next
Dim top_cxp192 = From s In DtCxP192.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxp192 = From s In DtCxP192.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim cxp192 = From s In DtCxP192.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_cxp192 = cxp192.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = g.Key,
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Unidad = "MXN"
}).ToDataTable
Dim top_cxp192 = From s In group_cxp192.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxp192 = From s In group_cxp192.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_resto_cxp192 = resto_cxp192.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
@@ -354,8 +381,14 @@ Partial Class General_RepIndicadorResumen
DtCxP.Rows.Add(Row)
End If
Next
Dim top_cxp = From s In DtCxP.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxp = From s In DtCxP.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim cxp = From s In DtCxP.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_cxp = cxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = g.Key,
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),
.Unidad = "MXN"
}).ToDataTable
Dim top_cxp = From s In group_cxp.AsEnumerable().Take(10) Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim resto_cxp = From s In group_cxp.AsEnumerable().Skip(10) Select New With {.Texto = "Otros", .Valor = s("Valor").ToString().ToDouble(), .Unidad = s("Unidad").ToString()}
Dim group_resto_cxp = resto_cxp.GroupBy(Function(x) x.Texto).[Select](Function(g) New With {
.Texto = "Otros",
.Valor = Math.Round(g.Sum(Function(x) x.Valor), 2),