Пример #1
0
        private void DrawLineCartesian()
        {
            var brush = this.Resources["Brush1"] as Brush;

            var baseLineSource = new CartesianDataSource()
            {
                Data = new List <DataPointEntity>(), Stroke = brush
            };

            foreach (var item in this.months)
            {
                baseLineSource.Data.Add(new DataPointEntity()
                {
                    Category = item, Value = 0
                });
            }

            var baseLine = new LineSeries()
            {
                ItemsSource     = baseLineSource.Data,
                Stroke          = baseLineSource.Stroke,
                CategoryBinding = new PropertyNameDataPointBinding("Category"),
                ValueBinding    = new PropertyNameDataPointBinding("Value"),
            };

            this.myLineCartesian.Series.Add(baseLine);

            this.myLineCartesian.Series.Add(this.Line1);
            this.myLineCartesian.Series.Add(this.Line2);

            this.stack1.DataContext = this.Line1;
            this.stack2.DataContext = this.Line2;
        }
Пример #2
0
 private BarSeries CreateBar(CartesianDataSource source)
 {
     return(new BarSeries()
     {
         ItemsSource = source.Data,
         CombineMode = ChartSeriesCombineMode.Stack,
         CategoryBinding = new PropertyNameDataPointBinding("Category"),
         ValueBinding = new PropertyNameDataPointBinding("Value"),
     });
 }
Пример #3
0
 private LineSeries CreateLine(CartesianDataSource source)
 {
     return(new LineSeries()
     {
         ItemsSource = source.Data,
         Stroke = source.Stroke,
         CategoryBinding = new PropertyNameDataPointBinding("Category"),
         ValueBinding = new PropertyNameDataPointBinding("Value"),
     });
 }
Пример #4
0
        private CartesianDataSource CreateCartesianDataSource(Brush stroke)
        {
            var source = new CartesianDataSource()
            {
                Data = new List <DataPointEntity>(), Stroke = stroke
            };

            foreach (var item in this.months)
            {
                source.Data.Add(new DataPointEntity()
                {
                    Category = item, Value = this.random.Next(20, 50)
                });
            }

            return(source);
        }
Пример #5
0
        private void DrawBarCartesian()
        {
            this.showWhichBar = ShowWhichBar.None;

            var bar1 = new CartesianDataSource()
            {
                Data = new List <DataPointEntity>()
            };

            foreach (var item in this.months)
            {
                bar1.Data.Add(new DataPointEntity()
                {
                    Category = item, Value = 0
                });
            }

            this.Bar1 = this.CreateBar(bar1);

            var bar2 = new CartesianDataSource()
            {
                Data = new List <DataPointEntity>()
            };

            for (int i = 0; i < months.Length; i++)
            {
                bar2.Data.Add(new DataPointEntity()
                {
                    Category = months[i], Value = this.BarData1.Data[i].Value + this.BarData2.Data[i].Value
                });
            }

            this.Bar2 = this.CreateBar(bar2);

            this.myBarCartesian.Series.Add(this.Bar1);
            this.myBarCartesian.Series.Add(this.Bar2);
        }