--FIX recarga de diagrama
--poner código en el renglón
This commit is contained in:
@@ -485,51 +485,50 @@
|
||||
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>
|
||||
<script src="https://cdn.amcharts.com/lib/5/themes/Animated.js"></script>
|
||||
<script>
|
||||
// Create root element
|
||||
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
|
||||
var root = am5.Root.new("chartdiv");
|
||||
|
||||
var am5locales_es_ES = {
|
||||
"Jan": "Enero",
|
||||
"Feb": "Febrero",
|
||||
"Mar": "Marzo",
|
||||
"Apr": "Abril",
|
||||
"May": "Mayo",
|
||||
"Jun": "Junio",
|
||||
"Jul": "Julio",
|
||||
"Aug": "Agosto",
|
||||
"Sep": "Septiembre",
|
||||
"Oct": "Octubre",
|
||||
"Nov": "Noviembre",
|
||||
"Dec": "Diciembre",
|
||||
|
||||
"January": "Enero",
|
||||
"February": "Febrero",
|
||||
"March": "Marzo",
|
||||
"April": "Abril",
|
||||
"May": "Mayo",
|
||||
"June": "Junio",
|
||||
"July": "Julio",
|
||||
"August": "Agosto",
|
||||
"September": "Septiembre",
|
||||
"October": "Octubre",
|
||||
"November": "Noviembre",
|
||||
"December": "Diciembre",
|
||||
|
||||
};
|
||||
|
||||
function cargaDiagramaGrant(data, categorias) {
|
||||
|
||||
am5.ready(function () {
|
||||
// Create root element
|
||||
// https://www.amcharts.com/docs/v5/getting-started/#Root_element
|
||||
var root = am5.Root.new("chartdiv");
|
||||
//SI YA HAY GRAFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA
|
||||
root.container.children.clear();
|
||||
|
||||
root.dateFormatter.setAll({
|
||||
dateFormat: "dd/MM/yyyy HH:mm",
|
||||
dateFields: ["valueX", "openValueX"]
|
||||
});
|
||||
|
||||
var am5locales_es_ES = {
|
||||
"Jan": "Enero",
|
||||
"Feb": "Febrero",
|
||||
"Mar": "Marzo",
|
||||
"Apr": "Abril",
|
||||
"May": "Mayo",
|
||||
"Jun": "Junio",
|
||||
"Jul": "Julio",
|
||||
"Aug": "Agosto",
|
||||
"Sep": "Septiembre",
|
||||
"Oct": "Octubre",
|
||||
"Nov": "Noviembre",
|
||||
"Dec": "Diciembre",
|
||||
|
||||
"January": "Enero",
|
||||
"February": "Febrero",
|
||||
"March": "Marzo",
|
||||
"April": "Abril",
|
||||
"May": "Mayo",
|
||||
"June": "Junio",
|
||||
"July": "Julio",
|
||||
"August": "Agosto",
|
||||
"September": "Septiembre",
|
||||
"October": "Octubre",
|
||||
"November": "Noviembre",
|
||||
"December": "Diciembre",
|
||||
|
||||
}
|
||||
|
||||
//root.language.setTranslationsAny({
|
||||
// "January!": "¡Hola!",
|
||||
// "Bye": "Adios"
|
||||
//});
|
||||
|
||||
root.locale = am5locales_es_ES;
|
||||
|
||||
// Set themes
|
||||
@@ -549,7 +548,6 @@
|
||||
paddingLeft: 0
|
||||
}));
|
||||
|
||||
|
||||
// Add legend
|
||||
// https://www.amcharts.com/docs/v5/charts/xy-chart/legend-xy-series/
|
||||
var legend = chart.children.push(am5.Legend.new(root, {
|
||||
@@ -577,16 +575,20 @@
|
||||
|
||||
yAxis.data.setAll(categorias);
|
||||
|
||||
var dateAxis = am5xy.DateAxis.new(root, {
|
||||
baseInterval: { timeUnit: "minute", count: 1 },
|
||||
renderer: am5xy.AxisRendererX.new(root, {
|
||||
minorGridEnabled: true,
|
||||
minGridDistance: 90
|
||||
})
|
||||
});
|
||||
|
||||
var xAxis = chart.xAxes.push(
|
||||
am5xy.DateAxis.new(root, {
|
||||
baseInterval: { timeUnit: "minute", count: 1 },
|
||||
renderer: am5xy.AxisRendererX.new(root, {
|
||||
minorGridEnabled: true,
|
||||
minGridDistance: 90
|
||||
})
|
||||
})
|
||||
dateAxis
|
||||
);
|
||||
|
||||
chart.topAxesContainer.children.push(dateAxis);
|
||||
|
||||
// Add series
|
||||
// https://www.amcharts.com/docs/v5/charts/xy-chart/series/
|
||||
var series = chart.series.push(am5xy.ColumnSeries.new(root, {
|
||||
@@ -611,9 +613,17 @@
|
||||
series.data.setAll(data);
|
||||
|
||||
// Add scrollbars
|
||||
chart.set("scrollbarX", am5.Scrollbar.new(root, {
|
||||
//chart.set("scrollbarX", am5.Scrollbar.new(root, {
|
||||
// orientation: "horizontal"
|
||||
//}));
|
||||
|
||||
// Scrollbar X
|
||||
var scrollbarX = am5.Scrollbar.new(root, {
|
||||
orientation: "horizontal"
|
||||
}));
|
||||
});
|
||||
|
||||
chart.set("scrollbarX", scrollbarX);
|
||||
chart.bottomAxesContainer.children.push(scrollbarX);
|
||||
|
||||
// Make stuff animate on load
|
||||
// https://www.amcharts.com/docs/v5/concepts/animations/
|
||||
|
||||
@@ -63,8 +63,8 @@ Partial Class RepContratosCalendario
|
||||
If DtAvance IsNot Nothing Then
|
||||
|
||||
For Each Row As DataRow In DtAvance.Rows
|
||||
If String.IsNullOrEmpty(Row("NombreAF").ToString()) Then
|
||||
Row("NombreAF") = "Unidad no asignada"
|
||||
If String.IsNullOrEmpty(Row("NoSerie").ToString()) Then
|
||||
Row("NoSerie") = "Unidad no asignada"
|
||||
End If
|
||||
Next
|
||||
|
||||
@@ -74,22 +74,23 @@ Partial Class RepContratosCalendario
|
||||
Dim random = New Random()
|
||||
|
||||
'DATOS
|
||||
For Each Row As DataRow In DtAvance.FiltraParametros("NombreAF <> ''").Rows
|
||||
For Each Row As DataRow In DtAvance.FiltraParametros("NoSerie <> ''").Rows
|
||||
Dim obj As New JObject(
|
||||
New JProperty("category", Row("NombreAF")),
|
||||
New JProperty("category", Row("NoSerie")),
|
||||
New JProperty("fromDate", Row("FechaInicial").ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm").ToDateTime()),
|
||||
New JProperty("toDate", Row("FechaFinal").ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm").ToDateTime()),
|
||||
New JProperty("columnSettings", New JObject(
|
||||
New JProperty("fill", String.Format("#{0:X6}", random.Next(16777216)))
|
||||
))
|
||||
)
|
||||
)),
|
||||
New JProperty("task", Row("NombreAF"))
|
||||
)
|
||||
jsonData.Add(obj)
|
||||
Next
|
||||
|
||||
'CATEGORIAS
|
||||
For Each Row As DataRow In DtAvance.FiltraParametros("NombreAF <> ''", "", {"NombreAF"}).Rows
|
||||
For Each Row As DataRow In DtAvance.FiltraParametros("NoSerie <> ''", "", {"NoSerie"}).Rows
|
||||
Dim obj As New JObject(
|
||||
New JProperty("category", Row("NombreAF"))
|
||||
New JProperty("category", Row("NoSerie"))
|
||||
)
|
||||
jsonCategorias.Add(obj)
|
||||
Next
|
||||
|
||||
Reference in New Issue
Block a user