--Tamaño de diagrama segun la cantidad de datos

This commit is contained in:
2024-05-07 19:38:32 -07:00
parent 190aa55c90
commit 5eab7f83db
2 changed files with 39 additions and 42 deletions

View File

@@ -21,7 +21,7 @@
#chartdiv {
width: 100%;
height: 700px;
height: 600px;
}
</style>
</asp:Content>
@@ -280,36 +280,33 @@
<ajax:TabPanel ID="TabGrantt" runat="server" HeaderText="Cronograma">
<ContentTemplate>
<asp:UpdatePanel ID="UPPGantt" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row" style="height: 32px;">
<label class="col-md-1 truncate">Vista</label>
<div class="col-md-1">
<asp:DropDownList ID="DdlTipoVista" AutoPostBack="true" OnSelectedIndexChanged ="DdlTipoVista_SelectedIndexChanged" CssClass="form-control select2me input-sm select2me Widthall"
Style="width: 100%;" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="solo viaje" Value="1"></asp:ListItem>
</asp:DropDownList>
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row" style="height: 32px;">
<label class="col-md-1 truncate">Tipo Vista:</label>
<div class="col-md-1">
<asp:DropDownList ID="DdlTipoVista" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoVista_SelectedIndexChanged" CssClass="form-control select2me input-sm select2me Widthall"
Style="width: 100%;" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Text="Solo Viaje" Value="1"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-12">
<div id="chartdiv" style="width:100%; min-height:300px;"></div>
<div id="chartdiv"></div>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
@@ -526,7 +523,6 @@
"February": "Febrero",
"March": "Marzo",
"April": "Abril",
"May": "Mayo",
"June": "Junio",
"July": "Julio",
"August": "Agosto",
@@ -537,7 +533,7 @@
};
function cargaDiagramaGrant(data, categorias) {
function cargaDiagramaGrant(data, categorias, TipoVista) {
am5.ready(function () {
//SI YA HAY GRAFICA, QUITA LA ACTUAL PARA HACER UNA NUEVA
@@ -566,7 +562,7 @@
layout: root.verticalLayout,
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, {
@@ -650,23 +646,24 @@
chart.set("scrollbarY", scrollbarY);
/// evento para ajustar el alto del row
var cellSize = 30;
chart.events.on("datavalidated", function (ev) {
series.events.on("datavalidated", function (ev) {
let cellSize = 45;
// Get objects of interest
var chart = ev.target;
var categoryAxis = chart.yAxes.getIndex(0);
if (TipoVista == 1) {
cellSize = 60;
}
//let series = ev.target;
//let chart = series.chart;
let xAxis = chart.xAxes.getIndex(0);
// Calculate how we need to adjust chart height
var adjustHeight = chart.data.length * cellSize - categoryAxis.pixelHeight;
// get current chart height
var targetHeight = chart.pixelHeight + adjustHeight;
let chartHeight = categorias.length * cellSize + xAxis.height() + chart.get("paddingTop", 0) + chart.get("paddingBottom", 0);
// Set it on chart's container
chart.svgContainer.htmlElement.style.height = targetHeight + "px";
chart.root.dom.style.height = chartHeight + "px";
});
//root.language.setTranslationAny("May", "Mayo");
// Make stuff animate on load
// https://www.amcharts.com/docs/v5/concepts/animations/
@@ -713,12 +710,12 @@
if (event.NombreComercial !== null) {
$('#HidModClienteNombre').val('');
$('#HidModClienteNombre').val('');
} else {
$('#HidModClienteNombre').val(event.NombreComercial);
}
}
$('#HidModCveCliente').val(event.CveCliente);
$('#HidModCveCliente').val(event.CveCliente);
$('#<%=BtnModal.ClientID%>').click();
}

View File

@@ -103,7 +103,7 @@ Partial Class RepContratosCalendario
jsonCategorias.Add(obj)
Next
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()});", "A1")
RegistraScript($"cargaDiagramaGrant({jsonData.ToString()},{jsonCategorias.ToString()},{TipoVista});", "A1")
UPPGantt.Update()
End If
End Sub