private void DoReset() { var rnd = random.Value; HSBPalette palette = new HSBPalette(); for (int i = 0; i < _pointCount; i++) { var point = new Point(rnd.NextDouble(), rnd.NextDouble()); var length = Math.Sqrt(point.X * point.X + point.Y * point.Y) / Math.Sqrt(2); var color = palette.GetColor(length); _currentArray[i] = new DxInstancedPointAndColor(point, color); } var temp = (Positions as DxInstancedPointAndColor[]) ?? new DxInstancedPointAndColor[_pointCount]; Positions = _currentArray; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Positions))); _currentArray = temp; }
private void Page_Loaded(object sender, RoutedEventArgs e) { plotter.Visible = new DataRect(0, 0, 1, 1); int count = (int)1e5; Point[] pts = new Point[count]; Random rnd = new Random(); for (int i = 0; i < count; i++) { pts[i] = new Point(rnd.NextDouble(), rnd.NextDouble()); } markerChart.AddPropertyBinding <Point>(Shape.ToolTipProperty, p => { return(String.Format("X: {0:F2} Y: {1:F2}", p.X, p.Y)); }); HSBPalette palette = new HSBPalette(); markerChart.AddPropertyBinding <Point>(Shape.FillProperty, p => { double length = Math.Sqrt(p.X * p.X + p.Y * p.Y) / Math.Sqrt(2); return(new SolidColorBrush(palette.GetColor(length))); }); //markerChart.Filters.Add(new BoundsFilter()); //markerChart.Filters.Add(new ParallelUnitingPointGroupFilter()); markerChart.Filters.Add(new ParallelClusteringFilter { MarkerSize = 8 }); markerChart.Filters.Add(new UnitingPointGroupFilter { MarkerSize = 6 }); markerChart.GetDataAsyncronously = true; //markerChart.ShowMarkersConsequently = false; markerChart.ItemsSource = pts; }
private void OnLoaded(object sender, RoutedEventArgs e) { GenerateData(); HSBPalette palette = new HSBPalette(); //chart1.AddPropertyBinding<Point>(Shape.FillProperty, p => //{ // double length = Math.Sqrt(p.X * p.X + p.Y * p.Y) / Math.Sqrt(2); // return new SolidColorBrush(palette.GetColor(length)); //}); chart2.AddPropertyBinding <Point>(Shape.FillProperty, p => { double length = Math.Sqrt(p.X * p.X + p.Y * p.Y) / Math.Sqrt(2); return(new SolidColorBrush(palette.GetColor(length))); }); //chart1.ItemsSource = data; chart2.ItemsSource = data; }