PlotModel GetPie(SubCategoryStat stats, Team team) { PlotModel model = new PlotModel(); PieSeries ps = new PieSeries(); foreach (PercentualStat st in stats.OptionStats) { double count = GetCount(st, team); if (count == 0) { continue; } ps.Slices.Add(new PieSlice(st.Name, count)); } ps.InnerDiameter = 0; ps.ExplodedDistance = 0.0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 2.0; ps.InsideLabelPosition = 0.8; ps.AngleSpan = 360; ps.StartAngle = 0; if (team == Team.LOCAL) { ps.Title = HomeName; } else if (team == Team.VISITOR) { ps.Title = AwayName; } model.Series.Add(ps); return(model); }
public StatsWidget(Stat stat, Stat category, SubCategoryStat subcat, int textSize) { /* For subcategories, parent is the parent Category */ this.stat = stat; this.category = category; HomeColor = CairoUtils.ColorFromRGB(0xFF, 0x33, 0); AwayColor = CairoUtils.ColorFromRGB(0, 0x99, 0xFF); layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Char; layout.Alignment = Pango.Alignment.Center; ModifyText(StateType.Normal, LongoMatch.Gui.Helpers.Misc.ToGdkColor(Config.Style.PaletteText)); this.textSize = textSize; name_tpl = "{0}"; count_tpl = "{0} ({1}%)"; if (category == null) { name_tpl = "<b>" + name_tpl + "</b>"; count_tpl = "<b>" + count_tpl + "</b>"; HeightRequest = 25; } else { if (subcat != null) { name_tpl = GLib.Markup.EscapeText(subcat.Name); name_tpl += name_tpl == "" ? "{0}" : ": {0}"; } HeightRequest = 18; } }
public StatsWidget(Stat stat, Stat category, SubCategoryStat subcat, int textSize) { /* For subcategories, parent is the parent Category */ this.stat = stat; this.category = category; HomeColor = CairoUtils.ColorFromRGB(0xFF, 0x33, 0); AwayColor = CairoUtils.ColorFromRGB(0, 0x99, 0xFF); layout = new Pango.Layout(PangoContext); layout.Wrap = Pango.WrapMode.Char; layout.Alignment = Pango.Alignment.Center; this.textSize = textSize; name_tpl = "{0}"; count_tpl = "{0} ({1}%)"; if (category == null) { name_tpl = "<b>" + name_tpl + "</b>"; count_tpl = "<b>" + count_tpl + "</b>"; HeightRequest = 25; } else { if (subcat != null) { name_tpl = GLib.Markup.EscapeText(subcat.Name) + ": {0}"; } HeightRequest = 18; } }
void AddSubcategory(SubCategoryStat sstats, EventTypeStats parent) { foreach (PercentualStat ostats in sstats.OptionStats) { StatsWidget w = new StatsWidget(ostats, parent, sstats, subcatsMaxSize); subcats.Add(w); cstatsbox.PackStart(w, false, true, 0); } }
public void LoadStats(SubCategoryStat stats) { store = new ListStore(typeof(string), typeof(string)); treeview.Model = store; gtkframe.Markup = String.Format("<b> {0} </b>", stats.Name); plotter1.LoadHistogram(stats); foreach (PercentualStat st in stats.OptionStats) { store.AppendValues(st.Name, st.TotalCount.ToString()); } }
public void LoadStats(SubCategoryStat stats, string homeName, string awayName) { store = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string)); treeview.Model = store; treeview.Columns[2].Title = homeName; treeview.Columns[3].Title = awayName; plotter.HomeName = homeName; plotter.AwayName = awayName; gtkframe.Markup = String.Format("<b> {0} </b>", stats.Name); plotter.LoadHistogram(stats); foreach (PercentualStat st in stats.OptionStats) { store.AppendValues(st.Name, st.TotalCount.ToString(), st.LocalTeamCount.ToString(), st.VisitorTeamCount.ToString()); } }
PlotModel GetPie(SubCategoryStat stats, TeamType team) { PlotModel model = new PlotModel(); PieSeries ps = new PieSeries(); foreach (PercentualStat st in stats.OptionStats) { double count = GetCount(st, team); if (count == 0) { continue; } ps.Slices.Add(new PieSlice(st.Name, count)); } ps.InnerDiameter = 0; ps.ExplodedDistance = 0.0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 2.0; ps.InsideLabelPosition = 0.8; ps.AngleSpan = 360; ps.StartAngle = 0; if (team == TeamType.LOCAL) { ps.Title = HomeName; } else if (team == TeamType.VISITOR) { ps.Title = AwayName; } OxyColor text_color = OxyColor.FromArgb(LongoMatch.Config.Style.PaletteText.A, LongoMatch.Config.Style.PaletteText.R, LongoMatch.Config.Style.PaletteText.G, LongoMatch.Config.Style.PaletteText.B); model.TextColor = text_color; model.TitleColor = text_color; model.SubtitleColor = text_color; model.Series.Add(ps); return(model); }
PlotModel GetHistogram(SubCategoryStat stats) { PlotModel model = new PlotModel(); CategoryAxis categoryAxis; LinearAxis valueAxis; valueAxis = new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0, MinorStep = 1, MajorStep = 1, Minimum = 0 }; categoryAxis = new CategoryAxis() { ItemsSource = stats.OptionStats, LabelField = "Name", Angle = 20.0 }; model.Series.Add(new ColumnSeries { Title = Catalog.GetString("Total"), ItemsSource = stats.OptionStats, ValueField = "TotalCount" }); model.Series.Add(new ColumnSeries { Title = HomeName, ItemsSource = stats.OptionStats, ValueField = "LocalTeamCount", FillColor = new OxyColor { R = 0xFF, G = 0x33, B = 0x0, A = 0xFF } }); model.Series.Add(new ColumnSeries { Title = AwayName, ItemsSource = stats.OptionStats, ValueField = "VisitorTeamCount", FillColor = new OxyColor { R = 0, G = 0x99, B = 0xFF, A = 0xFF } }); model.Axes.Add(categoryAxis); model.Axes.Add(valueAxis); return(model); }
public void LoadHistogram(SubCategoryStat stats) { graphType = GraphType.Histogram; this.stats = stats; Reload(); }
public void LoadPie(SubCategoryStat stats) { graphType = GraphType.Pie; this.stats = stats; Reload(); }
PlotModel GetHistogram(SubCategoryStat stats) { PlotModel model = new PlotModel(); CategoryAxis categoryAxis; LinearAxis valueAxis; int maxCount; valueAxis = new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0, MinorStep = 1, MajorStep = 1, Minimum = 0 }; categoryAxis = new CategoryAxis() { ItemsSource = stats.OptionStats, LabelField = "Name", Angle = 20.0 }; model.Series.Add(new ColumnSeries { Title = Catalog.GetString("Total"), ItemsSource = stats.OptionStats, ValueField = "TotalCount" }); if (ShowTeams) { model.Series.Add(new ColumnSeries { Title = HomeName, ItemsSource = stats.OptionStats, ValueField = "LocalTeamCount", FillColor = new OxyColor { R = 0xFF, G = 0x33, B = 0x0, A = 0xFF } }); model.Series.Add(new ColumnSeries { Title = AwayName, ItemsSource = stats.OptionStats, ValueField = "VisitorTeamCount", FillColor = new OxyColor { R = 0, G = 0x99, B = 0xFF, A = 0xFF } }); } model.Axes.Add(categoryAxis); model.Axes.Add(valueAxis); if (stats.OptionStats.Count != 0) { maxCount = stats.OptionStats.Max(o => o.TotalCount); if (maxCount > 10 && maxCount <= 50) { valueAxis.MinorStep = 5; valueAxis.MajorStep = 10; } else if (maxCount > 50 && maxCount <= 100) { valueAxis.MinorStep = 10; valueAxis.MajorStep = 20; } else if (maxCount > 100) { valueAxis.MinorStep = 10; valueAxis.MajorStep = 50; } } OxyColor text_color = OxyColor.FromArgb(LongoMatch.Config.Style.PaletteText.A, LongoMatch.Config.Style.PaletteText.R, LongoMatch.Config.Style.PaletteText.G, LongoMatch.Config.Style.PaletteText.B); model.TextColor = text_color; model.TitleColor = text_color; model.SubtitleColor = text_color; return(model); }