/// <summary> /// Label update /// </summary> private void updateTableLabels(TimeSeriesClasses.WasteTransfer data1, TimeSeriesClasses.WasteTransfer data2) { this.grdCompareDetails.Visible = true; List <CompareDetailElement> elements = new List <CompareDetailElement>(); elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Total"), data1 != null ? QuantityFormat.Format(data1.QuantityTotal, data1.QuantityUnit) : String.Empty, data2 != null ? QuantityFormat.Format(data2.QuantityTotal, data2.QuantityUnit) : String.Empty)); elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Recovery"), data1 != null ? QuantityFormat.Format(data1.QuantityRecovery, data1.QuantityUnit) : String.Empty, data2 != null ? QuantityFormat.Format(data2.QuantityRecovery, data2.QuantityUnit) : String.Empty)); elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Disposal"), data1 != null ? QuantityFormat.Format(data1.QuantityDisposal, data1.QuantityUnit) : String.Empty, data2 != null ? QuantityFormat.Format(data2.QuantityDisposal, data2.QuantityUnit) : String.Empty)); elements.Add(new CompareDetailElement(Resources.GetGlobal("Common", "Unspecified"), data1 != null ? QuantityFormat.Format(data1.QuantityUnspec, data1.QuantityUnit) : String.Empty, data2 != null ? QuantityFormat.Format(data2.QuantityUnspec, data2.QuantityUnit) : String.Empty)); // data binding this.grdCompareDetails.DataSource = elements; grdCompareDetails.DataBind(); }
protected string GetReportingFacilities(object obj) { TimeSeriesClasses.WasteTransfer row = (TimeSeriesClasses.WasteTransfer)obj; return(NumberFormat.Format(row.Facilities)); }
/// <summary> /// Data binding /// </summary> protected int GetYear(object obj) { TimeSeriesClasses.WasteTransfer row = (TimeSeriesClasses.WasteTransfer)obj; return(row.Year); }
/// <summary> /// Create trend sheet /// </summary> private void createTrendSheet(TrendWasteContent type, int facilityid, WasteTypeFilter.Type waste) { this.ucStackColumnTime.Visible = false; this.ucStackColumnCompare.Visible = false; this.ucYearCompareSeries.Visible = false; this.compareTable.Visible = false; // Get time series data, used by all sub sheets List <TimeSeriesClasses.WasteTransfer> data = getTimeSeriesData(facilityid, waste); // Time series sheet if (type == TrendWasteContent.TimeSeries) { ViewState[CONTENT_TYPE] = TrendWasteContent.TimeSeries; if (data != null && data.Count > 0) { this.ucStackColumnTime.Visible = true; Color[] colors = new Color[] { Global.ColorWasteRecovery, Global.ColorWasteDisposal, Global.ColorWasteUnspec }; ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None, ChartHatchStyle.None, ChartHatchStyle.None }; string[] legendTexts = new string[] { Resources.GetGlobal("Common", "TreatmentRecovery"), Resources.GetGlobal("Common", "TreatmentDisposal"), Resources.GetGlobal("Common", "TreatmentUnspecified") }; // initialize chart this.ucStackColumnTime.Initialize(colors.Length, StackColumnType.TimeSeries, WasteTransferTrend.CODE_TNE, colors, hatchStyles, legendTexts); List <TimeSeriesUtils.BarData> bars = new List <TimeSeriesUtils.BarData>(); // add data to chart foreach (var v in data) { string[] tip = new string[] { String.Format("{0}: {1}", Resources.GetGlobal("Common", "Year"), v.Year), String.Format("{0}: {1}", Resources.GetGlobal("Common", "Total"), QuantityFormat.Format(v.QuantityTotal, v.QuantityUnit)), String.Format("{0}: {1}", Resources.GetGlobal("Common", "Recovery"), QuantityFormat.Format(v.QuantityRecovery, v.QuantityUnit)), String.Format("{0}: {1}", Resources.GetGlobal("Common", "Disposal"), QuantityFormat.Format(v.QuantityDisposal, v.QuantityUnit)), String.Format("{0}: {1}", Resources.GetGlobal("Common", "Unspec"), QuantityFormat.Format(v.QuantityUnspec, v.QuantityUnit)) }; TimeSeriesUtils.BarData cd = new TimeSeriesUtils.BarData { Year = v.Year, Values = new double?[] { TimeSeriesUtils.RangeValue(v.QuantityRecovery), TimeSeriesUtils.RangeValue(v.QuantityDisposal), TimeSeriesUtils.RangeValue(v.QuantityUnspec) }, ToolTip = ToolTipFormatter.FormatLines(tip) }; bars.Add(cd); } //waste was not reported in EPER - hence do not include EPER years. this.ucStackColumnTime.Add(TimeSeriesUtils.InsertMissingYearsTimeSeries(bars, false)); } } // comparison if (type == TrendWasteContent.Comparison) { ViewState[CONTENT_TYPE] = TrendWasteContent.Comparison; if (data != null && data.Count > 0) { this.compareTable.Visible = true; // Create chart this.ucStackColumnCompare.Visible = true; ChartHatchStyle[] hatchStyles = new ChartHatchStyle[] { ChartHatchStyle.None, ChartHatchStyle.None, ChartHatchStyle.None }; //Color[] colors = new Color[] { Global.ColorWasteRecovery, Global.ColorWasteDisposal, Global.ColorWasteUnspec }; //string[] legendTexts = new string[]{Resources.GetGlobal("Common", "TreatmentDisposal"), // Resources.GetGlobal("Common", "TreatmentRecovery"), // Resources.GetGlobal("Common", "TreatmentUnspecified")}; Color[] colors = new Color[] { Global.ColorWasteRecovery, Global.ColorWasteDisposal, Global.ColorWasteUnspec }; string[] legendTexts = new string[] { Resources.GetGlobal("Common", "TreatmentRecovery"), Resources.GetGlobal("Common", "TreatmentDisposal"), Resources.GetGlobal("Common", "TreatmentUnspecified") }; this.ucStackColumnCompare.Initialize(colors.Length, StackColumnType.Comparison, WasteTransferTrend.CODE_TNE, colors, hatchStyles, legendTexts); // init year combo boxes this.ucYearCompareSeries.Visible = true; int year1 = this.ucYearCompareSeries.Year1; int year2 = this.ucYearCompareSeries.Year2; // reset resetLabels(); TimeSeriesClasses.WasteTransfer data1 = data.Where(d => d.Year == year1).DefaultIfEmpty(new TimeSeriesClasses.WasteTransfer(year1, waste)).Single(); TimeSeriesClasses.WasteTransfer data2 = data.Where(d => d.Year == year2).DefaultIfEmpty(new TimeSeriesClasses.WasteTransfer(year2, waste)).Single(); bool dataFound = data1 != null || data2 != null; if (dataFound) { TimeSeriesUtils.BarData dataFrom = new TimeSeriesUtils.BarData { Year = year1 }; TimeSeriesUtils.BarData dataTo = new TimeSeriesUtils.BarData { Year = year2 }; if (data1 != null) { dataFrom.Values = new double?[] { data1.QuantityRecovery, data1.QuantityDisposal, data1.QuantityUnspec }; } if (data2 != null) { dataTo.Values = new double?[] { data2.QuantityRecovery, data2.QuantityDisposal, data2.QuantityUnspec }; } // from and to bar this.ucStackColumnCompare.Add(new List <TimeSeriesUtils.BarData>() { dataFrom, dataTo }); updateTableLabels(data1, data2); } // display that no data found for the selected years this.lbNoDataForSelectedYears.Visible = !dataFound; } } }