当前位置: 首页>>代码示例>>Java>>正文


Java XYPlot.setBackgroundPaint方法代码示例

本文整理汇总了Java中org.jfree.chart.plot.XYPlot.setBackgroundPaint方法的典型用法代码示例。如果您正苦于以下问题:Java XYPlot.setBackgroundPaint方法的具体用法?Java XYPlot.setBackgroundPaint怎么用?Java XYPlot.setBackgroundPaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.plot.XYPlot的用法示例。


在下文中一共展示了XYPlot.setBackgroundPaint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private JFreeChart createChart(final XYDataset dataset) {
	final JFreeChart chart = ChartFactory.createXYLineChart(
			"MONA TIME AND COST GRAPH", "KeyGeneration Cost ",
			"KeyGenerating time for task(secs)", dataset,
			PlotOrientation.VERTICAL, true, true, false);
	chart.setBackgroundPaint(Color.white);
	final XYPlot plot1 = chart.getXYPlot();
	plot1.setBackgroundPaint(Color.lightGray);
	plot1.setDomainGridlinePaint(Color.white);
	plot1.setRangeGridlinePaint(Color.white);

	final XYPlot plot2 = chart.getXYPlot();
	plot2.setBackgroundPaint(Color.lightGray);
	plot2.setDomainGridlinePaint(Color.white);
	plot2.setRangeGridlinePaint(Color.white);

	final XYPlot plot3 = chart.getXYPlot();
	plot3.setBackgroundPaint(Color.lightGray);
	plot3.setDomainGridlinePaint(Color.white);
	plot3.setRangeGridlinePaint(Color.white);

	return chart;
}
 
开发者ID:cyberheartmi9,项目名称:Mona-Secure-Multi-Owner-Data-Sharing-for-Dynamic-Group-in-the-Cloud,代码行数:24,代码来源:TimeandCostGraph.java

示例2: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private JFreeChart createChart(final XYDataset dataset) {
	final JFreeChart chart = ChartFactory.createXYLineChart("Auditing",
			"Fraction of Invalid Responses ", "Auding time for task(ms)",
			dataset, PlotOrientation.VERTICAL, true, true, false);
	chart.setBackgroundPaint(Color.white);
	final XYPlot plot1 = chart.getXYPlot();
	plot1.setBackgroundPaint(Color.lightGray);
	plot1.setDomainGridlinePaint(Color.white);
	plot1.setRangeGridlinePaint(Color.white);

	final XYPlot plot2 = chart.getXYPlot();
	plot2.setBackgroundPaint(Color.lightGray);
	plot2.setDomainGridlinePaint(Color.white);
	plot2.setRangeGridlinePaint(Color.white);

	final XYPlot plot3 = chart.getXYPlot();
	plot3.setBackgroundPaint(Color.lightGray);
	plot3.setDomainGridlinePaint(Color.white);
	plot3.setRangeGridlinePaint(Color.white);

	return chart;
}
 
开发者ID:cyberheartmi9,项目名称:Mona-Secure-Multi-Owner-Data-Sharing-for-Dynamic-Group-in-the-Cloud,代码行数:23,代码来源:MultiLineChart.java

示例3: createHistogramChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
 * Creates the histogram chart.
 *
 * @param exampleSet
 * @return
 */
private JFreeChart createHistogramChart(ExampleSet exampleSet) {
	JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
			PlotOrientation.VERTICAL, false, false, false);
	AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
	chart.setBackgroundPaint(null);
	chart.setBackgroundImageAlpha(0.0f);

	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setRangeGridlinesVisible(false);
	plot.setDomainGridlinesVisible(false);
	plot.setOutlineVisible(false);
	plot.setRangeZeroBaselineVisible(false);
	plot.setDomainZeroBaselineVisible(false);
	plot.setBackgroundPaint(COLOR_INVISIBLE);
	plot.setBackgroundImageAlpha(0.0f);

	XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
	renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NUMERICAL));
	renderer.setBarPainter(new StandardXYBarPainter());
	renderer.setDrawBarOutline(true);
	renderer.setShadowVisible(false);

	return chart;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:31,代码来源:NumericalAttributeStatisticsModel.java

示例4: GenerateRTMapPNG

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private void GenerateRTMapPNG(XYSeriesCollection xySeriesCollection, XYSeries series, float R2) throws IOException {
    new File(Workfolder + "/RT_Mapping/").mkdir();
    String pngfile = Workfolder + "/RT_Mapping/" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName).substring(0, Math.min(120, FilenameUtils.getBaseName(LCMSA.mzXMLFileName).length() - 1)) + "_" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName).substring(0, Math.min(120, FilenameUtils.getBaseName(LCMSB.mzXMLFileName).length() - 1)) + "_RT.png";

    XYSeries smoothline = new XYSeries("RT fitting curve");
    for (XYZData data : regression.PredictYList) {
        smoothline.add(data.getX(), data.getY());
    }
    xySeriesCollection.addSeries(smoothline);
    xySeriesCollection.addSeries(series);
    JFreeChart chart = ChartFactory.createScatterPlot("Retention time mapping: R2=" + R2, "RT:" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName), "RT:" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName), xySeriesCollection,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.setDomainCrosshairVisible(true);
    xyPlot.setRangeCrosshairVisible(true);

    XYItemRenderer renderer = xyPlot.getRenderer();
    renderer.setSeriesPaint(1, Color.blue);
    renderer.setSeriesPaint(0, Color.BLACK);
    renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0, 3, 3));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(0, new BasicStroke(3.0f));
    xyPlot.setBackgroundPaint(Color.white);
    ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:26,代码来源:RTAlignedPepIonMapping.java

示例5: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private JFreeChart createChart(final XYDataset dataset) {
	final JFreeChart chart = ChartFactory.createXYLineChart(
			"MONA STORAGE GRAPH", "KeyGeneration per users ",
			"KeyGenerating size in Bytes", dataset,
			PlotOrientation.VERTICAL, true, true, false);
	chart.setBackgroundPaint(Color.white);
	final XYPlot plot1 = chart.getXYPlot();
	plot1.setBackgroundPaint(Color.lightGray);
	plot1.setDomainGridlinePaint(Color.white);
	plot1.setRangeGridlinePaint(Color.white);

	final XYPlot plot2 = chart.getXYPlot();
	plot2.setBackgroundPaint(Color.lightGray);
	plot2.setDomainGridlinePaint(Color.white);
	plot2.setRangeGridlinePaint(Color.white);

	final XYPlot plot3 = chart.getXYPlot();
	plot3.setBackgroundPaint(Color.lightGray);
	plot3.setDomainGridlinePaint(Color.white);
	plot3.setRangeGridlinePaint(Color.white);

	return chart;
}
 
开发者ID:cyberheartmi9,项目名称:Mona-Secure-Multi-Owner-Data-Sharing-for-Dynamic-Group-in-the-Cloud,代码行数:24,代码来源:KeyStorageGraph.java

示例6: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
 * Creates a sample chart.
 * 
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private static JFreeChart createChart(VectorXYDataset dataset) {
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.01);
    xAxis.setUpperMargin(0.01);
    xAxis.setAutoRangeIncludesZero(false);
    
    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.01);
    yAxis.setUpperMargin(0.01);
    yAxis.setAutoRangeIncludesZero(false);
    VectorRenderer renderer = new VectorRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
    plot.setOutlinePaint(Color.black);
    JFreeChart chart = new JFreeChart("Vector Plot Demo 1", plot);
    chart.setBackgroundPaint(Color.white);
    return chart;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:VectorPlotDemo1.java

示例7: setPlotBackgroundColor

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private void setPlotBackgroundColor(Color backgroundColor) {
	JFreeChart chart = getCurrentChart();
	if (chart != null) {
		Plot plot = chart.getPlot();
		if (plot instanceof CategoryPlot) {
			CategoryPlot categoryPlot = (CategoryPlot) plot;
			categoryPlot.setBackgroundPaint(backgroundColor);
		} else {
			XYPlot xyPlot = (XYPlot) plot;
			xyPlot.setBackgroundPaint(backgroundColor);
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:JFreeChartPlotEngine.java

示例8: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private static JFreeChart createChart(XYDataset dataset, String chartName) {
// create the chart...

if(chartName == null)
 chartName = FunctionToPlot;

JFreeChart chart = ChartFactory.createXYLineChart(
chartName,
Var,
Value,
dataset,
PlotOrientation.VERTICAL,
true,
true, 
false
);
chart.setBackgroundPaint(Color.white);

 XYPlot plot = (XYPlot) chart.getPlot();
 plot.setBackgroundPaint(Color.lightGray);
 plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
 plot.setDomainGridlinePaint(Color.white);
 plot.setRangeGridlinePaint(Color.white);
XYLineAndShapeRenderer renderer
= (XYLineAndShapeRenderer) plot.getRenderer();
//renderer.setShapesVisible(true);
//renderer.setShapesFilled(true);
// change the auto tick unit selection to integer units only...
 NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setLabelAngle(Math.PI/2.0);
 rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED.
return chart;
 }
 
开发者ID:mathhobbit,项目名称:EditCalculateAndChart,代码行数:34,代码来源:grPlt.java

示例9: GenerateRTMapPNG

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private void GenerateRTMapPNG(XYSeriesCollection xySeriesCollection, XYSeries series, float R2) throws IOException {
    String pngfile = FilenameUtils.getFullPath(TargetLCMS.mzXMLFileName) + "/" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName) + "_" + libManager.LibID + "_RTMap.png";
    FileWriter writer = new FileWriter(FilenameUtils.getFullPath(TargetLCMS.mzXMLFileName) + "/" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName) + "_" + libManager.LibID + "_RTMap.txt");

    XYSeries smoothline = new XYSeries("RT fitting curve");
    for (XYZData data : regression.PredictYList) {
        smoothline.add(data.getX(), data.getY());
        writer.write(data.getX() + "\t" + data.getY() + "\n");
    }
    writer.close();
    xySeriesCollection.addSeries(smoothline);
    xySeriesCollection.addSeries(series);
    JFreeChart chart = ChartFactory.createScatterPlot("Retention time mapping: R2=" + R2, "Normalized RT (" + libManager.LibID + ")", "RT:" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName), xySeriesCollection,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    xyPlot.setDomainCrosshairVisible(true);
    xyPlot.setRangeCrosshairVisible(true);

    XYItemRenderer renderer = xyPlot.getRenderer();
    renderer.setSeriesPaint(1, Color.blue);
    renderer.setSeriesPaint(0, Color.BLACK);
    renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0, 3, 3));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(0, new BasicStroke(3.0f));
    xyPlot.setBackgroundPaint(Color.white);
    ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:28,代码来源:RTMappingExtLib.java

示例10: crearChartNotifAsigResc

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
public void crearChartNotifAsigResc(){
    chartNotifAsigResc = ChartFactory.createXYLineChart(
      "Peticion,Asignacion y Rescate por el equipo",      // chart title Titulo local del grafico
      "Victimas en Entorno",                      // x axis label
      "Tiempo milisegundos",                      // y axis label
      null,                  // data
      PlotOrientation.VERTICAL,
      true,                     // include legend
      true,                     // tooltips
      false                     // urls
  );

  // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
  chartNotifAsigResc.setBackgroundPaint(Color.white);   //El fondo exterior del grafico sera blanco
  //      chart1.setBackgroundPaint(Color.green);

  // get a reference to the plot for further customisation...
 XYPlot plot = chartNotifAsigResc.getXYPlot();
  plot.setBackgroundPaint(Color.lightGray); //El fondo interior del grafico sera gris
  //plot.setBackgroundPaint(Color.blue);

  plot.setDomainGridlinePaint(Color.white);  //Las lineas verticales de la cuadricula se pinta de color blanco
  plot.setRangeGridlinePaint(Color.white);  //Las lineas horizontales de la cuadricula se pintan de color blanco
  
      
  ChartPanel chartPanel = new ChartPanel(chartNotifAsigResc);
  chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
  setContentPane(chartPanel);
  this.pack();
  RefineryUtilities.centerFrameOnScreen(this);
  this.setVisible(true);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:33,代码来源:VisualizacionJfreechart.java

示例11: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
protected JFreeChart createChart(XYDataset dataset) {
    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart("Quantidade de pixels", "Pixel", "Quantidade", dataset,
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    chart.setBackgroundPaint(java.awt.Color.white);

    // final StandardLegend legend = (StandardLegend) chart.getLegend();
    // legend.setDisplaySeriesShapes(true);

    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(java.awt.Color.lightGray);
    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(java.awt.Color.white);
    plot.setRangeGridlinePaint(java.awt.Color.white);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;
}
 
开发者ID:nbfontana,项目名称:pdi,代码行数:28,代码来源:Interface.java

示例12: createChartXY

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
 * Creates a chart.
 *
 * @param dataset
 *            the data for the chart.
 *
 * @return a chart.
 */
private JFreeChart createChartXY(final XYDataset dataset) {

	// create the chart...
	final JFreeChart chart = ChartFactory.createXYLineChart("Line Chart Demo 6", // chart
																					// title
			"X", // x axis label
			"Y", // y axis label
			dataset, // data
			PlotOrientation.VERTICAL, true, // include legend
			true, // tooltips
			false // urls
	);

	// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
	chart.setBackgroundPaint(Color.white);

	// final StandardLegend legend = (StandardLegend) chart.getLegend();
	// legend.setDisplaySeriesShapes(true);

	// get a reference to the plot for further customisation...
	final XYPlot plot = chart.getXYPlot();
	plot.setBackgroundPaint(Color.lightGray);
	// plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
	plot.setDomainGridlinePaint(Color.white);
	plot.setRangeGridlinePaint(Color.white);

	final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
	renderer.setSeriesLinesVisible(0, false);
	renderer.setSeriesShapesVisible(1, false);
	plot.setRenderer(renderer);

	// change the auto tick unit selection to integer units only...
	final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
	rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
	// OPTIONAL CUSTOMISATION COMPLETED.

	return chart;

}
 
开发者ID:rototor,项目名称:pdfbox-graphics2d,代码行数:48,代码来源:MultiPageTest.java

示例13: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
 * Creates a chart.
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "Legal & General Unit Trust Prices",  // title
        "Date",             // x-axis label
        "Price Per Unit",   // y-axis label
        dataset,            // data
        true,               // create legend?
        true,               // generate tooltips?
        false               // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    
    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }
    
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    
    return chart;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:43,代码来源:TimeSeriesChartDemo1.java

示例14: GraphGenerator

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
public GraphGenerator(final String title, AthenaFeatures athenaFeatures, String feature) {
        super(title);
        this.feature = feature;
        final XYDataset dataset = createDatasetFromFeatureData(athenaFeatures, feature);
        final JFreeChart chart = createChart(dataset);
        chart.setTitle("");
        LegendTitle legend = (LegendTitle) chart.getLegend();
        chart.removeLegend();
        Font nwfont = new Font("Arial",1,12);
        legend.setItemFont(nwfont);
        legend.setPosition(RectangleEdge.TOP);
//        legend.setWidth(200);
        legend.setItemLabelPadding(new RectangleInsets(3, 3, 3, 3));
        legend.setHeight(10);
//        legend.setPadding(new RectangleInsets(10, 10, 10, 10));
        XYTitleAnnotation ta = new XYTitleAnnotation(0.99, 0.98, legend, RectangleAnchor.TOP_RIGHT);
        ta.setMaxWidth(0.95);
//        chart.addLegend(legend);

        XYPlot plot = (XYPlot) chart.getPlot();
        plot.setBackgroundPaint(Color.white);
        plot.setDomainZeroBaselinePaint(Color.gray);
        plot.setDomainGridlinePaint(Color.gray);
        plot.setDomainGridlineStroke(new BasicStroke(0.7f));
        plot.setRangeGridlinePaint(Color.gray);
        plot.setRangeGridlineStroke(new BasicStroke(0.7f));
        plot.setDomainMinorGridlinePaint(Color.black);
        plot.addAnnotation(ta);
        final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
        renderer.setSeriesPaint(0, Color.black);
        renderer.setSeriesShape(0, ShapeUtilities.createDiamond(5));
        renderer.setSeriesPaint(1, Color.red);
        renderer.setSeriesShape(1, ShapeUtilities.createUpTriangle(5));
        renderer.setSeriesPaint(2, Color.blue);
        Shape shape  = new Ellipse2D.Double(-5.0,-5.0,10,10);
        renderer.setSeriesShape(2, shape);
        renderer.setShapesFilled(false);
//        renderer.setSeriesShapesVisible(1, false);

        //apply theme
//        StandardChartTheme.createJFreeTheme().apply(chart);

        plot.setRenderer(renderer);
        NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
        yAxis.setLabel(feature + " (K)");
        yAxis.setAxisLineVisible(false);
        yAxis.setTickUnit(new NumberTickUnit(50000));
        yAxis.setNumberFormatOverride(new ByteFormat());
        yAxis.setRange(new Range(0, 160000));
        plot.getRenderer().setBaseItemLabelsVisible(true);
        DateAxis xAxis = (DateAxis) plot.getDomainAxis();
        xAxis.setAxisLineVisible(false);
        xAxis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"));
        xAxis.setTickUnit(new DateTickUnit(DateTickUnit.MINUTE, 3));
        xAxis.setLabelFont(new Font("Arial",1,12));
        final ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new java.awt.Dimension(631, 381));
        chartPanel.setMouseZoomable(true, true);
        setContentPane(chartPanel);
        try { 
            ChartUtilities.saveChartAsPNG(new File("result.png"), chart, 631, 381);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:67,代码来源:GraphGenerator.java

示例15: createChart

import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
private JFreeChart createChart(XYDataset dataset) {
	// create the chart...
	JFreeChart chart = ChartFactory.createXYLineChart(null,      // chart title
			null,                      // x axis label
			null,                      // y axis label
			dataset,                  // data
			PlotOrientation.VERTICAL, true,                     // include legend
			true,                     // tooltips
			false                     // urls
			);

	chart.setBackgroundPaint(Color.white);

	// get a reference to the plot for further customisation...
	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setBackgroundPaint(Color.WHITE);
	plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
	plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
	plot.setRangeGridlinePaint(Color.LIGHT_GRAY);

	ValueAxis valueAxis = plot.getRangeAxis();
	valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	ValueAxis domainAxis = plot.getDomainAxis();
	domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD);
	domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT);

	DeviationRenderer renderer = new DeviationRenderer(true, false);
	Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
	if (dataset.getSeriesCount() == 1) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);
	} else if (dataset.getSeriesCount() == 2) {
		renderer.setSeriesStroke(0, stroke);
		renderer.setSeriesPaint(0, Color.RED);
		renderer.setSeriesFillPaint(0, Color.RED);

		renderer.setSeriesStroke(1, stroke);
		renderer.setSeriesPaint(1, Color.BLUE);
		renderer.setSeriesFillPaint(1, Color.BLUE);
	} else {
		for (int i = 0; i < dataset.getSeriesCount(); i++) {
			renderer.setSeriesStroke(i, stroke);
			Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
			renderer.setSeriesPaint(i, color);
			renderer.setSeriesFillPaint(i, color);
		}
	}
	renderer.setAlpha(0.12f);
	plot.setRenderer(renderer);

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(PlotterAdapter.LABEL_FONT);
	}
	return chart;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:64,代码来源:ROCChartPlotter.java


注:本文中的org.jfree.chart.plot.XYPlot.setBackgroundPaint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。