public void DrawDataPoint(double value, Brush barColor = null, Image toolTip = null, WrapBehavior wrapBehavior = WrapBehavior.Clear) { if (leftMargin >= graph.ActualWidth) { if (wrapBehavior == WrapBehavior.Clear) { leftMargin = 0; graph.Children.Clear(); } else { // Remove first element and shift all the others to the left by 1 graph.Children.RemoveAt(0); double widthPerChild = 6; for (int i = 0; i < graph.Children.Count; i++) { (graph.Children[i] as Control).Margin = new Thickness(widthPerChild * i, 0, 0, 0); } leftMargin -= widthPerChild; // Remove 20% element of the elements (from the beginning) and shift all the others to the left by that ammount //int removeCount = graph.Children.Count / 5; //for (int i = 0; i < removeCount; i++) //{ // graph.Children.RemoveAt(0); //} //double widthPerChild = 6; //for (int i = 0; i < graph.Children.Count; i++) //{ // (graph.Children[i] as Control).Margin = new Thickness(widthPerChild * i, 0, 0, 0); //} //leftMargin = (graph.Children.Count - 1) * widthPerChild; } } Control bar; if (this.BarType == BarType.UpDown) { var upDownBar = new UpDownVerticalBarControl(); upDownBar.DrawDataPoint(value, barColor != null ? barColor : DefaultBarColor, toolTip); bar = upDownBar; } else { var centeredBar = new CenteredVerticalBarControl(); centeredBar.DrawDataPoint(value, barColor != null ? barColor : DefaultBarColor, toolTip); bar = centeredBar; } bar.Width = 4; bar.HorizontalAlignment = HorizontalAlignment.Left; bar.Margin = new Thickness(leftMargin += (bar.Width + 2), 0, 0, 0); graph.Children.Add(bar); }
public CaseBehaviorBuilder Wrap(CaseBehaviorAction outer) { Behavior = new WrapBehavior(outer, Behavior); return(this); }
public CaseBehaviorBuilder Wrap(CaseBehaviorAction outer) { Behavior = new WrapBehavior(outer, Behavior); return this; }
public void DrawDataPoint(double value, Brush barColor = null, Image toolTip = null, WrapBehavior wrapBehavior = WrapBehavior.Clear) { if (leftMargin >= graph.ActualWidth) { if (wrapBehavior == WrapBehavior.Clear) { leftMargin = 0; graph.Children.Clear(); } else { graph.Children.RemoveAt(0); double widthPerChild = 6; for (int i = 0; i < graph.Children.Count; i++) { (graph.Children[i] as Control).Margin = new Thickness(widthPerChild * i, 0, 0, 0); } leftMargin -= widthPerChild; } } Control bar; if (this.BarType == BarType.UpDown) { var upDownBar = new UpDownVerticalBarControl(); upDownBar.DrawDataPoint(value, barColor != null ? barColor : DefaultBarColor, toolTip); bar = upDownBar; } else { var centeredBar = new CenteredVerticalBarControl(); centeredBar.DrawDataPoint(value, barColor != null ? barColor : DefaultBarColor, toolTip); bar = centeredBar; } bar.Width = 4; bar.HorizontalAlignment = HorizontalAlignment.Left; bar.Margin = new Thickness(leftMargin += (bar.Width + 2), 0, 0, 0); graph.Children.Add(bar); }