protected override string GetGraphXml() { using (var helper = new FusionChartsMultiSeriesHelper()) { if (ReportObjectsList.Count <= 0) { throw new Exception("No se encontraron datos asociados a los filtros seleccionados!"); } SetGraphProperties(helper); AddDates(helper); var maxTurnos = ReportObjectsList.Select(res => res.HsTurnos.Count).Max(); var colorGenerator = new ColorGenerator(); FusionChartsDataset niveles; for (var i = 0; i < maxTurnos; i++) { niveles = new FusionChartsDataset(); niveles.SetPropertyValue("color", HexColorUtil.ColorToHex(colorGenerator.GetNextColor())); foreach (var dia in ReportObjectsList) { if (dia.HsTurnos.Count > 1) { niveles.addValue(dia.HsTurnos.First().ToString(CultureInfo.InvariantCulture)); dia.HsTurnos.Remove(dia.HsTurnos.First()); niveles.addValue(dia.HsReales.First().ToString(CultureInfo.InvariantCulture)); dia.HsReales.Remove(dia.HsReales.First()); niveles.addValue("0"); } else if (dia.HsTurnos.Count == 1) { niveles.addValue("0"); niveles.addValue("0"); niveles.addValue("0"); } } helper.AddDataSet(niveles); } niveles = new FusionChartsDataset(); niveles.SetPropertyValue("color", HexColorUtil.ColorToHex(Color.Gray)); niveles.SetPropertyValue("seriesName", "Fuera de Turno"); foreach (var dia in ReportObjectsList) { niveles.addValue(dia.HsTurnos.First().ToString(CultureInfo.InvariantCulture)); niveles.addValue(dia.HsReales.First().ToString(CultureInfo.InvariantCulture)); niveles.addValue("0"); } helper.AddDataSet(niveles); return(helper.BuildXml()); } }
protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var hoursInShift = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_EN_TURNO") }; var hoursOutOfShift = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_FUERA_DE_TURNO") }; foreach (var item in ReportObjectsList) { hoursInShift.addValue(item.HoursInShift.ToString(CultureInfo.InvariantCulture)); hoursOutOfShift.addValue(item.HoursOutOfShift.ToString(CultureInfo.InvariantCulture)); } var categories = ReportObjectsList.Select(nivel => String.Format("{0} - {1}", nivel.Date.ToShortDateString(), nivel.Date.ToShortTimeString())).ToList(); datasets.Add(hoursOutOfShift); datasets.Add(hoursInShift); GraphCategories = categories; GraphDataSet = datasets; }
protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var hsTurnoOn = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_TURNO_ON") }; var hsTurnoOff = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_TURNO_OFF") }; var hsOn = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_ON") }; var hsOff = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_OFF") }; var categories = new List <string>(); foreach (var r in ReportObjectsList) { categories.Add(r.Fecha.ToShortDateString()); hsTurnoOn.addValue(r.HsTurnoOn.ToString(CultureInfo.InvariantCulture)); hsTurnoOff.addValue(r.HsTurnoOff.ToString(CultureInfo.InvariantCulture)); hsOn.addValue(r.HsOn.ToString(CultureInfo.InvariantCulture)); hsOff.addValue(r.HsOff.ToString(CultureInfo.InvariantCulture)); } datasets.Add(hsTurnoOn); datasets.Add(hsTurnoOff); datasets.Add(hsOn); datasets.Add(hsOff); GraphCategories = categories; GraphDataSet = datasets; }
/// <summary> /// Generates the Datasets and Categories for the CSV. /// </summary> protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var consumos = new FusionChartsDataset { Name = CultureManager.GetLabel("MOTORES") }; foreach (var consumo in _motores) { consumos.addValue(consumo.VolumenConsumido.ToString(CultureInfo.InvariantCulture)); } datasets.Add(consumos); var niveles = new FusionChartsDataset { Name = ddlTanque.SelectedItem.Text }; foreach (var r in ReportObjectsList) { niveles.addValue(r.VolumenConsumido.ToString(CultureInfo.InvariantCulture)); } datasets.Add(niveles); var categories = ReportObjectsList.Select(nivel => String.Format("{0} - {1}", nivel.Fecha.ToShortDateString(), nivel.Fecha.ToShortTimeString())).ToList(); GraphCategories = categories; GraphDataSet = datasets; }
/// <summary> /// Generates the categories and Datasets for the /// </summary> protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var teoricDataset = new FusionChartsDataset { Name = CultureManager.GetLabel("TEORICO") }; var realDataset = new FusionChartsDataset { Name = CultureManager.GetLabel("REAL") }; var categories = new List <string>(); foreach (var consist in ReportObjectsList) { categories.Add(String.Format("{0} - {1}", consist.Fecha.ToShortDateString(), consist.Fecha.ToShortTimeString())); teoricDataset.addValue(consist.StockTeorico.ToString(CultureInfo.InvariantCulture)); realDataset.addValue(consist.StockReal.ToString(CultureInfo.InvariantCulture)); } if (chkTeorico.Checked) { datasets.Add(teoricDataset); } if (chkReal.Checked) { datasets.Add(realDataset); } GraphCategories = categories; GraphDataSet = datasets; }
protected override string GetGraphXml() { using (var helper = new FusionChartsMultiSeriesHelper()) { SetGraphConfiguration(helper); var hoursInShift = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_EN_TURNO") }; hoursInShift.SetPropertyValue("seriesName", CultureManager.GetLabel("HS_EN_TURNO")); var hoursOutOfShift = new FusionChartsDataset { Name = CultureManager.GetLabel("HS_FUERA_DE_TURNO") }; hoursOutOfShift.SetPropertyValue("seriesName", CultureManager.GetLabel("HS_FUERA_DE_TURNO")); hoursOutOfShift.SetPropertyValue("color", "1E90FF"); if (!ReportObjectsList.Any(d => !d.HoursInShift.Equals(0) || !d.HoursOutOfShift.Equals(0))) { return(helper.BuildXml()); } foreach (var item in ReportObjectsList) { helper.AddCategory(item.Date.ToShortTimeString()); hoursInShift.addValue(item.HoursInShift.ToString(CultureInfo.InvariantCulture)); hoursOutOfShift.addValue(item.HoursOutOfShift.ToString(CultureInfo.InvariantCulture)); } helper.AddDataSet(hoursInShift); helper.AddDataSet(hoursOutOfShift); return(helper.BuildXml()); } }
protected override string GetGraphXml() { ToogleItems(lbBase); using (var helper = new FusionChartsMultiSeriesHelper()) { SetGraphConfiguration(helper); var iniDate = SecurityExtensions.ToDataBaseDateTime(dtpDate.SelectedDate.GetValueOrDefault()); var finDate = SecurityExtensions.ToDataBaseDateTime(dtpDate.SelectedDate.GetValueOrDefault()).AddHours(23).AddMinutes(59).AddSeconds(59); var colorGen = new ColorGenerator(); var noCategoriesAdded = true; var hasValue = false; if (lbBase.GetSelectedIndices().Length == 0) { lbBase.ToogleItems(); } foreach (var index in lbBase.GetSelectedIndices()) { var data = ReportFactory.IdleTimesDAO.GetAllMovilesStoppedInPlanta(Convert.ToInt32((string)lbBase.Items[index].Value), iniDate, finDate, chkUndefined.Checked); var dataset = new FusionChartsDataset { Name = lbBase.Items[index].Text }; dataset.SetPropertyValue("SeriesName", lbBase.Items[index].Text); dataset.SetPropertyValue("color", HexColorUtil.ColorToHex(colorGen.GetNextColor())); foreach (var item in data) { if (noCategoriesAdded) { helper.AddCategory(item.Date.ToShortTimeString()); } dataset.addValue(item.TotalVehicles.ToString(CultureInfo.InvariantCulture)); if (!item.TotalVehicles.Equals(0)) { hasValue = true; } } helper.AddDataSet(dataset); noCategoriesAdded = false; } if (!hasValue) { throw new Exception(CultureManager.GetError("NO_MOBILE_IN_BASE")); } return(helper.BuildXml()); } }
protected override string GetGraphXml() { using (var helper = new FusionChartsMultiSeriesHelper()) { SetGraphProperties(helper); var consumos = new FusionChartsDataset(); var ingresos = new FusionChartsDataset(); var conciliacionEgreso = new FusionChartsDataset(); var conciliacionIngreso = new FusionChartsDataset(); var categories = new List <string>(); consumos.SetPropertyValue("seriesName", CultureManager.GetLabel("CONSUMOS")); ingresos.SetPropertyValue("seriesName", CultureManager.GetLabel("INGRESOS")); ingresos.SetPropertyValue("color", "008ED6"); conciliacionEgreso.SetPropertyValue("seriesName", CultureManager.GetLabel("EGRESOS_CONCILIACION")); conciliacionEgreso.SetPropertyValue("color", "FF9933"); conciliacionIngreso.SetPropertyValue("seriesName", CultureManager.GetLabel("INGRESOS_CONCILIACION")); conciliacionIngreso.SetPropertyValue("color", "339900"); foreach (var c in ReportObjectsList) { var category = String.Format("{0}", c.Fecha.ToShortDateString()); if (!categories.Contains(category)) { categories.Add(category); helper.AddCategory(category); } consumos.addValue(c.VolumenConsumido.ToString(CultureInfo.InvariantCulture)); ingresos.addValue(c.Ingresos.ToString(CultureInfo.InvariantCulture)); conciliacionEgreso.addValue(c.EgresosPorConciliacion.ToString(CultureInfo.InvariantCulture)); conciliacionIngreso.addValue(c.IngresosPorConciliacion.ToString(CultureInfo.InvariantCulture)); } helper.AddDataSet(consumos); helper.AddDataSet(ingresos); helper.AddDataSet(conciliacionEgreso); helper.AddDataSet(conciliacionIngreso); GraphCategories = helper.GetCategoriesList(); GraphDataSet = new List <FusionChartsDataset> { consumos, ingresos, conciliacionEgreso, conciliacionIngreso }; var s = helper.BuildXml(); return(s); } }
private static string GetGraphXml(IEnumerable <ResumenDeEntregasVo> entregas) { using (var helper = new FusionChartsMultiSeriesHelper()) { helper.AddConfigEntry("xAxisName", CultureManager.GetLabel("INTERNO")); helper.AddConfigEntry("yAxisName", CultureManager.GetLabel("CANTIDAD")); helper.AddConfigEntry("decimalPrecision", "0"); helper.AddConfigEntry("showValues", "0"); helper.AddConfigEntry("showNames", "1"); helper.AddConfigEntry("hoverCapSepChar", " - "); var completados = new FusionChartsDataset(); completados.SetPropertyValue("color", "#008000"); completados.SetPropertyValue("seriesName", CultureManager.GetLabel("COMPLETADOS")); var visitados = new FusionChartsDataset(); visitados.SetPropertyValue("color", "#FFFF00"); visitados.SetPropertyValue("seriesName", CultureManager.GetLabel("VISITADOS")); var enSitio = new FusionChartsDataset(); enSitio.SetPropertyValue("color", "#00A2E8"); enSitio.SetPropertyValue("seriesName", CultureManager.GetLabel("EN_SITIO")); var enZona = new FusionChartsDataset(); enZona.SetPropertyValue("color", "#808080"); enZona.SetPropertyValue("seriesName", CultureManager.GetLabel("EN_ZONA")); var noCompletados = new FusionChartsDataset(); noCompletados.SetPropertyValue("color", "#FF0000"); noCompletados.SetPropertyValue("seriesName", CultureManager.GetLabel("NO_COMPLETADOS")); var noVisitados = new FusionChartsDataset(); noVisitados.SetPropertyValue("color", "#FF4500"); noVisitados.SetPropertyValue("seriesName", CultureManager.GetLabel("NO_VISITADOS")); foreach (var entrega in entregas) { helper.AddCategory(entrega.Vehiculo.Replace('&', 'y')); completados.addValue(entrega.Completados.ToString("#0")); visitados.addValue(entrega.Visitados.ToString("#0")); enSitio.addValue(entrega.EnSitio.ToString("#0")); enZona.addValue(entrega.EnZona.ToString("#0")); noCompletados.addValue(entrega.NoCompletados.ToString("#0")); noVisitados.addValue(entrega.NoVisitados.ToString("#0")); } helper.AddDataSet(completados); helper.AddDataSet(visitados); helper.AddDataSet(enSitio); helper.AddDataSet(enZona); helper.AddDataSet(noCompletados); helper.AddDataSet(noVisitados); return(helper.BuildXml()); } }
protected override string GetGraphXml() { using (var helper = new FusionChartsMultiSeriesHelper()) { SetGraphProperties(helper); var teoricDataset = new FusionChartsDataset(); var realDataset = new FusionChartsDataset(); var labelInterval = (ReportObjectsList.Count / MaxLabels) + 1; var i = labelInterval; int resto; Math.DivRem(Convert.ToInt32(npInterval.Value), 1440, out resto); var printOnlyDate = resto.Equals(0); teoricDataset.SetPropertyValue("seriesName", "Teórico"); realDataset.SetPropertyValue("seriesName", "Real"); realDataset.SetPropertyValue("color", "008ED6"); if (ReportObjectsList.Any(o => o.StockReal > 0 || o.StockTeorico > 0)) { foreach (var consist in ReportObjectsList) { var str = String.Empty; if (i == labelInterval) { str = printOnlyDate ? String.Format("{0}", consist.Fecha.ToShortDateString()) : String.Format("{0} - {1}", consist.Fecha.ToShortDateString(), consist.Fecha.ToShortTimeString()); i = 0; } i++; helper.AddCategory(str); teoricDataset.addValue(consist.StockTeorico.ToString(CultureInfo.InvariantCulture)); realDataset.addValue(consist.StockReal.ToString(CultureInfo.InvariantCulture)); } } if (chkTeorico.Checked) { helper.AddDataSet(teoricDataset); } if (chkReal.Checked) { helper.AddDataSet(realDataset); } var s = helper.BuildXml(); return(s); } }
protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var data = new FusionChartsDataset(); var categories = new List <string>(); foreach (var kilometer in ReportObjectsList) { categories.Add(kilometer.Interno); data.addValue(kilometer.Kilometers.ToString(CultureInfo.InvariantCulture)); } datasets.Add(data); GraphCategories = categories; GraphDataSet = datasets; }
/// <summary> /// Adds tank level variation. /// </summary> /// <param name="helper"></param> private void AddEnginesCaudal(FusionChartsMultiSeriesHelper helper) { var niveles = new FusionChartsDataset(); var avgCaudal = (from nivel in ReportObjectsList select nivel.Caudal).Average(); niveles.SetPropertyValue("seriesName", string.Format("{0}: {1}lit", CultureManager.GetLabel("CAUDAL"), (int)avgCaudal)); niveles.SetPropertyValue("color", HexColorUtil.ColorToHex(Color.SteelBlue)); foreach (var nivel in ReportObjectsList) { niveles.addValue(nivel.Caudal.ToString(CultureInfo.InvariantCulture)); } helper.AddDataSet(niveles); }
/// <summary> /// adds the consumptions made by all engines associated to the tank. /// </summary> /// <param name="helper"></param> private void AddEnginesConsumption(FusionChartsMultiSeriesHelper helper) { var niveles = new FusionChartsDataset(); var avgConsumption = (from nivel in ReportObjectsList select nivel.Consumo).Average(); niveles.SetPropertyValue("seriesName", string.Format("{0}: {1}lit", CultureManager.GetLabel("CONSUMO"), (int)avgConsumption)); foreach (var dia in ReportObjectsList) { niveles.addValue(dia.Consumo.ToString(CultureInfo.InvariantCulture)); } helper.AddDataSet(niveles); }
protected override string GetGraphXml() { using (var helper = new FusionChartsMultiSeriesHelper()) { if (ReportObjectsList.Count <= 0) { throw new Exception("No se encontraron datos asociados a los filtros seleccionados!"); } if (!ReportObjectsList.Any(r => r.HsOff > 0 || r.HsOn > 0 || r.HsTurnoOff > 0 || r.HsTurnoOn > 0)) { return(helper.BuildXml()); } SetGraphProperties(helper); var hsTurnoOn = new FusionChartsDataset(); hsTurnoOn.SetPropertyValue("color", "2E8B57"); hsTurnoOn.SetPropertyValue("seriesName", CultureManager.GetLabel("HS_TURNO_ON")); var hsTurnoOff = new FusionChartsDataset(); hsTurnoOff.SetPropertyValue("color", "FFD700"); hsTurnoOff.SetPropertyValue("seriesName", CultureManager.GetLabel("HS_TURNO_OFF")); var hsOn = new FusionChartsDataset(); hsOn.SetPropertyValue("color", "4876FF"); hsOn.SetPropertyValue("seriesName", CultureManager.GetLabel("HS_ON")); var hsOff = new FusionChartsDataset(); hsOff.SetPropertyValue("color", "B22222"); hsOff.SetPropertyValue("seriesName", CultureManager.GetLabel("HS_OFF")); foreach (var result in ReportObjectsList) { helper.AddCategory(String.Format("{0}", result.Fecha.ToShortDateString())); hsTurnoOn.addValue(result.HsTurnoOn.ToString(CultureInfo.InvariantCulture)); hsTurnoOff.addValue(result.HsTurnoOff.ToString(CultureInfo.InvariantCulture)); hsOn.addValue(result.HsOn.ToString(CultureInfo.InvariantCulture)); hsOff.addValue(result.HsOff.ToString(CultureInfo.InvariantCulture)); } helper.AddDataSet(hsTurnoOn); helper.AddDataSet(hsTurnoOff); helper.AddDataSet(hsOn); helper.AddDataSet(hsOff); return(helper.BuildXml()); } }
/// <summary> /// adds the consumptions made by all engines associated to the tank. /// </summary> /// <param name="helper"></param> private void AddEnginesConsumption(FusionChartsMultiSeriesHelper helper) { var niveles = new FusionChartsDataset(); niveles.SetPropertyValue("seriesName", CultureManager.GetLabel("MOTORES")); if (_motores.Where(o => o.VolumenConsumido > 0.01).Count() > 0) { foreach (var consumo in _motores) { niveles.addValue(consumo.VolumenConsumido.ToString(CultureInfo.InvariantCulture)); } } helper.AddDataSet(niveles); }
protected override void GetGraphCategoriesAndDatasets() { var dataset = new FusionChartsDataset { Name = ddlEmpleado.SelectedItem.Text }; var categories = new List <string>(); foreach (var t in ReportObjectsList) { categories.Add(String.Format("{0:dd/MM}", t.Fecha)); dataset.addValue(t.ElapsedTime.ToString()); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { dataset }; }
protected override void GetGraphCategoriesAndDatasets() { var dataset = new FusionChartsDataset { Name = YAxisLabel }; var categories = new List <string>(); foreach (var t in ReportObjectsList) { categories.Add(DateTime.Parse(t.Fecha).TimeOfDay.ToString()); dataset.addValue(t.Valor); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { dataset }; }
protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var data = new FusionChartsDataset { Name = YAxisLabel }; var categories = new List <string>(); foreach (var stoppedEvent in ReportObjectsList) { categories.Add(stoppedEvent.Corner); data.addValue(stoppedEvent.StoppedEvents.ToString("#0")); } datasets.Add(data); GraphCategories = categories; GraphDataSet = datasets; }
/// <summary> /// Gets the data to be displayed at the printed report. /// </summary> protected override void GetGraphCategoriesAndDatasets() { var dataset = new FusionChartsDataset { Name = ddlVehiculo.SelectedItem.Text }; var categories = new List <string>(); foreach (var t in ReportObjectsList) { categories.Add(String.Format("{0:dd/MM}", t.Dia)); dataset.addValue(t.Velocidad.ToString("#0")); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { dataset }; }
protected override void GetGraphCategoriesAndDatasets() { var dataset = new FusionChartsDataset { Name = YAxisLabel }; var categories = new List <string>(); foreach (var t in ReportObjectsList) { categories.Add(t.Date.ToString("dd/MM")); dataset.addValue(t.Date.ToString("dd/MM")); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { dataset }; }
protected override void GetGraphCategoriesAndDatasets() { var dataset = new FusionChartsDataset { Name = ddlMovil.SelectedItem.Text }; var categories = new List <string>(); foreach (var t in ReportObjectsList) { categories.Add(String.Format("{0:dd/MM}", t.Fecha)); dataset.addValue(t.Kilometers.ToString(CultureInfo.InvariantCulture)); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { dataset }; }
protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var data = new FusionChartsDataset { Name = YAxisLabel }; var categories = new List <string>(); for (var i = 0; i < ReportObjectsList.Count; i++) { categories.Add(ReportObjectsList[i].Interno); data.addValue(HoursValue(i)); } datasets.Add(data); GraphCategories = categories; GraphDataSet = datasets; }
protected override void GetGraphCategoriesAndDatasets() { var dataset = new FusionChartsDataset { Name = YAxisLabel }; var categories = new List <string>(); foreach (var pair in _meses) { categories.Add(pair.Key); dataset.addValue(pair.Value.ToString()); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { dataset }; }
protected override void GetGraphCategoriesAndDatasets() { var dataset = new FusionChartsDataset { Name = YAxisLabel }; var categories = new List <string>(); foreach (var t in ReportObjectsList) { categories.Add(t.Empleado); dataset.addValue(t.ElapsedTime.ToString(CultureInfo.InvariantCulture)); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { dataset }; }
protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var data = new FusionChartsDataset { Name = YAxisLabel }; var categories = new List <string>(); foreach (var checkout in ReportObjectsList) { categories.Add(checkout.Fecha.ToString("HH:mm")); data.addValue(checkout.Cantidad.ToString(CultureInfo.InvariantCulture)); } datasets.Add(data); GraphCategories = categories; GraphDataSet = datasets; }
/// <summary> /// Gets the graph XML file. /// </summary> /// <returns></returns> protected override string GetGraphXml() { var datasets = new List <FusionChartsDataset>(); using (var helper = new FusionChartsMultiSeriesHelper()) { SetGraphProperties(helper); var flag = true; var colores = new ColorGenerator(); foreach (var m in _horas.Keys) { var horas = new FusionChartsDataset(); var descripcion = DAOFactory.CaudalimetroDAO.FindById(m).Descripcion; horas.SetPropertyValue("seriesName", descripcion); horas.SetPropertyValue("color", HexColorUtil.ColorToHex(colores.GetNextColor())); var list = _horas[m]; if (list.Count.Equals(0)) { continue; } foreach (var h in list) { if (flag) { helper.AddCategory(h.Fecha.ToShortDateString()); } horas.addValue(h.HsEnMarcha.ToString(CultureInfo.InvariantCulture)); } flag = false; helper.AddDataSet(horas); datasets.Add(horas); } var categories = new List <string>(); categories.AddRange(helper.GetCategoriesList()); GraphCategories = categories; GraphDataSet = datasets; return(helper.BuildXml()); } }
protected override void GetGraphCategoriesAndDatasets() { var datasets = new List <FusionChartsDataset>(); var categories = new List <string>(); var iniDate = SecurityExtensions.ToDataBaseDateTime(dtpDate.SelectedDate.GetValueOrDefault()); var finDate = SecurityExtensions.ToDataBaseDateTime(dtpDate.SelectedDate.GetValueOrDefault()).AddHours(23).AddMinutes(59).AddSeconds(59); var colorGen = new ColorGenerator(); var noCategoriesAdded = true; if (lbBase.GetSelectedIndices().Length == 0) { lbBase.ToogleItems(); } foreach (var index in lbBase.GetSelectedIndices()) { var data = ReportFactory.IdleTimesDAO.GetAllMovilesStoppedInPlanta(Convert.ToInt32((string)lbBase.Items[index].Value), iniDate, finDate, chkUndefined.Checked); var dataset = new FusionChartsDataset { Name = lbBase.Items[index].Text }; dataset.SetPropertyValue("color", HexColorUtil.ColorToHex(colorGen.GetNextColor())); foreach (var item in data) { if (noCategoriesAdded) { categories.Add(item.Date.ToShortTimeString()); } dataset.addValue(item.TotalVehicles.ToString(CultureInfo.InvariantCulture)); } datasets.Add(dataset); noCategoriesAdded = false; } GraphCategories = categories; GraphDataSet = datasets; }
/// <summary> /// Adds tank level variation. /// </summary> /// <param name="helper"></param> private void AddTankLevelVariation(FusionChartsMultiSeriesHelper helper) { var niveles = new FusionChartsDataset(); var labelInterval = (ReportObjectsList.Count / _MAX_LABELS) + 1; var i = labelInterval; int resto; Math.DivRem(Convert.ToInt32(npIntervalo.Value), 1440, out resto); var printOnlyDate = resto.Equals(0); niveles.SetPropertyValue("seriesName", ddlTanque.SelectedItem.Text); niveles.SetPropertyValue("color", HexColorUtil.ColorToHex(Color.SteelBlue)); if (ReportObjectsList.Any(o => o.VolumenConsumido > 0.01)) { foreach (var nivel in ReportObjectsList) { var str = string.Empty; if (i.Equals(labelInterval)) { str = printOnlyDate ? String.Format("{0}", nivel.Fecha.ToShortDateString()) : String.Format("{0} - {1}", nivel.Fecha.ToShortDateString(), nivel.Fecha.ToShortTimeString()); i = 0; } i++; helper.AddCategory(str); niveles.addValue(nivel.VolumenConsumido.ToString(CultureInfo.InvariantCulture)); } } helper.AddDataSet(niveles); }
protected override void GetGraphCategoriesAndDatasets() { var avgConsumption = (from nivel in ReportObjectsList select nivel.Consumo).Average(); var consumos = new FusionChartsDataset { Name = string.Format("{0}: {1}lit", CultureManager.GetLabel("CONSUMO"), (int)avgConsumption) }; var avgCaudal = (from nivel in ReportObjectsList select nivel.Caudal).Average(); var caudal = new FusionChartsDataset { Name = string.Format("{0}: {1}lit", CultureManager.GetLabel("CAUDAL"), (int)avgCaudal) }; int resto; Math.DivRem(Convert.ToInt32(npIntervalo.Value), 1440, out resto); var printOnlyDate = resto.Equals(0); var categories = ReportObjectsList.Select(nivel => printOnlyDate ? String.Format("{0}", nivel.Fecha.ToShortDateString()) : String.Format("{0} - {1}", nivel.Fecha.ToShortDateString(), nivel.Fecha.ToShortTimeString())).ToList(); foreach (var nivel in ReportObjectsList) { caudal.addValue(nivel.Caudal.ToString(CultureInfo.InvariantCulture)); } foreach (var dia in ReportObjectsList) { consumos.addValue(dia.Consumo.ToString(CultureInfo.InvariantCulture)); } GraphCategories = categories; GraphDataSet = new List <FusionChartsDataset> { caudal, consumos }; }
protected void CreateGraphic(List <Pedido> list) { try { using (var helper = new FusionChartsMultiSeriesHelper()) { var carga = GetCarga(null); var bocas = cbBocaDeCarga.Selected > 0 ? new List <BocaDeCarga> { DAOFactory.BocaDeCargaDAO.FindById(cbBocaDeCarga.Selected) } : DAOFactory.BocaDeCargaDAO.GetList(new[] { cbEmpresa.Selected }, new[] { cbLinea.Selected }); var inicio = bocas.Min(boca => GetInicioActividad(boca)); var fin = bocas.Max(boca => GetFinActividad(boca)); var rendimiento = bocas.Sum(boca => boca.Rendimiento); var tiempoPromedio = Convert.ToInt32(_tiempoCiclos.Sum() / CantidadTotal); var prev = 0; double maxValue = rendimiento; var maxMixers = CantidadMixers; #region DataSet Rendimiento (Trendline) var dataSetTrendLineRendimiento = new FusionChartsDataset(); dataSetTrendLineRendimiento.SetPropertyValue("seriesName", CultureManager.GetLabel("RENDIMIENTO")); dataSetTrendLineRendimiento.SetPropertyValue("color", "c30000"); dataSetTrendLineRendimiento.SetPropertyValue("parentYAxis", "S"); dataSetTrendLineRendimiento.SetPropertyValue("showAnchors", "0"); dataSetTrendLineRendimiento.SetPropertyValue("alpha", "60"); dataSetTrendLineRendimiento.SetPropertyValue("lineThickness", "2"); helper.AddDataSet(dataSetTrendLineRendimiento); #endregion #region DataSet Volumen por Hora (Barras) var dataSetVolumen = new FusionChartsDataset(); dataSetVolumen.SetPropertyValue("seriesName", CultureManager.GetLabel("PROGRAMACION_VOLUMEN_HORA")); dataSetVolumen.SetPropertyValue("color", "6868c3"); dataSetVolumen.SetPropertyValue("parentYAxis", "P"); helper.AddDataSet(dataSetVolumen); #endregion #region DataSet Mixers Disponibles (Trendline) var dataSetTrendLineMixers = new FusionChartsDataset(); dataSetTrendLineMixers.SetPropertyValue("seriesName", CultureManager.GetLabel("AVAILABLE_VEHICLES")); dataSetTrendLineMixers.SetPropertyValue("color", "c39600"); dataSetTrendLineMixers.SetPropertyValue("parentYAxis", "S"); dataSetTrendLineMixers.SetPropertyValue("showAnchors", "0"); dataSetTrendLineMixers.SetPropertyValue("alpha", "60"); dataSetTrendLineMixers.SetPropertyValue("lineThickness", "2"); helper.AddDataSet(dataSetTrendLineMixers); #endregion #region DataSet Mixers Equivalentes (Linea) var dataSetMixers = new FusionChartsDataset(); dataSetMixers.SetPropertyValue("seriesName", CultureManager.GetLabel("PROGRAMACION_MIXERS_EQUIVALENTES")); dataSetMixers.SetPropertyValue("color", "009900"); dataSetMixers.SetPropertyValue("parentYAxis", "S"); dataSetMixers.SetPropertyValue("anchorSides", "10"); dataSetMixers.SetPropertyValue("anchorRadius", "3"); dataSetMixers.SetPropertyValue("anchorBorderColor", "009900"); helper.AddDataSet(dataSetMixers); #endregion #region Llenado de Categorias y Valores for (var i = inicio; i <= fin; i = i.Add(TimeSpan.FromHours(1))) { var hora = Convert.ToInt32(i.Hours); var val = _volumenPorHora.ContainsKey(hora) ? _volumenPorHora[hora] : 0; var mix = (int)Math.Ceiling(1.0 * val / carga); var equi = (int)Math.Round((prev + mix) * tiempoPromedio / TiempoReferencia); helper.AddCategory(FormatTimeSpan(i)); dataSetVolumen.addValue(val.ToString().Replace(',', '.')); dataSetMixers.addValue(equi.ToString()); if (val > maxValue) { maxValue = val; } if (equi > maxMixers) { maxMixers = equi; } prev = mix; } #endregion #region Calculo proporcional de maximos y trendlines maxMixers++; maxValue++; int divlines; if (maxValue > maxMixers) { while (Math.Round(maxValue) % maxMixers != 0) { maxValue++; } divlines = Convert.ToInt32(maxValue / maxMixers); } else { while (maxMixers % Math.Round(maxValue) != 0) { maxMixers++; } divlines = Convert.ToInt32(maxMixers / maxValue); } var rend = rendimiento * maxMixers * 1.0 / maxValue; for (var i = inicio; i <= fin; i = i.Add(TimeSpan.FromHours(1))) { dataSetTrendLineRendimiento.addValue(rend.ToString(CultureInfo.InvariantCulture)); dataSetTrendLineMixers.addValue(CantidadMixers.ToString()); } #endregion #region Valores de Cabecera helper.AddConfigEntry("caption", ""); helper.AddConfigEntry("xAxisName", CultureManager.GetLabel("HORA")); helper.AddConfigEntry("PyAxisName", CultureManager.GetLabel("VOLUMEN")); helper.AddConfigEntry("SyAxisName", CultureManager.GetLabel("VEHICULOS")); helper.AddConfigEntry("decimalPrecision", "0"); helper.AddConfigEntry("showValues", "0"); helper.AddConfigEntry("numberSuffix", ""); helper.AddConfigEntry("rotateNames", "1"); helper.AddConfigEntry("limitsDecimalPrecision", "0"); helper.AddConfigEntry("hoverCapSepChar", "-"); helper.AddConfigEntry("divLineAlpha", "60"); helper.AddConfigEntry("showAlternateHGridColor", "1"); helper.AddConfigEntry("alternateHGridColor", "d8d8d8"); helper.AddConfigEntry("alternateHGridAlpha", "60"); helper.AddConfigEntry("zeroPlaneThickness", "20"); helper.AddConfigEntry("numDivLines", (divlines - 1).ToString()); helper.AddConfigEntry("SyAxisMaxValue", maxMixers.ToString()); helper.AddConfigEntry("PyAxisMaxValue", Math.Round(maxValue).ToString()); #endregion litGraph.Text = FusionCharts.RenderChartHTML("../FusionCharts/FCF_MSColumn2DLineDY.swf", "", helper.BuildXml(), "Report", (sizeField.Width).ToString(), (sizeField.Heigth).ToString(), false); } } catch (Exception ex) { ShowError(ex); } }