public void UpdateStatisticals(List <GI.GraphColunm> GraphData, double TotalValue, int Statistical_UseIndexIs, bool IsPieChartEnabled, int TimeElementsIndex) { int Index = SenderWindow.ItemStack.Children.IndexOf(this); if (ItemURLTextBox.Text != "" && ItemXPathTextBox.Text != "") { if (GraphData[0].GraphElements != null && GraphData[1].GraphElements != null) { if (GraphData[0].GraphElements.Count > 0 && GraphData[1].GraphElements.Count > 0) { ItemValueLabel.Content = "Value: " + GraphData[0].GraphElements[Index].Value[Statistical_UseIndexIs]; ItemValueLabel.ToolTip = "( " + GraphData[0].TimeTable + " )"; if (IsPieChartEnabled) { double ShareVal = (((double)GraphData[0].GraphElements[Index].Value[Statistical_UseIndexIs] / TotalValue) * 100); ItemShareLabel.Content = "Share: " + (int)ShareVal + "%"; } else { ItemShareLabel.Content = "Share: Disabled"; } ItemShareLabel.ToolTip = "( " + GraphData[0].TimeTable + " )"; double ChangeVal = GraphData[0].GraphElements[Index].Value[0] - GraphData[1].GraphElements[Index].Value[0]; ItemChangeLabel.Foreground = GI.GetColorFromPosNegNeuValue(ChangeVal, (Brush)Application.Current.FindResource("StandartItemDesignGoodColor"), (Brush)Application.Current.FindResource("StandartItemDesignBadColor"), (Brush)Application.Current.FindResource("StandartItemDesignLabelsForground")); ItemChangeLabel.Content = "Change: " + ChangeVal; ItemChangeLabel.ToolTip = "( " + GraphData[0].TimeTable + " )"; double AvrChange = 0; for (int j = 1; j < TimeElementsIndex - 1; j++) { if (GraphData[j].GraphElements.Count > 0) { if (GraphData[j + 1].GraphElements.Count > 0) { AvrChange += GraphData[j].GraphElements[Index].Value[Statistical_UseIndexIs] - GraphData[j + 1].GraphElements[Index].Value[Statistical_UseIndexIs]; } } } AvrChange = AvrChange / (TimeElementsIndex - 1); ItemAvrChangeLabel.Foreground = GI.GetColorFromPosNegNeuValue(AvrChange, (Brush)Application.Current.FindResource("StandartItemDesignGoodColor"), (Brush)Application.Current.FindResource("StandartItemDesignBadColor"), (Brush)Application.Current.FindResource("StandartItemDesignLabelsForground")); ItemAvrChangeLabel.Content = "Avr Change: " + Math.Round(AvrChange, 2); ItemAvrChangeLabel.ToolTip = "( " + GraphData[0].TimeTable + " )"; } } } }
void UpdateVisualData(List <GI.GraphColunm> Values) { //Avr change label double AvrChange = 0; for (int i = 0; i < (int)TimeElementsCombobox.SelectedValue - 1; i++) { AvrChange += SumOfList(Values[i], GMCValues.General_UseIndexIs) - SumOfList(Values[i + 1], GMCValues.General_UseIndexIs); } AvrChange = AvrChange / ((int)TimeElementsCombobox.SelectedValue - 1); AvrChangeLabel.Foreground = GI.GetColorFromPosNegNeuValue(AvrChange, (Brush)Application.Current.FindResource("StandartFrontGoodColor"), (Brush)Application.Current.FindResource("StandartFrontBadColor"), (Brush)Application.Current.FindResource("StandartFrontColor")); AvrChangeLabel.Content = "Avr Change: " + Math.Round(AvrChange, 2); AvrChangeLabel.ToolTip = new ToolTip { Content = "AVR(Value - Previous value)" };; //Total Label double HighestVal = 0; for (int i = 0; i < (int)TimeElementsCombobox.SelectedValue; i++) { double Moment = Math.Abs(SumOfList(Values[i], GMCValues.General_UseIndexIs)); if (Moment > HighestVal) { HighestVal = Moment; } } TotalLabel.Content = "Total: " + HighestVal; TotalLabel.ToolTip = new ToolTip { Content = "Total value on graph" }; //Charts UpdateColumnChart(Values, HighestVal); UpdatePieChart(Values, HighestVal); //Individual items data UpdateItemsStatisticalData(Values, HighestVal); }