List of usage examples for org.jfree.chart.renderer.xy XYLineAndShapeRenderer setBaseLinesVisible
public void setBaseLinesVisible(boolean flag)
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
protected JFreeChart createScatterChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createScatterPlot( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()), evaluateTextExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()), (XYDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false);/*from w w w . j a va 2 s . c o m*/ configureChart(jfreeChart, getPlot()); XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot()) .getRenderer(); JRScatterPlot scatterPlot = (JRScatterPlot) getPlot(); boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines(); boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes(); plotRenderer.setBaseLinesVisible(isShowLines); plotRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(), scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(), scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(), scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(), getDomainAxisSettings(), (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(), scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(), scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(), scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(), getRangeAxisSettings(), (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()), (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java
private JFreeChart createXYLineChart(String title, String xLabel, String yLabel, XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data orientation, // orientation true, // include legend true, // tooltips false // urls );/*from ww w .ja va 2 s . c o m*/ chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setNoDataMessage("No data available"); // customise the renderer... XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); // customise the range axis... if (lineCondition.indexOf("qq") != -1) { renderer.setBaseShapesFilled(true); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(0, true); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setUpperMargin(0); rangeAxis.setLowerMargin(0); // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setUpperMargin(0); domainAxis.setLowerMargin(0); return chart; } NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRange(false); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); if (timeType.length() != 0) { setDateAxis(plot); } else { NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRange(false); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } // System.out.println("lineCondition "+lineCondition); if (lineCondition.indexOf("noshape") != -1) renderer.setBaseShapesVisible(false); else renderer.setBaseShapesVisible(true); if (lineCondition.indexOf("noline") != -1) renderer.setBaseLinesVisible(false); if (lineCondition.indexOf("nofill") != -1) { renderer.setBaseShapesFilled(false); renderer.setBaseFillPaint(Color.white); renderer.setDrawOutlines(true); } else { renderer.setBaseShapesFilled(true); renderer.setUseFillPaint(false); } return chart; }