* @author Teemu Lempinen\r
*\r
*/\r
-public interface PieDataset extends IDataset {\r
+public interface PieDataset<T extends Comparable<T>> extends IDataset {\r
\r
\r
/**\r
* indicates the key of the value.\r
* @return Map of colors for different slices in a pie chart\r
*/\r
- public HashMap<String, Color> getColorMap();\r
+ public HashMap<T, Color> getColorMap();\r
\r
\r
/**\r
* indicates the key of the slice.\r
* @return\r
*/\r
- public HashMap<String, Boolean> getExplodedMap();\r
+ public HashMap<T, Boolean> getExplodedMap();\r
\r
\r
}\r
properties.otherProperties.put("filterFraction", filterFraction);\r
}\r
\r
+ @SuppressWarnings({ "unchecked", "rawtypes" })\r
@Override\r
protected void setPlotProperties(PlotProperties properties) {\r
if(!(plot instanceof MyPiePlot))\r
\r
listener = new DatasetChangeListener() {\r
\r
- @Override\r
+ @Override\r
public void datasetChanged(DatasetChangeEvent event) {\r
- HashMap<String, Color> colorMap = ((PieDataset)ds).getColorMap();\r
- HashMap<String, Boolean> explodedMap = ((PieDataset)ds).getExplodedMap();\r
+ HashMap<Comparable<?>, Color> colorMap = ((PieDataset)ds).getColorMap();\r
+ HashMap<Comparable<?>, Boolean> explodedMap = ((PieDataset)ds).getExplodedMap();\r
\r
for(Object o : piePlot.getDataset().getKeys()) {\r
if(o instanceof Comparable) {\r
}\r
}\r
\r
- for(String name : explodedMap.keySet()) {\r
+ for(Comparable<?> name : explodedMap.keySet()) {\r
Boolean exploded = explodedMap.get(name);\r
if(Boolean.TRUE.equals(exploded))\r
piePlot.setExplodePercent(name, 0.3);\r
} \r
piePlot.clearSectionPaints(false);\r
piePlot.setDrawingSupplier(new DefaultDrawingSupplier());\r
- for(String name : colorMap.keySet())\r
+ for(Comparable<?> name : colorMap.keySet())\r
piePlot.setSectionPaint(name, colorMap.get(name));\r
}\r
};\r
\r
@Override\r
public int compareTo(ChartVariable o) {\r
+ int rvicomp = rvi.compareTo(o.rvi);\r
+ if (rvicomp == 0)\r
+ return 0;\r
if (label != null && o.label != null) {\r
- return label.compareTo(o.label);\r
+ int labelcomp = label.compareTo(o.label);\r
+ if (labelcomp != 0)\r
+ return labelcomp;\r
}\r
- return rvi.compareTo(o.rvi);\r
+ return rvicomp;\r
}\r
\r
}\r