private static void OnContentBoundsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { IPlotterElement element = d as IPlotterElement; if (element != null) { FrameworkElement frElement = element as FrameworkElement; if (frElement != null) { frElement.RaiseEvent(new RoutedEventArgs(ContentBoundsChangedEvent)); } Plotter2D plotter2d = element.Plotter as Plotter2D; if (plotter2d != null) { plotter2d.Viewport.UpdateContentBoundsHosts(); } } }
public Viewport2D(FrameworkElement host, Plotter2D plotter) { hostElement = host; host.ClipToBounds = true; host.SizeChanged += OnHostElementSizeChanged; this.plotter = plotter; plotter.Children.CollectionChanged += OnPlotterChildrenChanged; restrictions = new RestrictionCollection(this); restrictions.Add(new MinimalSizeRestriction()); restrictions.CollectionChanged += restrictions_CollectionChanged; fitToViewRestrictions = new RestrictionCollection(this); fitToViewRestrictions.CollectionChanged += fitToViewRestrictions_CollectionChanged; readonlyContentBoundsHosts = new ReadOnlyObservableCollection <DependencyObject>(contentBoundsHosts); UpdateVisible(); UpdateTransform(); }
/// <summary> /// Adds one dimensional graph. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineColor">Color of the line.</param> /// <param name="lineThickness">The line thickness.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Color lineColor, double lineThickness) { return(AddLineGraph(plotter, pointSource, new Pen(new SolidColorBrush(lineColor), lineThickness), null)); }
/// <summary> /// Adds one dimensional graph with random color if line. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineThickness">The line thickness.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, double lineThickness) { return(AddLineGraph(plotter, pointSource, ColorHelper.CreateRandomHsbColor(), lineThickness)); }
/// <summary> /// Adds one dimensional graph with specified color of line. /// </summary> /// <param name="pointSource">The point source.</param> /// <param name="lineColor">Color of the line.</param> /// <returns></returns> public static LineGraph AddLineGraph(this Plotter2D plotter, IPointDataSource pointSource, Color lineColor) { return(AddLineGraph(plotter, pointSource, lineColor, 1)); }