Bug -- setDrawLines() not working

Discussion about JFreeChart related to stockmarket charts.
Locked
Moe76

Bug -- setDrawLines() not working

Post by Moe76 » Wed Jul 14, 2004 8:05 pm

Heres some code:
--------------------------

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);
Basically I'm drawing two series on a basic plot and trying to connect the dots. I combine data sources to sort automatically then insert each entry into the dataset using the correct series flag. Does each group of series data have to be entered consecutively? Can that be my problem? If so how would you go about implementing this?[/code]

Locked