コード例 #1
0
        private void AddIndicator(SerialGraph graph)
        {
            var indicator = new Indicator();

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

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

            indicator.MouseEnter += OnIndicatorMouseEnter;
            indicator.MouseLeave += OnIndicatorMouseLeave;

            _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));
     var 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;
     }
     var 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)
 {
     _graphCanvas?.Children.Add(indicator);
 }
コード例 #4
0
 private void AddIndicatorToCanvas(Indicator indicator)
 {
     _graphCanvas?.Children.Add(indicator);
 }