Переглянути джерело

max number in statistics line graph lengend entry

Julien Clauter 10 роки тому
батько
коміт
39b3c258e8

+ 2 - 2
src/de/tudarmstadt/informatik/hostage/ui2/adapter/StatisticListAdapter.java

@@ -24,7 +24,7 @@ public class StatisticListAdapter extends ArrayAdapter<PlotComparisonItem> {
     }
 
     public interface ValueFormatter {
-        public String convertValueToString(double value);
+        public String convertValueForItemToString(PlotComparisonItem item);
     }
 
     private ValueFormatter formatter;
@@ -84,7 +84,7 @@ public class StatisticListAdapter extends ArrayAdapter<PlotComparisonItem> {
         if (this.formatter == null){
             holder.valueView.setText("" + item.getValue2());
         } else {
-            holder.valueView.setText(this.formatter.convertValueToString(item.getValue2()));
+            holder.valueView.setText(this.formatter.convertValueForItemToString(item));
         }
     }
 }

+ 5 - 5
src/de/tudarmstadt/informatik/hostage/ui2/fragment/StatisticsFragment.java

@@ -336,16 +336,16 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
         if (this.currentPlotView instanceof LineGraph){
             adapter.setValueFormatter(new StatisticListAdapter.ValueFormatter() {
                 @Override
-                public String convertValueToString(double value) {
-                    return String.format("%.02f", value) + " %";
+                public String convertValueForItemToString(PlotComparisonItem item) {
+                    return String.format("%.02f", item.getValue2()) + " %" + " " + "("+ (item.getValue1().intValue())  +")";
                 }
             });
         } else {
 
             adapter.setValueFormatter(new StatisticListAdapter.ValueFormatter() {
                 @Override
-                public String convertValueToString(double value) {
-                    int v = (int) value;
+                public String convertValueForItemToString(PlotComparisonItem item)  {
+                    int v = (int) item.getValue2().intValue();
                     return "" + v;
                 }
             });
@@ -1108,7 +1108,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
             });
 
             double itemValue = (((double)numbOfAttacks / (double)records.size())*100.);
-            PlotComparisonItem item = new PlotComparisonItem(groupKey, this.getColor(index), 0., itemValue);
+            PlotComparisonItem item = new PlotComparisonItem(groupKey, this.getColor(index), (double) numbOfAttacks, itemValue);
             item.setOtherData(singleLineItems);
             plotItems.add(item);
             index++;