コード例 #1
0
        private static string createPlotImage(TECEstimator estimate)
        {
            string path        = Path.GetTempFileName();
            var    pngExporter = new PngExporter {
                Width = 600, Height = 400, Background = OxyColors.White
            };
            PlotModel plotModel = new PlotModel {
                Title = "Cost Distribution"
            };

            OxyPlot.Series.PieSeries pieSeries = new OxyPlot.Series.PieSeries {
                StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0
            };
            pieSeries.Slices.Add(new PieSlice("Material Cost", estimate.TECMaterialCost)
            {
                IsExploded = false
            });
            pieSeries.Slices.Add(new PieSlice("Labor Cost", estimate.TECLaborCost)
            {
                IsExploded = false
            });
            pieSeries.Slices.Add(new PieSlice("Sub. Labor Cost", estimate.SubcontractorLaborCost)
            {
                IsExploded = false
            });
            pieSeries.Slices.Add(new PieSlice("Sub. Material Cost", estimate.ElectricalMaterialCost)
            {
                IsExploded = false
            });
            plotModel.Series.Add(pieSeries);

            pngExporter.ExportToFile(plotModel, path);
            return(path);
        }
コード例 #2
0
        public void LoadGraphData()
        {
            _PlotModel = new PlotModel()
            {
                Title = "開発コードごとの工数"
            };

            var series = new OxyPlot.Series.PieSeries
            {
                StrokeThickness     = 2.0,
                InsideLabelPosition = 0.5,
                AngleSpan           = 360,
                StartAngle          = 270,
            };
            DateTime present = DateTime.Now;

            if (PresentMonthlyWorkCodeTime.Any())
            {
                foreach (var item in PresentMonthlyWorkCodeTime)
                {
                    series.Slices.Add(new PieSlice(item.WorkCode, item.WorkTime.TotalMinutes));
                }
            }
            else
            {
                series.Slices.Add(new PieSlice("No Data", 100));
            }



            _PlotModel.Series.Add(series);
        }
コード例 #3
0
        public OverviewModule([Dependency] IShellEventCollection shellEvents, [Dependency] IShellItemCollection shellItems)
        {
            ShellEvents = shellEvents;

            PieModel = new PlotModel {
                Title = "ShellEvents"
            };

            OxyPlot.Series.PieSeries seriesP1 = new OxyPlot.Series.PieSeries {
                FontSize = 12, ExplodedDistance = 0.1, StrokeThickness = 2.0, InsideLabelPosition = 0.6, AngleSpan = 360, StartAngle = 0, InnerDiameter = 0.4
            };

            int OtherCount = 0;

            foreach (string type in shellEvents.FilteredView.OfType <IShellEvent>().Select(e => e.GetType()).Distinct().Select(t => t.Name))
            {
                if (((double)shellEvents.FilteredView.OfType <IShellEvent>().Where(e => (e.GetType().Name == type) == true).Count() / shellEvents.FilteredView.OfType <IShellEvent>().Count()) * 100 > 5)
                {
                    seriesP1.Slices.Add(new PieSlice(type.Replace("Event", ""), shellEvents.FilteredView.OfType <IShellEvent>().Where(e => (e.GetType().Name == type) == true).Count())
                    {
                        IsExploded = true
                    });
                }
                else
                {
                    OtherCount += shellEvents.FilteredView.OfType <IShellEvent>().Where(e => (e.GetType().Name == type) == true).Count();
                }
            }
            seriesP1.Slices.Add(new PieSlice("Other", OtherCount)
            {
                IsExploded = true
            });

            if (shellEvents.FilteredView.OfType <IShellEvent>().Any())
            {
                BeginDate = shellEvents.FilteredView.OfType <IShellEvent>().OrderBy(e => e.TimeStamp).First().TimeStamp.Date.ToString("MM-dd-yyyy");
                EndDate   = shellEvents.FilteredView.OfType <IShellEvent>().OrderBy(e => e.TimeStamp).Last().TimeStamp.Date.ToString("MM-dd-yyyy");
            }

            ShellbagsCount = shellItems.Count;
            EventsCount    = shellEvents.FilteredView.OfType <IShellEvent>().Count();

            PieModel.Series.Add(seriesP1);
        }
コード例 #4
0
        private void ChannelGraph(SocketGuild guild, string filename, SocketUser user = null)
        {
            PlotModel plot = new PlotModel();

            //List<DateTimeOffset> messages = new List<DateTimeOffset>();//MessageCollector.collectMessages(guild);
            int total = 0;

            if (user == null)
            {
                Task <List <DateTimeOffset> > t = MessageCollector.collectMessages(guild);
                t.Wait();
                total = t.Result.Count;
            }
            else
            {
                Task <List <DateTimeOffset> > t = MessageCollector.collectMessages(user, guild);
                t.Wait();
                total = t.Result.Count;
            }

            //int total = messages.Count;


            Dictionary <IMessageChannel, int> organized = new Dictionary <IMessageChannel, int>();

            foreach (SocketTextChannel channel in guild.TextChannels)
            {
                Task <List <DateTimeOffset> > t = MessageCollector.collectMessages(channel);
                t.Wait();
                organized.Add(channel, t.Result.Count);
            }

            var pieSeries = new OxyPlot.Series.PieSeries {
                Title = "ChannelGraph: " + filename + "\n Messages referenced: " + total
            };

            pieSeries.AreInsideLabelsAngled = true;
            for (int i = 0; i < organized.Count; i++)
            {
                var     l       = organized.ToList();
                decimal percent = decimal.Divide(l[i].Value, total) * 100;
                if (l[i].Value == 0 || percent < 1)
                {
                    continue;
                }
                if (percent < 2)
                {
                    pieSeries.Slices.Add(new PieSlice(null, l[i].Value));
                }
                else
                {
                    pieSeries.Slices.Add(new PieSlice(l[i].Key.Name, l[i].Value));
                }
            }
            plot.Series.Add(pieSeries);
            plot.TitleFontSize = 40;

            var pngExporter = new PngExporter {
                Width = 1200, Height = 1000
            };

            pngExporter.ExportToFile(plot, filename + ".png");
        }