DataViewChart.xaml.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. using SciChart.Charting.Visuals.Axes;
  17. using SciChart.Charting.Visuals.RenderableSeries;
  18. using SciChart.Core.Framework;
  19. using SciChart.Data.Model;
  20. namespace MECF.Framework.UI.Client.ClientBase.UserControls
  21. {
  22. /// <summary>
  23. /// DataViewChart.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class DataViewChart : UserControl
  26. {
  27. public DataViewChart()
  28. {
  29. InitializeComponent();
  30. }
  31. #region Dependency Properties
  32. public static readonly DependencyProperty RenderableSeriesProperty = DependencyProperty.Register(
  33. "RenderableSeries", typeof(ObservableCollection<IRenderableSeries>), typeof(DataViewChart), new PropertyMetadata(default(ObservableCollection<IRenderableSeries>)));
  34. public ObservableCollection<IRenderableSeries> RenderableSeries
  35. {
  36. get => (ObservableCollection<IRenderableSeries>)GetValue(RenderableSeriesProperty);
  37. set => SetValue(RenderableSeriesProperty, value);
  38. }
  39. public static readonly DependencyProperty AutoRangeProperty = DependencyProperty.Register(
  40. "AutoRange", typeof(AutoRange), typeof(DataViewChart), new PropertyMetadata(default(AutoRange)));
  41. public AutoRange AutoRange
  42. {
  43. get => (AutoRange)GetValue(AutoRangeProperty);
  44. set => SetValue(AutoRangeProperty, value);
  45. }
  46. public static readonly DependencyProperty VisibleRangeTimeProperty = DependencyProperty.Register(
  47. "VisibleRangeTime", typeof(IRange), typeof(DataViewChart), new PropertyMetadata(default(IRange)));
  48. public IRange VisibleRangeTime
  49. {
  50. get => (IRange)GetValue(VisibleRangeTimeProperty);
  51. set => SetValue(VisibleRangeTimeProperty, value);
  52. }
  53. public static readonly DependencyProperty VisibleRangeValueProperty = DependencyProperty.Register(
  54. "VisibleRangeValue", typeof(IRange), typeof(DataViewChart), new PropertyMetadata(default(IRange)));
  55. public IRange VisibleRangeValue
  56. {
  57. get => (IRange)GetValue(VisibleRangeValueProperty);
  58. set => SetValue(VisibleRangeValueProperty, value);
  59. }
  60. public string Direction
  61. {
  62. get { return (string)GetValue(DirectionProperty); }
  63. set { SetValue(DirectionProperty, value); }
  64. }
  65. // Using a DependencyProperty as the backing store for Direction. This enables animation, styling, binding, etc...
  66. public static readonly DependencyProperty DirectionProperty =
  67. DependencyProperty.Register("Direction", typeof(string), typeof(DataViewChart), new PropertyMetadata("XYDirection"));
  68. #endregion
  69. #region Methods
  70. public void ZoomExtents()
  71. {
  72. sciChart.ZoomExtents();
  73. }
  74. public IUpdateSuspender SuspendSuspendUpdates()
  75. {
  76. return sciChart.SuspendUpdates();
  77. }
  78. #endregion
  79. #region Events
  80. private void BtnFixCurveToScreen_OnPreviewMouseUp(object sender, MouseButtonEventArgs e)
  81. {
  82. sciChart.ZoomExtents();
  83. }
  84. #endregion
  85. }
  86. }