Exemplo n.º 1
0
        protected Chart()
        {
            var b = new Border();
            Canvas = new Canvas();
            b.Child = Canvas;
            Content = b;

            if (RandomizeStartingColor) ColorStartIndex = Randomizer.Next(0, Colors.Count - 1);

            AnimatesNewPoints = false;

            var defaultConfig = new SeriesConfiguration<double>().Y(x => x);
            SetCurrentValue(SeriesProperty, new SeriesCollection(defaultConfig));
            DataTooltip = new DefaultIndexedTooltip();
            Shapes = new List<FrameworkElement>();
            ShapesMapper = new List<ShapeMap>();
            PointHoverColor = System.Windows.Media.Colors.White;

            Background = Brushes.Transparent;

            SizeChanged += Chart_OnsizeChanged;
            MouseWheel += MouseWheelOnRoll;
            MouseLeftButtonDown += MouseDownForPan;
            MouseLeftButtonUp += MouseUpForPan;
            MouseMove += MouseMoveForPan;

            _resizeTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(100)
            };
            _resizeTimer.Tick += (sender, e) =>
            {
                _resizeTimer.Stop();
                Update();
            };
            TooltipTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(1000)
            };
            TooltipTimer.Tick += TooltipTimerOnTick;

            _serieValuesChanged = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(100)};
            _serieValuesChanged.Tick += UpdateModifiedDataSeries;

            SeriesChanged = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(100)};
            SeriesChanged.Tick += UpdateSeries;
        }
Exemplo n.º 2
0
		protected Chart()
		{
			var b = new Border {ClipToBounds = true};
			Canvas = new Canvas {RenderTransform = new TranslateTransform(0, 0)};
			b.Child = Canvas;
			Content = b;

			if (RandomizeStartingColor) ColorStartIndex = Randomizer.Next(0, Colors.Count - 1);

			AnimatesNewPoints = false;
			CurrentScale = 1;

			PerformanceConfiguration = new PerformanceConfiguration {Enabled = false};
			Series = new ObservableCollection<Series>();
			DataToolTip = new DefaultIndexedTooltip();
			Shapes = new List<FrameworkElement>();
			HoverableShapes = new List<HoverableShape>();
			PointHoverColor = System.Windows.Media.Colors.White;

			//it requieres a background so it detect mouse down/up events.
			Background = Brushes.Transparent;

			SizeChanged += Chart_OnsizeChanged;
			MouseWheel += MouseWheelOnRoll;
			MouseLeftButtonDown += MouseDownForPan;
			MouseLeftButtonUp += MouseUpForPan;
			MouseMove += MouseMoveForPan;

			_resizeTimer = new DispatcherTimer
			{
				Interval = TimeSpan.FromMilliseconds(100)
			};
			_resizeTimer.Tick += (sender, e) =>
			{
				_resizeTimer.Stop();
				ClearAndPlot();
			};
			TooltipTimer = new DispatcherTimer
			{
				Interval = TimeSpan.FromMilliseconds(1000)
			};
			TooltipTimer.Tick += TooltipTimerOnTick;

			_serieValuesChanged = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(100)};
			_serieValuesChanged.Tick += UpdateModifiedDataSeries;

			_seriesChanged = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(100)};
			_seriesChanged.Tick += UpdateSeries;
		}