Select a piece on ChartPlotter

May 16, 2013 at 5:27 AM
Edited May 16, 2013 at 5:52 AM
Hi All.

Please tell me how to select a piece on ChartPlotter I can not understand..
Image
May 16, 2013 at 11:51 AM
Edited May 16, 2013 at 11:52 AM
var v = plotter.Visible;
v.XMin = 4;
v.Width = 4;
plotter.Visible = v;
May 16, 2013 at 12:29 PM
thank you WarFollowsMe, but that's not what I need, I need to select any part of the mouse.

i need like thisImage
May 22, 2013 at 7:42 AM
Please help me, I do not understand.
Jun 27, 2013 at 6:13 AM
How to do like this for WPF
Jun 28, 2013 at 3:46 AM
Have you looked at the mousenavigation zoom functionality? It is similar to what you describe in the link.
Jun 28, 2013 at 4:15 AM
Hi

User Vertical Range for showing vertical rectangle Zone.
use mouse down, mouse move and mouse up events to construct Vertical range. Use Plotter Visible to zoom.

Search around the discussions, you will find the answer

Regards
Ravi.
Jul 1, 2013 at 6:51 AM
Edited Jul 1, 2013 at 9:13 AM
Thank you very much for your help, but I need not zoom, I need to select a piece of chart.
Jul 4, 2013 at 7:30 AM
Edited Jul 4, 2013 at 7:35 AM
how to use this in WPF

InteractWithCharts
Jul 15, 2013 at 12:54 PM
MainWindow.xaml
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <d3:ChartPlotter Name="plotter"/>
    </Grid>
</Window>
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Research.DynamicDataDisplay.Charts;
using Microsoft.Research.DynamicDataDisplay;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        VerticalRange vRange = new VerticalRange();
        bool isMouseDown = false;
        double psX = 0.0d;
        public MainWindow()
        {
            InitializeComponent();
            this.plotter.MouseDown += new MouseButtonEventHandler(plotter_MouseDown);
            this.plotter.MouseUp += new MouseButtonEventHandler(plotter_MouseUp);
            this.plotter.MouseMove += new MouseEventHandler(plotter_MouseMove);
            this.plotter.Children.Remove(this.plotter.MouseNavigation);
            this.plotter.Children.Remove(this.plotter.KeyboardNavigation);
            this.plotter.Children.Add(this.vRange);
        }

        void plotter_MouseMove(object sender, MouseEventArgs e)
        {
            if (!this.isMouseDown)
            {
                return;
            }

            Point pt = e.GetPosition(this.plotter.CentralGrid);
            Point ps = this.plotter.Viewport.Transform.ScreenToViewport(pt);
            if (ps.X > this.vRange.Value1)
            {
                this.vRange.Value2 = ps.X;
            }
            else
            {
                this.vRange.Value2 = this.psX;
                this.vRange.Value1 = ps.X;
            }
        }

        void plotter_MouseUp(object sender, MouseButtonEventArgs e)
        {
            this.isMouseDown = false;
            //this.vRange.Visibility = Visibility.Collapsed;
        }

        void plotter_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.isMouseDown = true;
            this.vRange.Visibility = Visibility.Visible;
            Point pt = e.GetPosition(this.plotter.CentralGrid);
            Point ps = this.plotter.Viewport.Transform.ScreenToViewport(pt);
           this.vRange.Value1 = ps.X;
         this.psX = ps.X;
            this.vRange.Value2 = ps.X + (ps.X * 1) / 100;
        }
    }
}
thank you very much for your help battula32