ChartObject { public JFreeChart createOverlaidChart() { final DateAxis yAxis = new DateAxis( "Time" ); yAxis.setTickMarkPosition( DateTickMarkPosition.MIDDLE ); final NumberAxis xAxis0 = new NumberAxis( "Response Time in ms" ); xAxis0.setStandardTickUnits( NumberAxis.createStandardTickUnits() ); final XYDataset dataResponseTimeProbes = createDatasetResponseTime( "testprobe" ); final XYLineAndShapeRenderer rendererResponseTimeProbes = new XYLineAndShapeRenderer(); rendererResponseTimeProbes.setSeriesPaint( 0, Color.blue ); rendererResponseTimeProbes.setSeriesShape( 0, new Ellipse2D.Double( -1.5, -1.5, 3.0, 3.0 ) ); rendererResponseTimeProbes.setSeriesLinesVisible( 0, true ); rendererResponseTimeProbes.setSeriesShapesVisible( 0, true ); rendererResponseTimeProbes.setUseOutlinePaint( false ); rendererResponseTimeProbes.setSeriesOutlinePaint( 0, Color.black ); rendererResponseTimeProbes.setUseFillPaint( true ); rendererResponseTimeProbes.setSeriesFillPaint( 0, Color.blue ); final XYPlot plot = new XYPlot( dataResponseTimeProbes, yAxis, xAxis0, rendererResponseTimeProbes ); final XYDataset dataResponseTimeUntampered = createDatasetResponseTime( "untampered" ); final XYLineAndShapeRenderer rendererResponseTimeUntampered = new XYLineAndShapeRenderer(); rendererResponseTimeUntampered.setSeriesPaint( 0, new Color( 0, 161, 4 ) ); rendererResponseTimeUntampered.setSeriesShape( 0, new Ellipse2D.Double( -4, -4, 8.0, 8.0 ) ); rendererResponseTimeUntampered.setUseFillPaint( true ); rendererResponseTimeUntampered.setSeriesFillPaint( 0, Color.white ); rendererResponseTimeUntampered.setUseOutlinePaint( false ); rendererResponseTimeUntampered.setSeriesOutlinePaint( 0, Color.black ); rendererResponseTimeUntampered.setSeriesToolTipGenerator( 0, new StandardXYToolTipGenerator( StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat( "d-MMM-yyyy" ), new DecimalFormat( "0.00" ) ) ); plot.setDataset( 2, dataResponseTimeUntampered ); plot.setRenderer( 2, rendererResponseTimeUntampered ); final XYDataset dataResponseTimeTampered = createDatasetResponseTime( "tampered" ); XYLineAndShapeRenderer rendererResponseTimeTampered = new XYLineAndShapeRenderer(); rendererResponseTimeTampered.setSeriesPaint( 0, new Color( 189, 0, 0 ) ); rendererResponseTimeTampered.setSeriesShape( 0, new Ellipse2D.Double( -4, -4, 8.0, 8.0 ) ); rendererResponseTimeTampered.setUseFillPaint( true ); rendererResponseTimeTampered.setSeriesFillPaint( 0, Color.white ); rendererResponseTimeTampered.setUseOutlinePaint( false ); rendererResponseTimeTampered.setSeriesOutlinePaint( 0, Color.black ); plot.setDataset( 3, dataResponseTimeTampered ); plot.setRenderer( 3, rendererResponseTimeTampered ); final NumberAxis xAxis1 = new NumberAxis( "Number Requests Per Interval (" + ( model.getIntervalLengthReport() / 1000 ) + " sec)" ); xAxis1.setStandardTickUnits( NumberAxis.createIntegerTickUnits() ); plot.setRangeAxis( 1, xAxis1 ); final IntervalXYDataset dataNumberRequestsUntampered = createDatasetNumberRequestsUntampered(); final XYBarRenderer rendererNumberRequestsUntampered = new XYBarRenderer( 0.2 ); rendererNumberRequestsUntampered.setShadowVisible( false ); rendererNumberRequestsUntampered.setBarPainter( new StandardXYBarPainter() ); rendererNumberRequestsUntampered.setSeriesPaint( 0, new Color( 128, 255, 128 ) ); plot.setDataset( 4, dataNumberRequestsUntampered ); plot.setRenderer( 4, rendererNumberRequestsUntampered ); plot.mapDatasetToRangeAxis( 4, 1 ); final IntervalXYDataset dataNumberRequestsTampered = createDatasetNumberRequestsTampered(); final XYBarRenderer rendererBarNumberRequestsTampered = new XYBarRenderer( 0.2 ); rendererBarNumberRequestsTampered.setShadowVisible( false ); rendererBarNumberRequestsTampered.setBarPainter( new StandardXYBarPainter() ); rendererBarNumberRequestsTampered.setSeriesPaint( 0, new Color( 255, 148, 148 ) ); plot.setDataset( 5, dataNumberRequestsTampered ); plot.setRenderer( 5, rendererBarNumberRequestsTampered ); plot.mapDatasetToRangeAxis( 5, 1 ); LegendTitle legendL1 = new LegendTitle( plot.getRenderer( 0 ) ); legendL1.setMargin( new RectangleInsets( 2D, 2D, 2D, 2D ) ); legendL1.setBorder( 0, 0, 0, 0 ); LegendTitle legendR1 = new LegendTitle( plot.getRenderer( 4 ) ); legendR1.setMargin( new RectangleInsets( 2D, 2D, 2D, 2D ) ); legendR1.setBorder( 0, 0, 0, 0 ); BlockContainer blockcontainer = new BlockContainer( new BorderArrangement() ); blockcontainer.setBorder( 0, 0, 0, 0 ); blockcontainer.add( legendL1, RectangleEdge.LEFT ); blockcontainer.add( legendR1, RectangleEdge.RIGHT ); blockcontainer.add( new EmptyBlock( 2000D, 0.0D ) ); CompositeTitle compositetitle1 = new CompositeTitle( blockcontainer ); compositetitle1.setPosition( RectangleEdge.BOTTOM ); LegendTitle legendL2 = new LegendTitle( plot.getRenderer( 2 ) ); legendL2.setMargin( new RectangleInsets( 2D, 2D, 2D, 2D ) ); legendL2.setBorder( 0, 0, 0, 0 ); LegendTitle legendR2 = new LegendTitle( plot.getRenderer( 5 ) ); legendR2.setMargin( new RectangleInsets( 2D, 2D, 2D, 2D ) ); legendR2.setBorder( 0, 0, 0, 0 ); BlockContainer blockcontainer2 = new BlockContainer( new BorderArrangement() ); blockcontainer2.setBorder( 0, 0, 0, 0 ); blockcontainer2.add( legendL2, RectangleEdge.LEFT ); blockcontainer2.add( legendR2, RectangleEdge.RIGHT ); blockcontainer2.add( new EmptyBlock( 2000D, 0.0D ) ); CompositeTitle compositetitle2 = new CompositeTitle( blockcontainer2 ); compositetitle2.setPosition( RectangleEdge.BOTTOM ); LegendTitle legendL3 = new LegendTitle( plot.getRenderer( 3 ) ); legendL3.setMargin( new RectangleInsets( 2D, 2D, 2D, 2D ) ); legendL3.setBorder( 0, 0, 0, 0 ); BlockContainer blockcontainer3 = new BlockContainer( new BorderArrangement() ); blockcontainer3.setBorder( 0, 0, 0, 0 ); blockcontainer3.add( legendL3, RectangleEdge.LEFT ); blockcontainer3.add( new EmptyBlock( 2000D, 0.0D ) ); CompositeTitle compositetitle3 = new CompositeTitle( blockcontainer3 ); compositetitle3.setPosition( RectangleEdge.BOTTOM ); plot.setDatasetRenderingOrder( DatasetRenderingOrder.REVERSE ); plot.setOrientation( PlotOrientation.VERTICAL ); JFreeChart jFreeChart = new JFreeChart( model.getAttackName() + " - Response Time Plot", JFreeChart.DEFAULT_TITLE_FONT, plot, true ); jFreeChart.addSubtitle( compositetitle1 ); jFreeChart.addSubtitle( compositetitle2 ); jFreeChart.addSubtitle( compositetitle3 ); LegendTitle legendee2 = jFreeChart.getLegend( 0 ); legendee2.setVisible( false ); return jFreeChart; } ChartObject( AttackModel model ); JFreeChart createOverlaidChart();  }
@Test public void testCreateOverlaidChart() { AttackModel model = new AttackModel(); ChartObject chartObject = new ChartObject( model ); JFreeChart chart = chartObject.createOverlaidChart(); assertNotNull( "Should contain chart object", chart ); }