/// <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); }
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()); } }