[longomatch] Fix steps for histogram graphs
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix steps for histogram graphs
- Date: Mon, 9 Sep 2013 08:09:18 +0000 (UTC)
commit dddfb8e6676c4171e271ec21b8ff34bb326fdea8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Sep 9 10:02:38 2013 +0200
Fix steps for histogram graphs
LongoMatch.GUI/Gui/Component/Stats/Plotter.cs | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs b/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs
index 43a9f14..5f19b6f 100644
--- a/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs
+++ b/LongoMatch.GUI/Gui/Component/Stats/Plotter.cs
@@ -17,6 +17,7 @@
//
using System;
using System.IO;
+using System.Linq;
using Gdk;
using Cairo;
using OxyPlot;
@@ -82,6 +83,7 @@ namespace LongoMatch.Gui.Component.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};
@@ -96,6 +98,20 @@ namespace LongoMatch.Gui.Component.Stats
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;
+ }
+ }
return model;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]