예제 #1
0
        private void DoReset()
        {
            var        rnd     = random.Value;
            HSBPalette palette = new HSBPalette();

            // Create a new array of points
            for (int i = 0; i < _pointCount; i++)
            {
                var point = new Point(rnd.NextDouble(), rnd.NextDouble());
                _points[i] = point;

                var vertices = SharpDXHelper.MakeRectangle((float)point.X, (float)point.Y, 0.05f, 0.05f);
                for (var j = 0; j < vertices.Count; j++)
                {
                    _currentArray[i * 6 + j] = vertices[j];
                }
            }
            // Replace the old array of points with the new array
            Points = _points;
            var temp = (Positions as DxVertex[]) ?? new DxVertex[_pointCount * 6];

            Positions = _currentArray;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Positions)));
            _currentArray = temp;
        }
        private void DoReset()
        {
            var        rnd     = random.Value;
            HSBPalette palette = new HSBPalette();

            // Create a new array of points
            for (int i = 0; i < _pointCount; i++)
            {
                var point = new Point(rnd.NextDouble(), rnd.NextDouble());
                _currentArray[i] = new DxInstancePoint(new Point(point.X, point.Y));
            }
            // Replace the old array of points with the new array
            var temp = (Positions as DxInstancePoint[]) ?? new DxInstancePoint[_pointCount];

            Positions = _currentArray;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Positions)));
            _currentArray = temp;
        }
예제 #3
0
        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;
        }
예제 #4
0
        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;
        }
예제 #5
0
        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;
        }
        public ColorSelector()
        {
            Palette = new HSBPalette();

            Background = Brushes.Transparent;

            paletteControl.SetBinding(PaletteControl.PaletteProperty, new Binding { Source = this, Path = new PropertyPath("Palette") });
            BottomPanel.Children.Add(paletteControl);

            paletteControl.MouseLeftButtonDown += paletteControl_MouseLeftButtonDown;
            paletteControl.MouseMove += paletteControl_MouseMove;

            Children.Remove(KeyboardNavigation);
            Children.Remove(MouseNavigation);
            Children.Remove(LeftHighlight);
            Children.Remove(RightHighlight);
            Children.Remove(SelectorNavigation);

            Viewport.Domain = new DataRect(0, 0, 1, 1);
        }