示例#1
0
        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);
            }
        }
示例#2
0
        /// <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());
            }
        }