Example #1
0
        public override void Do(IDemoChartControl chartControl)
        {
            // Create check marker.
            var crossMarker = new CrossMarker
            {
                Name            = "Marker",
                IsLegendVisible = false
            };

            // Randomize points.
            Vector3F[] points = DemoHelper.GenerateRandomPoints(100, new Vector3F(0f, 0f, 0f), new Vector3F(5f, 5f, 0f));

            // Create series markers.
            var series = new Series
            {
                Reader      = new DefaultPositionMaskDataReader(points),
                Thickness   = 0,
                MarkerColor = Colors.DarkRed,
                MarkerStyle = MarkerStyle.Circle,
                MarkerSize  = 8,
                Name        = "Points"
            };

            // Create snap target.
            var snapTarget = new PointCollectionSnapTarget(points);

            // Regsiter event listener.
            chartControl.ActionController.RegisterHandler(1, eventListener = new ChartEventListener(crossMarker, snapTarget));

            // Setup chart view options.
            chartControl.ContextView.Camera2D.Projection = Projection2DTypes.XPosYPos;
            chartControl.ContextView.Mode2D = true;
            chartControl.ViewResetOptions.ResetOnDataChanged = false;

            // Setup chart data source.
            chartControl.DataSource = new RenderData[] { crossMarker, series };
        }
Example #2
0
        public override void Do(IDemoChartControl chartControl)
        {
            // Generate initial points.
            initialPoints = DemoHelper.GenerateRandomPoints(PointCount, new Vector3F(0f, 0f, 0f), new Vector3F(5f, 5f, 0f));
            currentPoints = new Vector3F[initialPoints.Length];
            Array.Copy(initialPoints, currentPoints, currentPoints.Length);

            // Create check marker.
            var crossMarker = new CrossMarker
            {
                Name            = "Marker",
                IsLegendVisible = false
            };

            // Create series dynamic data reader.
            dataReader = new DynamicPositionMaskDataReader(currentPoints.Length);
            dataReader.UpdatePositions(currentPoints);

            // Create series markers.
            var series = new Series
            {
                Reader      = dataReader,
                Thickness   = 0,
                MarkerColor = Colors.DarkRed,
                MarkerStyle = MarkerStyle.Circle,
                MarkerSize  = 8,
                Name        = "Points"
            };

            // Create our snap target.
            snapTarget = new MySnapTarget {
                Points = currentPoints
            };

            // Regsiter event listener.
            chartControl.ActionController.RegisterHandler(1, eventListener = new ChartEventListener(crossMarker, snapTarget));

            // Setup chart view options.
            chartControl.ContextView.Camera2D.Projection = Projection2DTypes.XPosYPos;
            chartControl.ContextView.Mode2D = true;
            chartControl.ViewResetOptions.ResetOnDataChanged = false;

            // Setup chart data source.
            chartControl.DataSource = new RenderData[] { crossMarker, series };

            // Start animation.
            animationHelper.Start(
                argument =>
            {
                for (int i = 0; i < currentPoints.Length; i++)
                {
                    float currentAngle = argument;
                    currentPoints[i]   = initialPoints[i] +
                                         AnimationRadius * new Vector3F((float)Math.Cos(currentAngle), (float)Math.Sin(currentAngle), 0);
                }
                return(argument);
            },
                argument =>
            {
                dataReader.UpdatePositions(currentPoints);
                snapTarget.Points = currentPoints;
            }, 0f, 0.025f, 16);
        }