Пример #1
0
        /// <summary>
        /// Adds engine average consumption refference line.
        /// </summary>
        /// <param name="helper"></param>
        private void AddEnginesConsumptionTrendline(FusionChartsMultiSeriesHelper helper)
        {
            var trendline = new FusionChartsTrendline();

            var avgConsumption = (from nivel in ReportObjectsList select nivel.Consumo).Average();

            trendline.AddPropertyValue("startValue", string.Format("{0}", (int)avgConsumption));
            trendline.AddPropertyValue("displayValue", string.Format("{0}: {1}lit", CultureManager.GetLabel("CONSUMO"), (int)avgConsumption));
            trendline.AddPropertyValue("color", HexColorUtil.ColorToHex(Color.LightCoral));
            trendline.AddPropertyValue("thickness", "3");

            helper.AddTrendLine(trendline);
        }
Пример #2
0
        /// <summary>
        /// Adds a daily kilometers refference trendline.
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="vehicle"></param>
        private static void AddTrendline(FusionChartsHelper helper, Coche vehicle)
        {
            if (vehicle.KilometrosDiarios.Equals(0))
            {
                return;
            }

            var trendline = new FusionChartsTrendline();

            trendline.AddPropertyValue("startValue", Convert.ToInt32(vehicle.KilometrosDiarios).ToString("#0"));
            trendline.AddPropertyValue("displayValue", string.Format("{0}: {1}km", CultureManager.GetLabel(Refference), vehicle.KilometrosDiarios));
            trendline.AddPropertyValue("color", "91C728");
            trendline.AddPropertyValue("showOnTop", "1");

            helper.AddTrendLine(trendline);
        }
Пример #3
0
        protected override string GetGraphXml()
        {
            using (var helper = new FusionChartsHelper())
            {
                InitializeGraph(helper);

                var previousDateIndex = 0; //for saving last date putted in graph

                for (var i = 0; i < ReportObjectsList.Count; i++)
                {
                    var item = new FusionChartsItem();

                    if (i == 0)
                    {
                        item.AddPropertyValue("name", ReportObjectsList[i].Fecha);
                    }
                    else
                    {
                        if ((DateTime.Parse(ReportObjectsList[previousDateIndex].Fecha).Minute
                             != DateTime.Parse(ReportObjectsList[i].Fecha).Minute) &&
                            ((i - previousDateIndex) > PointsDistance))  //filters minimum distance between dates (points in graph)
                        {
                            item.AddPropertyValue("name", DateTime.Parse(ReportObjectsList[i].Fecha).TimeOfDay.ToString());
                            previousDateIndex = i; //saves the index of the most recently date putted in graph
                        }
                    }
                    item.AddPropertyValue("hoverText", DateTime.Parse(ReportObjectsList[i].Fecha).TimeOfDay.ToString());
                    item.AddPropertyValue("value", ReportObjectsList[i].Valor.Replace(',', '.'));

                    helper.AddItem(item);
                }

                if (Subentidad > 0)
                {
                    var subentidad = DAOFactory.SubEntidadDAO.FindById(Subentidad);
                    if (subentidad != null && subentidad.Sensor != null &&
                        subentidad.Sensor.TipoMedicion != null && subentidad.Sensor.TipoMedicion.ControlaLimites)
                    {
                        if (subentidad.ControlaMaximo)
                        {
                            var topInterval = new FusionChartsTrendline();
                            topInterval.AddPropertyValue("value", subentidad.Maximo.ToString(CultureInfo.InvariantCulture));
                            topInterval.AddPropertyValue("color", "ED1C24");
                            helper.AddTrendLine(topInterval);
                        }
                        if (subentidad.ControlaMinimo)
                        {
                            var lowInterval = new FusionChartsTrendline();
                            lowInterval.AddPropertyValue("value", subentidad.Minimo.ToString(CultureInfo.InvariantCulture));
                            lowInterval.AddPropertyValue("color", "579657");
                            helper.AddTrendLine(lowInterval);
                        }
                    }
                }

                if (ReportObjectsList.Count.Equals(0))
                {
                    ThrowError("NO_MATCHES_FOUND");
                }

                return(helper.BuildXml());
            }
        }