public CrossMarker() { Reader = dataReader = new DynamicPositionMaskDataReader(1); // Set zero thickness to disable line. Thickness = 0.0f; // Set marker style. MarkerStyle = MarkerStyle.Cross; // Set marker size. MarkerSize = 20; // Set marker color. MarkerColor = Colors.DarkBlue; }
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); }