91 lines
3.4 KiB
Plaintext
91 lines
3.4 KiB
Plaintext
|
|
using System;
|
||
|
|
using System.Windows;
|
||
|
|
using System.Windows.Input;
|
||
|
|
using C1.WPF.Chart;
|
||
|
|
using DTS.Common.Interface;
|
||
|
|
|
||
|
|
// ReSharper disable CheckNamespace
|
||
|
|
|
||
|
|
namespace DTS.Viewer.Graph
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// Interaction logic for TestDataSeriesView.xaml
|
||
|
|
/// </summary>
|
||
|
|
public partial class TestDataView : ITestDataView
|
||
|
|
{
|
||
|
|
//bool zooming = false;
|
||
|
|
//Point ptStart = new Point();
|
||
|
|
public TestDataView()
|
||
|
|
{
|
||
|
|
InitializeComponent();
|
||
|
|
//Loaded += TestDataView_Loaded;
|
||
|
|
}
|
||
|
|
|
||
|
|
//private void TestDataView_Loaded(object sender, RoutedEventArgs e)
|
||
|
|
//{
|
||
|
|
// SetupChart();
|
||
|
|
//}
|
||
|
|
|
||
|
|
//void SetupChart()
|
||
|
|
//{
|
||
|
|
// MainChart.AddHandler(C1FlexChart.MouseLeftButtonDownEvent, new MouseButtonEventHandler(MainChart_MouseLeftButtonDown), true);
|
||
|
|
// MainChart.AddHandler(C1FlexChart.MouseMoveEvent, new MouseEventHandler(MainChart_MouseMove), true);
|
||
|
|
// MainChart.AddHandler(C1FlexChart.MouseLeftButtonUpEvent, new MouseButtonEventHandler(MainChart_MouseLeftButtonUp), true);
|
||
|
|
//}
|
||
|
|
//private void MainChart_MouseMove(object sender, MouseEventArgs e)
|
||
|
|
//{
|
||
|
|
// // when zooming update selection range
|
||
|
|
// if (zooming)
|
||
|
|
// {
|
||
|
|
// var currentPosition = e.GetPosition(MainChart);
|
||
|
|
// Point ptCurrent = currentPosition;
|
||
|
|
// // Draw new frame
|
||
|
|
// DrawReversibleRectangle(ptStart, ptCurrent);
|
||
|
|
// }
|
||
|
|
//}
|
||
|
|
//private void MainChart_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||
|
|
//{
|
||
|
|
// ReversibleFrameContainer.Visibility = Visibility.Visible;
|
||
|
|
// // // Start zooming
|
||
|
|
// zooming = true;
|
||
|
|
// // // Save starting point of selection rectangle
|
||
|
|
// ptStart = e.GetPosition(MainChart);
|
||
|
|
// MainChart.CaptureMouse();
|
||
|
|
//}
|
||
|
|
//private void MainChart_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||
|
|
//{
|
||
|
|
// //End zooming
|
||
|
|
// zooming = false;
|
||
|
|
// ReversibleFrameContainer.Visibility = Visibility.Collapsed;
|
||
|
|
// ReversibleFrame.Rect = new Rect();
|
||
|
|
// var currentPosition = e.GetPosition(MainChart);
|
||
|
|
// PerformZoom(ptStart, currentPosition);
|
||
|
|
// //Clean up
|
||
|
|
// ptStart = new Point();
|
||
|
|
// MainChart.ReleaseMouseCapture();
|
||
|
|
//}
|
||
|
|
//private void PerformZoom(Point ptStart, Point ptLast)
|
||
|
|
//{
|
||
|
|
// var p1 = MainChart.PointToData(ptStart);
|
||
|
|
// var p2 = MainChart.PointToData(ptLast);
|
||
|
|
// MainChart.BeginUpdate();
|
||
|
|
// // Update axes with new limits
|
||
|
|
// MainChart.AxisX.Min = Math.Min(p1.X, p2.X);
|
||
|
|
// MainChart.AxisY.Min = Math.Min(p1.Y, p2.Y);
|
||
|
|
// MainChart.AxisX.Max = Math.Max(p1.X, p2.X);
|
||
|
|
// MainChart.AxisY.Max = Math.Max(p1.Y, p2.Y);
|
||
|
|
// MainChart.EndUpdate();
|
||
|
|
//}
|
||
|
|
|
||
|
|
//private void DrawReversibleRectangle(Point p1, Point p2)
|
||
|
|
//{
|
||
|
|
// // Normalize the rectangle
|
||
|
|
// var rc = new Rect(Math.Min(p1.X, p2.X), Math.Min(p1.Y, p2.Y),
|
||
|
|
// Math.Abs(p2.X - p1.X), Math.Abs(p2.Y - p1.Y));
|
||
|
|
|
||
|
|
// // Draw the reversible frame
|
||
|
|
// ReversibleFrame.Rect = rc;
|
||
|
|
//}
|
||
|
|
}
|
||
|
|
}
|