public void TestAddingToPlotter()
		{
			HorizontalLine line = new HorizontalLine { Value = 0.2 };
			ChartPlotter plotter = new ChartPlotter();
			plotter.Children.Add(line);

			VerticalLine line2 = new VerticalLine { Value = 0.1 };
			plotter.Children.Add(line2);

			VerticalRange range = new VerticalRange { Value1 = 0.1, Value2 = 0.3 };
			plotter.Children.Add(range);

			RectangleHighlight rect = new RectangleHighlight { Bounds = new Rect(0, 0, 1, 1) };
			plotter.Children.Add(rect);
		}
		public SelectorPlotter()
		{
			Viewport.Constraints.Add(new FixedXConstraint());
			Viewport.Domain = DataRect.Create(0, 0, 1, 1);

			Children.Remove(MainHorizontalAxis);
			Children.Remove(MainVerticalAxis);
			Children.Remove(HorizontalAxisNavigation);
			Children.Remove(VerticalAxisNavigation);
			Children.Remove(AxisGrid);
			Children.Remove(DefaultContextMenu);
			Children.Remove(MouseNavigation);
			Children.Remove(Legend);
			Children.Remove(Legend);

			leftHighlight = new RectangleHighlight { Fill = highlightFill, Stroke = Brushes.DarkGray, Name = "Left_Highlight" };
			Children.Add(leftHighlight);
			rightHighlight = new RectangleHighlight { Fill = highlightFill, Stroke = Brushes.DarkGray, Name = "Right_Highlight" };
			Children.Add(rightHighlight);

			ResourceDictionary dict = new ResourceDictionary
			{
				Source = new Uri("/DynamicDataDisplay.Controls;component/Themes/Generic.xaml", UriKind.Relative)
			};

			Style plotterStyle = (Style)dict[typeof(SelectorPlotter)];
			Style = plotterStyle;
			Template = (ControlTemplate)(((Setter)plotterStyle.Setters[1]).Value);
			ApplyTemplate();

			Style draggablePointstyle = (Style)dict[typeof(TemplateableDraggablePoint)];
			marker.Style = draggablePointstyle;

			Panel content = (Panel)Content;
			content.MouseLeftButtonDown += CentralGrid_MouseLeftButtonDown;
			content.MouseLeftButtonUp += CentralGrid_MouseLeftButtonUp;

			selectorNavigation.MouseLeftButtonClick += new MouseButtonEventHandler(selectorNavigation_MouseLeftButtonClick);
			Children.Add(selectorNavigation);

			marker.PositionChanged += marker_PositionChanged;
			marker.PositionCoerceCallbacks.Add(CoerceMarkerPosition);
			marker.InvalidateProperty(PositionalViewportUIContainer.PositionProperty);
			Children.Add(marker);

			Viewport.PropertyChanged += Viewport_PropertyChanged;
			UpdateDomain();
		}
Example #3
0
 private void addRect(double value, double width)
 {
     RectangleHighlight rh = new RectangleHighlight();
     rh.Bounds = new Rect(new Point(value - width, 0), new Point(value, 0));
     rh.Stroke = new SolidColorBrush(Colors.OrangeRed);
     rh.StrokeThickness = 2;
     this.chart.Children.Add(rh);
 }
 public void AddTruthRect(int start, int end, Brush color, double height = 1)
 {
     RectangleHighlight rec = new RectangleHighlight();
     rec.Bounds = new System.Windows.Rect(start, 0, end - start, height);
     rec.Fill = color;
     rec.Opacity = 0.5;
     _rectList.Add(rec);
     //  _chartPlotter.Children.Add(rec);
 }