--------------------------
Code: Select all
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
TreeMap treeMap = getTemperatureData(req);
treeMap.putAll(getPulseData(req));
Set keySet = treeMap.keySet();
Iterator iterator = keySet.iterator();
while(iterator.hasNext() ){
Integer key = (Integer)iterator.next(); dataset.addValue(Float.parseFloat((String)((ChartValue)treeMap.get(key)).getValue()),
((ChartValue)treeMap.get(key)).getChartType() == ChartValue.PULSE ? PULSE_SERIES : TEMPERATURE_SERIES,
key.toString());
}
...
...
...
chart.setBackgroundPaint((Color.white).brighter());
CategoryPlot plot = chart.getCategoryPlot();
LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setDrawLines(true);
renderer.setDrawShapes(true);
renderer.setShapesFilled(true);
BasicStroke temperatureStroke = new BasicStroke(2.0f,
BasicStroke.CAP_SQUARE,BasicStroke.JOIN_BEVEL,1.0f,new float[] {10.0f, 6.0f},0.0f);
BasicStroke pulseStroke = new BasicStroke(2.0f,
BasicStroke.CAP_SQUARE,BasicStroke.JOIN_BEVEL,1.0f,new float[] {10.0f, 6.0f},0.0f);
renderer.setSeriesStroke(0, temperatureStroke);
renderer.setSeriesStroke(1, pulseStroke);