--zoom a a diagrama segun filtros de fechas
This commit is contained in:
@@ -541,6 +541,7 @@
|
|||||||
"December": "Diciembre",
|
"December": "Diciembre",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
var dateAxis;
|
||||||
|
|
||||||
function cargaDiagramaGrant(data, categorias, TipoVista) {
|
function cargaDiagramaGrant(data, categorias, TipoVista) {
|
||||||
|
|
||||||
@@ -564,7 +565,7 @@
|
|||||||
// Create chart
|
// Create chart
|
||||||
// https://www.amcharts.com/docs/v5/charts/xy-chart/
|
// https://www.amcharts.com/docs/v5/charts/xy-chart/
|
||||||
var chart = root.container.children.push(am5xy.XYChart.new(root, {
|
var chart = root.container.children.push(am5xy.XYChart.new(root, {
|
||||||
panX: false,
|
panX: true,
|
||||||
panY: false,
|
panY: false,
|
||||||
wheelX: "panX",
|
wheelX: "panX",
|
||||||
wheelY: "zoomX",
|
wheelY: "zoomX",
|
||||||
@@ -599,12 +600,14 @@
|
|||||||
|
|
||||||
yAxis.data.setAll(categorias);
|
yAxis.data.setAll(categorias);
|
||||||
|
|
||||||
var dateAxis = am5xy.DateAxis.new(root, {
|
dateAxis = am5xy.DateAxis.new(root, {
|
||||||
baseInterval: { timeUnit: "minute", count: 1 },
|
baseInterval: { timeUnit: "minute", count: 1 },
|
||||||
renderer: am5xy.AxisRendererX.new(root, {
|
renderer: am5xy.AxisRendererX.new(root, {
|
||||||
minorGridEnabled: true,
|
minorGridEnabled: true,
|
||||||
minGridDistance: 90
|
minGridDistance: 90
|
||||||
})
|
})
|
||||||
|
//min: new Date(2024, 6, 15).getTime(),
|
||||||
|
//max: new Date(2024, 6, 31).getTime()
|
||||||
});
|
});
|
||||||
|
|
||||||
var xAxis = chart.xAxes.push(
|
var xAxis = chart.xAxes.push(
|
||||||
@@ -627,7 +630,7 @@
|
|||||||
series.columns.template.setAll({
|
series.columns.template.setAll({
|
||||||
templateField: "columnSettings",
|
templateField: "columnSettings",
|
||||||
strokeOpacity: 0,
|
strokeOpacity: 0,
|
||||||
tooltipText: "UNIDAD: {unidad} -- CONTRATO: {contrato} -- CÓDIGO: {category} -- DURACIÓN: {openValueX} - {valueX}"
|
tooltipText: "UNIDAD: {category}-{unidad} \nCONTRATO: {contrato} \nDURACIÓN: {openValueX} - {valueX}"
|
||||||
});
|
});
|
||||||
|
|
||||||
series.data.processor = am5.DataProcessor.new(root, {
|
series.data.processor = am5.DataProcessor.new(root, {
|
||||||
@@ -666,7 +669,6 @@
|
|||||||
let parametros = '&cveContrato=' + cveContrato +'&U=' + '<%= UsuarioActual.CveUsuario %>' + '&E='+ '<%= UsuarioActual.CveEmpresa %>'+ '&tipoVista=' + '<%= RBTipoVista.Text %>' + '&CveUsuarioPara:' + $('#DdlTecnico').val(); + '&CveSubProyecto:' + $('#DdlSubProyecto').val();
|
let parametros = '&cveContrato=' + cveContrato +'&U=' + '<%= UsuarioActual.CveUsuario %>' + '&E='+ '<%= UsuarioActual.CveEmpresa %>'+ '&tipoVista=' + '<%= RBTipoVista.Text %>' + '&CveUsuarioPara:' + $('#DdlTecnico').val(); + '&CveSubProyecto:' + $('#DdlSubProyecto').val();
|
||||||
|
|
||||||
fetch(url + parametros).then(response => response.json()).then(json => {
|
fetch(url + parametros).then(response => response.json()).then(json => {
|
||||||
console.log(json);
|
|
||||||
updateEvent(json[0],null,false);
|
updateEvent(json[0],null,false);
|
||||||
}).catch(err => console.log('Solicitud fallida', err));
|
}).catch(err => console.log('Solicitud fallida', err));
|
||||||
});
|
});
|
||||||
@@ -687,29 +689,25 @@
|
|||||||
// Set it on chart's container
|
// Set it on chart's container
|
||||||
chart.root.dom.style.height = chartHeight + "px";
|
chart.root.dom.style.height = chartHeight + "px";
|
||||||
|
|
||||||
//ev.target.get("xAxis").zoomToValues(100, 200);
|
// ev.target.get("xAxis").zoomToValues(new Date(2024,6,15).getTime(), new Date(2024,6,20).getTime());
|
||||||
});
|
});
|
||||||
|
|
||||||
//series.events.once("datavalidated", function(ev) {
|
|
||||||
|
|
||||||
//});
|
|
||||||
|
|
||||||
//chart.events.on("ready", function () {
|
|
||||||
// dateAxis.zoomToDates(
|
|
||||||
// new Date(2024, 7, 4),
|
|
||||||
// new Date(2024, 7, 15)
|
|
||||||
// );
|
|
||||||
//})
|
|
||||||
//root.language.setTranslationAny("May", "Mayo");
|
|
||||||
|
|
||||||
// Make stuff animate on load
|
// Make stuff animate on load
|
||||||
// https://www.amcharts.com/docs/v5/concepts/animations/
|
// https://www.amcharts.com/docs/v5/concepts/animations/
|
||||||
series.appear();
|
series.appear();
|
||||||
chart.appear(1000, 100);
|
chart.appear(1000, 100);
|
||||||
|
|
||||||
|
|
||||||
}); // end am5.ready()
|
}); // end am5.ready()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function zoomAxis(anioI,mesI,diaI,anioF,mesF,diaF) {
|
||||||
|
setTimeout(() => {
|
||||||
|
dateAxis.zoomToDates(new Date(anioI, mesI, diaI), new Date(anioF, mesF, diaF));
|
||||||
|
}, 1500);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var PrimeraCargaCalendario = true;
|
var PrimeraCargaCalendario = true;
|
||||||
var currentUpdateEvent;
|
var currentUpdateEvent;
|
||||||
var addStartDate;
|
var addStartDate;
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ Partial Class RepContratosCalendario
|
|||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
If Not IsPostBack Then
|
If Not IsPostBack Then
|
||||||
txtFechaI.Text = DateTime.Now.ToShortDateString
|
txtFechaI.Text = NowADS().FirstDayOfMonth.ToShortDateString()
|
||||||
txtFechaF.Text = DateTime.Now.AddMonths(1).ToShortDateString
|
txtFechaF.Text = GetLastDayOfMonth(NowADS()).ToShortDateString()
|
||||||
InicializaCombos()
|
InicializaCombos()
|
||||||
InicializaCalendar()
|
InicializaCalendar()
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
@@ -71,6 +71,9 @@ Partial Class RepContratosCalendario
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Function GetLastDayOfMonth(ByVal dateTime As DateTime) As DateTime
|
||||||
|
Return New DateTime(dateTime.Year, dateTime.Month, DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
|
||||||
|
End Function
|
||||||
Private Sub CargaCronograma(Optional TipoVista As Integer = -1)
|
Private Sub CargaCronograma(Optional TipoVista As Integer = -1)
|
||||||
If DtAvance IsNot Nothing Then
|
If DtAvance IsNot Nothing Then
|
||||||
|
|
||||||
@@ -94,13 +97,14 @@ Partial Class RepContratosCalendario
|
|||||||
Dim obj As New JObject(
|
Dim obj As New JObject(
|
||||||
New JProperty("category", Row("CodigoAF")),
|
New JProperty("category", Row("CodigoAF")),
|
||||||
New JProperty("fromDate", Row("FechaInicial").ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm").ToDateTime()),
|
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("toDate", Row("FechaFinal").ToString().ToDateTime.ToString("dd/MM/yyyy HH:mm").ToDateTime()),
|
||||||
New JProperty("columnSettings", New JObject(
|
New JProperty("columnSettings", New JObject(
|
||||||
New JProperty("fill", String.Format("#{0:X6}", random.Next(16777216)))
|
New JProperty("fill", String.Format("#{0:X6}", random.Next(16777216)))
|
||||||
)),
|
)),
|
||||||
New JProperty("unidad", Row("NombreAF")),
|
New JProperty("unidad", Row("NombreAF")),
|
||||||
New JProperty("cveContrato", Row("CveContrato")),
|
New JProperty("cveContrato", Row("CveContrato")),
|
||||||
New JProperty("contrato", Row("NumeroContrato"))
|
New JProperty("contrato", Row("NumeroContrato")),
|
||||||
|
New JProperty("fechaFinalViaje", Row("FechaFinal").ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm"))
|
||||||
)
|
)
|
||||||
jsonData.Add(obj)
|
jsonData.Add(obj)
|
||||||
strAF.AppendFormat("{0},", Row("CveAF"))
|
strAF.AppendFormat("{0},", Row("CveAF"))
|
||||||
@@ -117,8 +121,12 @@ Partial Class RepContratosCalendario
|
|||||||
)
|
)
|
||||||
jsonCategorias.Add(obj)
|
jsonCategorias.Add(obj)
|
||||||
Next
|
Next
|
||||||
|
Dim FechaI = txtFechaI.Text.ToDateTime()
|
||||||
|
Dim FechaF = txtFechaF.Text.ToDateTime()
|
||||||
|
|
||||||
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()},{TipoVista});", "A1")
|
Dim ScriptZoom = $"zoomAxis({FechaI.Year},{FechaI.Month - 1},{FechaI.Day},{FechaF.Year},{FechaF.Month - 1},{FechaF.Day});"
|
||||||
|
|
||||||
|
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()},{TipoVista});{ScriptZoom}", "A1")
|
||||||
UPPGantt.Update()
|
UPPGantt.Update()
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user