Quantcast
Channel: OxyPlot (moved to GitHub)
Viewing all articles
Browse latest Browse all 2061

New Post: Always displaying the tracker

$
0
0
A lineAnnotation doesn't work well.
In MouseEventExample -> Select range, I added a line annotation that always following the mouse, but PlotView cannot fire mouse events.
model.Annotations.Add(range);
var cursor = new LineAnnotation()
{
    Type = LineAnnotationType.Vertical,
    Color = OxyColors.Green,
    ClipByYAxis = false,
};
model.Annotations.Add(cursor);
........
model.MouseMove += (s, e) =>
{
cursor.X = cursor.InverseTransform(e.Position).X;
    if (!double.IsNaN(startx))
    {
        var x = range.InverseTransform(e.Position).X;
        range.MinimumX = Math.Min(x, startx);
        range.MaximumX = Math.Max(x, startx);
        range.Text = string.Format("∫ cos(x) dx =  {0:0.00}", Math.Sin(range.MaximumX) - Math.Sin(range.MinimumX));
        model.Subtitle = string.Format("Integrating from {0:0.00} to {1:0.00}", range.MinimumX, range.MaximumX);
        
        e.Handled = true;
    }
    model.InvalidatePlot(false);
};

Viewing all articles
Browse latest Browse all 2061

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>