WPF(x64) tool drawline is not moved on dragging

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Eskimo17
Newbie
Newbie
Posts: 1
Joined: Mon Nov 09, 2009 12:00 am

WPF(x64) tool drawline is not moved on dragging

Post by Eskimo17 » Fri Feb 21, 2014 10:34 am

Hi,

the drawline is not moved on dragging on c# wpf(x64). We are using tee chart for .net (Version .NET 2013 4.1.2013.07300)
The position of the line is changed on dragging, but the line is not moved to the new position.

Screenshot:
Begin.png
Begin.png (51.66 KiB) Viewed 5103 times
After selected with the mouse and dragging around, the black line isn't move at it should, but the labels start and endposition
are at the new position.

Following code shows the behavior:

XAML:

Code: Select all

<Window x:Class="WpfTestTeeChart.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:my="clr-namespace:Steema.TeeChart.WPF;assembly=TeeChart.WPF"
        Title="MainWindow" Height="350" Width="525">
    <Grid Name="NameGrid">
		<Grid.RowDefinitions>
			<RowDefinition Height="90*"></RowDefinition>
			<RowDefinition Height="10*"></RowDefinition>
		</Grid.RowDefinitions>		
		<AdornerDecorator>
			<my:TChart Margin="0,0,0,0" Name="MyTeeChart" Grid.Row="2" />
		</AdornerDecorator>
		<Label Content="Start" Height="28" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" Grid.Row="1" />
		<Label Content="End" Height="28" HorizontalAlignment="Left" Margin="133,0,0,0" Name="label2" VerticalAlignment="Top" Grid.Row="1" />
	</Grid>
</Window>
cs

Code: Select all

namespace WpfTestTeeChart
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		private Steema.TeeChart.WPF.Styles.Line _lineSeries1;
		private Steema.TeeChart.WPF.Tools.DrawLine _drawLine1;

		public MainWindow()
		{
			InitializeComponent();

			// Set chart properties
			MyTeeChart.Aspect.View3D = false;
			MyTeeChart.Header.Text = "Test for Tool DragLine";
			MyTeeChart.AutoRepaint = true;

			// Create line series and set properities and add to series
			_lineSeries1 = new Steema.TeeChart.WPF.Styles.Line();
			_lineSeries1.Color = System.Windows.Media.Colors.Blue;
			_lineSeries1.ColorEach = false;
			_lineSeries1.LinePen.Color = System.Windows.Media.Colors.Green;
			_lineSeries1.Title = "lineSeries1";
			_lineSeries1.XValues.DataMember = "X";
			_lineSeries1.XValues.Order = Steema.TeeChart.WPF.Styles.ValueListOrder.Ascending;
			_lineSeries1.YValues.DataMember = "Y";
			_lineSeries1.FillSampleValues();
			MyTeeChart.Series.Add(_lineSeries1);

			// Create drawline and set properties and add to tools
			_drawLine1 = new Steema.TeeChart.WPF.Tools.DrawLine();
			_drawLine1.EnableDraw = false;
			_drawLine1.EnableSelect = true;
			_drawLine1.Style = Steema.TeeChart.WPF.Tools.DrawLineStyle.Line;
			_drawLine1.DragLine += new Steema.TeeChart.WPF.Tools.DrawLineEventHandler(drawLine1_DragLine);			
			MyTeeChart.Tools.Add(_drawLine1);

			Steema.TeeChart.WPF.Tools.DrawLineItem drawLineItem = new Steema.TeeChart.WPF.Tools.DrawLineItem(_drawLine1);
			double tmp = _lineSeries1.YValues.Range / 5.0;
			drawLineItem.StartPos = new Steema.TeeChart.WPF.Drawing.PointDouble(5, _lineSeries1.YValues.Maximum - tmp);
			drawLineItem.EndPos = new Steema.TeeChart.WPF.Drawing.PointDouble(15, _lineSeries1.YValues.Minimum + tmp);
			drawLineItem.Pen.Color = System.Windows.Media.Colors.Black;
			drawLineItem.Pen.Width = 4;
		}

		private void drawLine1_DragLine(Steema.TeeChart.WPF.Tools.DrawLine sender)
		{
			ShowDrawLinePosition();
		}

		private void ShowDrawLinePosition()
		{
			Steema.TeeChart.WPF.Tools.DrawLineItem I = _drawLine1.Selected;
			label1.Content = "Start: (x: " + I.StartPos.X.ToString("0.00") + ", y: " + I.StartPos.Y.ToString("0.00") + ")";
			label2.Content = "End: (x: " + I.EndPos.X.ToString("0.00") + ", y: " + I.EndPos.Y.ToString("0.00") + ")";
		}
	}
}
Some Suggestions ?

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: WPF(x64) tool drawline is not moved on dragging

Post by Christopher » Fri Feb 21, 2014 12:13 pm

Hello,
Eskimo17 wrote:Some Suggestions ?
Yes, you can use this:

Code: Select all

 public MainWindow()
    {
      //... other code ...
      MyTeeChart.MouseUp += MyTeeChart_MouseUp;
      MyTeeChart.MouseMove += MyTeeChart_MouseMove;

    }

    void MyTeeChart_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
    {
      _drawLine1.EnableDraw = true;
    }

    void MyTeeChart_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
    {
      _drawLine1.EnableDraw = true;
    }
I will add similar code internally to the source code to enable this to work directly.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply