示例#1
0
        public DemoDataViewModel()
        {
            this.ItemsSourceList = new ObservableCollection <SomePointList>();

            var first = new SomePointList(0);

            for (int i = 0; i < 30; i++)
            {
                var v  = i / 1.0;
                var y  = Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v) / v;
                var pt = new SomePoint(v, y);
                first.DataList.Add(pt);
            }

            this.ItemsSourceList.Add(first);

            for (int i = 1; i < 3; i++)
            {
                var    list    = new SomePointList(i);
                double yOffset = i * 0.5;
                foreach (var item in first.DataList)
                {
                    list.DataList.Add(new SomePoint(item.t, item.Y + yOffset));
                }

                ItemsSourceList.Add(list);
            }
        }
示例#2
0
        private SomePoint GetPoint(int i, double yOffset)
        {
            var v = i / 1.0;
            var y = Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v) / v;

            var pt = new SomePoint(v, y + 0.25 + yOffset);

            return(pt);
        }
示例#3
0
        private void RefreshData()
        {
            this.ItemsSourceList.Clear();

            var list = new SomePointList(0);

            for (int i = 0; i < this.SelectedDataSize; i++)
            {
                var v  = i / 100.0;
                var y  = Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v) / v;
                var pt = new SomePoint(v, y);
                list.DataList.Add(pt);
            }

            this.ItemsSourceList.Add(list);
            OnSelectedScatterTemplateTypeUpdated();
            UpdateScatterVisible();
        }
示例#4
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item == null)
            {
                return(null);
            }

            SomePoint pt = (SomePoint)item;
            int       i  = (int)pt.t;


            if (i % 2 == 0)
            {
                return(DataTemplate1);
            }


            return(DataTemplate0);
        }
示例#5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }



            SomePoint pt = (SomePoint)value;
            int       i  = (int)pt.t;
            int       j  = (int)pt.Y;

            if (i % 2 == 0 && j % 2 == 0)
            {
                return(Brushes.Red);
            }


            return(Brushes.LightSeaGreen);
        }