public static PlotModel StandardCategoryColorAxis()
        {
            var plotModel1 = new PlotModel {
                Title = "CategoryColorAxis"
            };
            var catAxis = new CategoryColorAxis {
                Key = "ccc", Palette = OxyPalettes.BlackWhiteRed(12)
            };

            catAxis.Labels.AddRange(new[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
            plotModel1.Axes.Add(catAxis);
            var linearAxis = new LinearAxis {
                Position = AxisPosition.Left
            };
            var ss = new ScatterSeries {
                ColorAxisKey = catAxis.Key
            };

            ss.Points.Add(new ScatterPoint(0, 0)
            {
                Value = 0
            });
            ss.Points.Add(new ScatterPoint(3, 0)
            {
                Value = 3
            });
            plotModel1.Series.Add(ss);
            plotModel1.Axes.Add(linearAxis);
            return(plotModel1);
        }
        public static PlotModel MajorStep4()
        {
            var plotModel1 = new PlotModel {
                Title = "Major Step = 4, IsTickCentered = true"
            };
            var catAxis = new CategoryColorAxis
            {
                Palette        = OxyPalettes.BlackWhiteRed(3),
                IsTickCentered = true,
                MajorStep      = 4
            };

            catAxis.Labels.AddRange(new[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
            plotModel1.Axes.Add(catAxis);
            var linearAxis = new LinearAxis {
                Position = AxisPosition.Left
            };

            plotModel1.Axes.Add(linearAxis);
            return(plotModel1);
        }
Esempio n. 3
0
        public string PlotCommiters(IEnumerable <QRepository> repos)
        {
            var info = repos.SelectMany(x => x.Commits).GroupBy(x => x.Commiter)
                       .Select(x => new {
                Commiter = x.Key,
                Total    = x.Count()
            });

            var bar = new BarSeries {
                ItemsSource = info.Select(x => new BarItem {
                    Value = x.Total
                }),
                LabelFormatString = "{0} Commits"
            };

            var axis = new CategoryColorAxis {
                Position    = AxisPosition.Left,
                ItemsSource = info.Select(x => x.Commiter)
            };

            return(ExportToPng(bar, axis, ""));
        }
        private static PlotModel MakePlotmodel([ItemNotNull][JetBrains.Annotations.NotNull] List <string> personNames, [JetBrains.Annotations.NotNull] string yaxislabel)
        {
            var plotModel1 = new PlotModel
            {
                DefaultFontSize       = Fontsize,
                LegendFontSize        = Fontsize,
                LegendBorderThickness = 0,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendSymbolMargin    = 20
            };
            var categoryAxis1 = new CategoryAxis
            {
                MajorStep      = 1,
                Minimum        = -0.5,
                MaximumPadding = 0.02,
                Title          = "Personen",
                Key            = "N",
                MinimumPadding = 0,
                FontSize       = Fontsize
            };
            var categoryAxis2 = new CategoryColorAxis
            {
                Position       = AxisPosition.Top,
                Minimum        = -0.5,
                MinimumPadding = 0,
                MajorStep      = 1
            };

            categoryAxis2.MinimumPadding = 0;
            categoryAxis2.TicklineColor  = OxyColors.White;
            categoryAxis2.MaximumPadding = 0.02;
            categoryAxis2.MajorTickSize  = 20;
            categoryAxis2.Key            = "coloraxis";
            categoryAxis2.Title          = "Haushalt";
            var lastHH        = string.Empty;
            var distancecount = 30;
            var colors        = new List <OxyColor>();
            var lastColor     = OxyColors.LightBlue;

            for (var i = 0; i < personNames.Count; i++)
            {
                distancecount++;
                var hhName = personNames[i].Substring(0, 5);
                if (lastHH != hhName)
                {
                    lastHH = hhName;
                    if (lastColor == OxyColors.LightBlue)
                    {
                        lastColor = OxyColors.Green;
                    }
                    else
                    {
                        lastColor = OxyColors.LightBlue;
                    }
                    if (distancecount > 20)
                    {
                        categoryAxis2.Labels.Add(hhName);
                        distancecount = 0;
                    }
                    else
                    {
                        categoryAxis2.Labels.Add(" ");
                    }
                }
                else
                {
                    categoryAxis2.Labels.Add(" ");
                }
                colors.Add(lastColor);
                if (i % 10 == 0)
                {
                    categoryAxis1.ActualLabels.Add(i.ToString(CultureInfo.CurrentCulture));
                }
                else
                {
                    categoryAxis1.ActualLabels.Add(" ");
                }
            }
            Logger.Info("Category labels: " + categoryAxis2.Labels.Count);
            Logger.Info("Total number of colors: " + colors.Count);
            colors.Add(OxyColors.White);
            var p2 = new OxyPalette(colors);

            categoryAxis2.Palette = p2;
            plotModel1.Axes.Add(categoryAxis2);
            categoryAxis1.GapWidth = 0;
            plotModel1.Axes.Add(categoryAxis1);
            var linearAxis1 = new LinearAxis
            {
                AbsoluteMinimum = 0,
                MaximumPadding  = 0.01,
                MinimumPadding  = 0,
                MinorTickSize   = 0,
                Title           = yaxislabel
            };

            plotModel1.Axes.Add(linearAxis1);
            return(plotModel1);
        }