1 23 24 package de.progra.charting.test; 25 26 import de.progra.charting.model.*; 27 import de.progra.charting.render.*; 28 import de.progra.charting.*; 29 30 35 public class TestChartDataModel { 36 37 int[][] intval = {{1, 2, 4, 234, 45, 0, -102, Integer.MAX_VALUE}, 38 {23, 2, 45, -2000, 34, 566, 766, Integer.MIN_VALUE}, 39 {40594, 32493, -12020, 21023, 103, 3498, -1202, -12039}}; 40 41 Number [][] numval = {{new Integer (45), new Integer (0), new Integer (-102), new Integer (Integer.MAX_VALUE)}, 42 {new Integer (34), new Integer (566), new Integer (766), new Integer (Integer.MIN_VALUE)}, 43 {new Integer (103), new Integer (3498), new Integer (-1202), new Integer (-12039)}}; 44 45 double[] numcolumns = {Double.MIN_VALUE, Double.MAX_VALUE, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY}; 46 47 double[] columns = {1.0, Double.MIN_VALUE, Double.MAX_VALUE, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.0, -20.0, 9458.340}; 48 49 Object [] objcolumns = {new Double (Double.MIN_VALUE), new Double (Double.MAX_VALUE), 50 new Double (Double.POSITIVE_INFINITY), new Double (Double.NEGATIVE_INFINITY)}; 51 52 String [] strcolumns = {"1.0", ""+Double.MIN_VALUE, ""+Double.MAX_VALUE, 53 ""+Double.POSITIVE_INFINITY, ""+Double.NEGATIVE_INFINITY, 54 ""+0.0, ""+-20.0, ""+9458.340}; 55 56 57 58 public TestChartDataModel() { 59 ObjectChartDataModel model; 61 62 model = new ObjectChartDataModel(); 65 System.out.println("** Teste leeres Modell"); 66 testDefaultChartDataModel(model); 67 68 model = new ObjectChartDataModel(numval, objcolumns, new String [] {"1", "2", "3", "4"}); 71 System.out.println("** Teste Modell mit Number[][]"); 72 73 testDefaultChartDataModel(model); 74 75 model = new ObjectChartDataModel(intval, strcolumns, new String [] {"1", "2", "3", "4"}); 78 System.out.println("** Teste Modell mit int[][]"); 79 testDefaultChartDataModel(model); 80 81 } 82 83 public void testDefaultChartDataModel(DefaultChartDataModel m) { 84 try { 85 System.out.println("** AxisBinding von DataSet 0 = "+m.getAxisBinding(0)); 86 } catch(Exception e) { 87 System.out.println("** Fehler"); 88 } 89 90 try { 91 System.out.println("** ColumnValue At index 3 = "+m.getColumnValueAt(3)); 92 } catch(Exception e) { 93 System.out.println("** Fehler"); 94 } 95 96 try { 97 System.out.println("** ColumnValue At index 7 = "+m.getColumnValueAt(7)); 98 } catch(Exception e) { 99 System.out.println("** Fehler"); 100 } 101 102 try { 103 System.out.println("** Länge von DataSet 2 = "+m.getDataSetLength(2)); 104 } catch(Exception e) { 105 System.out.println("** Fehler"); 106 } 107 try { 108 System.out.println("** Anzahl von DataSets = "+m.getDataSetNumber()); 109 } catch(Exception e) { 110 System.out.println("** Fehler"); 111 } 112 try { 113 System.out.println("** Wert an Index 0,7 = "+m.getValueAt(0, 7)); 114 } catch(Exception e) { 115 System.out.println("** Fehler"); 116 } 117 try { 118 System.out.println("** Wert an Index 2,2 = "+m.getValueAt(2, 2)); 119 } catch(Exception e) { 120 System.out.println("** Fehler"); 121 } 122 123 ChartDataModelConstraints con; 124 125 try { 126 System.out.println("** Lade ChartDataModelConstraints für CoordSystem.SECOND_YAXIS"); 127 con = m.getChartDataModelConstraints(CoordSystem.SECOND_YAXIS); 128 } catch(Exception e) { 129 System.out.println("** Fehler"); 130 return; 131 } 132 133 try { 134 System.out.println("** Kleinster Wert = "+con.getMinimumValue()); 135 } catch(Exception e) { 136 System.out.println("** Fehler"); 137 } 138 139 try { 140 System.out.println("** Größter Wert = "+con.getMaximumValue()); 141 } catch(Exception e) { 142 System.out.println("** Fehler"); 143 } 144 145 try { 146 System.out.println("** Kleinster Column Wert = "+con.getMinimumColumnValue()); 147 } catch(Exception e) { 148 System.out.println("** Fehler"); 149 } 150 151 try { 152 System.out.println("** Größter Column Wert = "+con.getMaximumColumnValue()); 153 } catch(Exception e) { 154 System.out.println("** Fehler"); 155 } 156 } 157 158 public void testDefaultChartDataModel(ObjectChartDataModel m) { 159 try { 160 System.out.println("** AxisBinding von DataSet 0 = "+m.getAxisBinding(0)); 161 } catch(Exception e) { 162 System.out.println("** Fehler"); 163 } 164 165 try { 166 System.out.println("** ColumnValue At index 3 = "+m.getColumnValueAt(3)); 167 } catch(Exception e) { 168 System.out.println("** Fehler"); 169 } 170 171 try { 172 System.out.println("** ColumnValue At index 7 = "+m.getColumnValueAt(7)); 173 } catch(Exception e) { 174 System.out.println("** Fehler"); 175 } 176 177 try { 178 System.out.println("** Länge von DataSet 2 = "+m.getDataSetLength(2)); 179 } catch(Exception e) { 180 System.out.println("** Fehler"); 181 } 182 try { 183 System.out.println("** Anzahl von DataSets = "+m.getDataSetNumber()); 184 } catch(Exception e) { 185 System.out.println("** Fehler"); 186 } 187 try { 188 System.out.println("** Wert an Index 0,7 = "+m.getValueAt(0, 7)); 189 } catch(Exception e) { 190 System.out.println("** Fehler"); 191 } 192 try { 193 System.out.println("** Wert an Index 2,2 = "+m.getValueAt(2, 2)); 194 } catch(Exception e) { 195 System.out.println("** Fehler"); 196 } 197 198 ChartDataModelConstraints con; 199 200 try { 201 System.out.println("** Lade ChartDataModelConstraints für CoordSystem.SECOND_YAXIS"); 202 con = m.getChartDataModelConstraints(CoordSystem.SECOND_YAXIS); 203 } catch(Exception e) { 204 System.out.println("** Fehler"); 205 return; 206 } 207 208 try { 209 System.out.println("** Kleinster Wert = "+con.getMinimumValue()); 210 } catch(Exception e) { 211 System.out.println("** Fehler"); 212 } 213 214 try { 215 System.out.println("** Größter Wert = "+con.getMaximumValue()); 216 } catch(Exception e) { 217 System.out.println("** Fehler"); 218 } 219 220 try { 221 System.out.println("** Kleinster Column Wert = "+con.getMinimumColumnValue()); 222 } catch(Exception e) { 223 System.out.println("** Fehler"); 224 } 225 226 try { 227 System.out.println("** Größter Column Wert = "+con.getMaximumColumnValue()); 228 } catch(Exception e) { 229 System.out.println("** Fehler"); 230 } 231 } 232 233 236 public static void main (String args[]) { 237 new TestChartDataModel(); 238 } 239 240 } 241 | Popular Tags |