예제 #1
0
    private void AddIndicator(SerialGraph graph) {
      Indicator indicator = new Indicator();

      Binding fillBinding = new Binding("Brush");
      fillBinding.Source = graph;
      indicator.SetBinding(Indicator.FillProperty, fillBinding);

      Binding strokeBinding = new Binding("PlotAreaBackground");
      strokeBinding.Source = this;
      indicator.SetBinding(Indicator.StrokeProperty, strokeBinding);

#if WINDOWS_PHONE
      indicator.ManipulationStarted += new EventHandler<ManipulationStartedEventArgs>(OnIndicatorManipulationStarted);
#else
            indicator.MouseEnter += new MouseEventHandler(OnIndicatorMouseEnter);
            indicator.MouseLeave += new MouseEventHandler(OnIndicatorMouseLeave);
#endif

      _indicators.Add(graph, indicator);
      AddIndicatorToCanvas(indicator);
    }
예제 #2
0
 private void DisplayBalloon(Indicator indicator) {
   _balloon.Text = indicator.Text;
   _balloon.Visibility = Visibility.Visible;
   _balloon.Measure(new Size(_graphCanvasDecorator.ActualWidth, _graphCanvasDecorator.ActualHeight));
   double balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty) - _balloon.DesiredSize.Width / 2 + indicator.ActualWidth / 2;
   if (balloonLeft < 0) {
     balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty);
   }
   else if (balloonLeft + _balloon.DesiredSize.Width > _graphCanvasDecorator.ActualWidth) {
     balloonLeft = (double)indicator.GetValue(Canvas.LeftProperty) - _balloon.DesiredSize.Width;
   }
   double balloonTop = (double)indicator.GetValue(Canvas.TopProperty) - _balloon.DesiredSize.Height - 5;
   if (balloonTop < 0) {
     balloonTop = (double)indicator.GetValue(Canvas.TopProperty) + 17;
   }
   _balloon.SetValue(Canvas.LeftProperty, balloonLeft);
   _balloon.SetValue(Canvas.TopProperty, balloonTop);
 }
예제 #3
0
 private void AddIndicatorToCanvas(Indicator indicator) {
   if (_graphCanvas != null) {
     _graphCanvas.Children.Add(indicator);
   }
 }