コード例 #1
0
        void AggregateByRange()
        {
            var keys = new string[] { "<4", "4-8", ">8" };

            for (int i = 0; i < 3; i++)
            {
                var ds = new DataSeries()
                {
                    ItemsSource            = SampleItem.CreateSampleData(100),
                    ValueBinding           = new Binding("Value"),
                    Aggregate              = Aggregate.Count,
                    Label                  = "Sample Group " + (i + 1).ToString(),
                    AggregateGroupSelector = RangeSelector
                };
                chart.Data.Children.Add(ds);
            }

            chart.Data.ItemNames = keys;

            // style chart
            chart.View.AxisY.MajorTickThickness = 0;
            chart.View.AxisY.MinorTickThickness = 0;
            chart.View.AxisY.AxisLine           = new Line()
            {
                StrokeThickness = 0
            };
            chart.View.AxisX.MajorGridStrokeThickness = 0;
            chart.View.AxisX.MinorGridStrokeThickness = 0;
            chart.View.AxisX.MajorTickThickness       = 0;
            chart.View.AxisX.MinorTickThickness       = 0;
        }
コード例 #2
0
 void CreateNewDataSeries()
 {
     for (int i = 0; i < 2; i++)
     {
         var ds = new DataSeries()
         {
             ItemsSource          = SampleItem.CreateSampleData(40),
             ValueBinding         = new Binding("Value"),
             PointTooltipTemplate = this.Resources["lbl"] as DataTemplate,
             Label = "s" + i
         };
         chart.Data.Children.Add(ds);
     }
 }
コード例 #3
0
        public static SampleItem[] CreateSampleData(int cnt)
        {
            var names = new string[] { "oranges", "apples", "lemons", "grapes" };
            var array = new SampleItem[cnt];

            for (int i = 0; i < cnt; i++)
            {
                array[i] = new SampleItem()
                {
                    Value = rnd.Next(1, 10), Name = names[rnd.Next(names.Length)]
                };
            }

            return(array);
        }
コード例 #4
0
        public static SampleItem[] CreateSampleData(int cnt)
        {
            var names = new string[] { "oranges", "apples", "lemons", "grapes" };
            var array = new SampleItem[cnt];

            for (int i = 0; i < cnt; i++)
            {
                array[i] = new SampleItem() { Value = rnd.Next(1, 10), Name = names[rnd.Next(names.Length)] };
            }

            return array;
        }