當前位置: 首頁>>代碼示例>>Java>>正文


Java ChartFactory.createXYLineChart方法代碼示例

本文整理匯總了Java中org.jfree.chart.ChartFactory.createXYLineChart方法的典型用法代碼示例。如果您正苦於以下問題:Java ChartFactory.createXYLineChart方法的具體用法?Java ChartFactory.createXYLineChart怎麽用?Java ChartFactory.createXYLineChart使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.ChartFactory的用法示例。


在下文中一共展示了ChartFactory.createXYLineChart方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: linePlot

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
public JFreeChart linePlot(String xLabel, String yLabel){
    int numDatasets = dataset.size();
    JFreeChart result = ChartFactory.createXYLineChart(
chartTitle, // chart title
xLabel, // x axis label
yLabel, // y axis label
dataset.get(0), // data
PlotOrientation.VERTICAL, 
true, // include legend
true, // tooltips
false // urls
    );
    XYPlot plot = result.getXYPlot();
    plot.getRenderer().setSeriesStroke(0, new BasicStroke(1.0f));
    plot.getRenderer().setSeriesPaint(0, seriesColor.get(0));
    for(int i=1;i<numDatasets;i++){
        plot.setDataset(i,dataset.get(i));
        //XYItemRenderer renderer = plot.getRenderer(i-0);
        //plot.setRenderer(i, new XYLineAndShapeRenderer(false, true));
        plot.getRenderer(i).setSeriesStroke(0, new BasicStroke(1.0f));
        plot.getRenderer(i).setSeriesPaint(0,seriesColor.get(i));
    }

    return result;
}
 
開發者ID:PacktPublishing,項目名稱:Neural-Network-Programming-with-Java-SecondEdition,代碼行數:26,代碼來源:Chart.java

示例2: writeROCCurves

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
public static void writeROCCurves(File outputFile, TreeMap<String, HitStatistic> hits) throws Exception{

		XYSeriesCollection dataset = new XYSeriesCollection();
		
		for(Entry<String, HitStatistic> e:hits.entrySet()){
			File txtFile=new File(outputFile.getAbsolutePath().replaceAll(".jpg","_"+e.getKey().split("-")[2]+".txt"));
			BufferedWriter bw=new BufferedWriter(new FileWriter(txtFile));
			XYSeries series= new XYSeries(e.getKey());
			bw.write("false positive rate\tsensitivity");
			bw.newLine();
			List<double[]> roc=e.getValue().getROCAverage();
			for(double[] r:roc){
				bw.write(r[0]+"\t"+r[1]);
				bw.newLine();
				series.add(r[0],r[1]);
			}
			dataset.addSeries(series);
			bw.close();
		}
		
		
		final JFreeChart chart =ChartFactory.createXYLineChart("ROCCurve",  "false positive rate", "sensitivity", dataset);
		ChartUtilities.saveChartAsJPEG(outputFile, chart, 1000, 400);
	}
 
開發者ID:boecker-lab,項目名稱:passatuto,代碼行數:25,代碼來源:HitStatistic.java

示例3: XyChartTab

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
 * Instantiates a new XyChartTab.
 * @param model the model
 */
public XyChartTab(XyDataModel model, XyChartEditorJPanel parent){
	super(ChartFactory.createXYLineChart(
			model.getOntologyModel().getChartSettings().getChartTitle(), 
			model.getOntologyModel().getChartSettings().getXAxisLabel(), 
			model.getOntologyModel().getChartSettings().getYAxisLabel(), 
			((XyChartModel)model.getChartModel()).getXySeriesCollection(), 
			PlotOrientation.VERTICAL, 
			true, false, false
	), parent);
	
	this.dataModel = model;
	this.applySettings();
	
	this.dataModel.getChartModel().addObserver(this);
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:20,代碼來源:XyChartTab.java

示例4: createChart

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
private static 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, false,                     // include legend
				true,                      // tooltips
				false                      // urls
				);

		chart.setBackgroundPaint(Color.white);

		// get a reference to the plot for further customization...
		XYPlot plot = (XYPlot) chart.getPlot();
		plot.setBackgroundPaint(Color.WHITE);

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

		return chart;
	}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:25,代碼來源:ParallelPlotter2.java

示例5: testDrawRangeGridlines

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
 * A test for drawing range grid lines when there is no primary renderer.
 * In 1.0.4, this is throwing a NullPointerException.
 */
public void testDrawRangeGridlines() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
            dataset, PlotOrientation.VERTICAL, true, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(null);
    boolean success = false;
    try {
        BufferedImage image = new BufferedImage(200 , 100, 
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:26,代碼來源:XYPlotTests.java

示例6: getChart

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
@Override
public JFreeChart getChart() throws IOException {

    if (chart == null) {
        final YIntervalSeriesCollection series_collection = getDataset();

        chart = ChartFactory.createXYLineChart(chart_title, "Time through experiment (s)", y_axis_label, series_collection, PlotOrientation.VERTICAL, getDataset().getSeriesCount() > 1, false, false);
        final XYErrorRenderer error_renderer = new XYErrorRenderer();
        error_renderer.setBaseShapesVisible(false);
        error_renderer.setBaseLinesVisible(true);
        error_renderer.setDrawYError(false);
        final XYPlot plot = chart.getXYPlot();
        plot.getRangeAxis().setLowerBound(0);
        plot.setRenderer(error_renderer);
        PlainChartTheme.applyTheme(chart);
    }
    return chart;
}
 
開發者ID:stacs-srg,項目名稱:shabdiz,代碼行數:19,代碼來源:OverlaidGaugeCsvAnalyzer.java

示例7: createChart

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
 * Create a horizontal bar chart with sample data in the range -3 to +3.
 *
 * @return The chart.
 */
private static JFreeChart createChart() {

    // create a dataset...
    XYSeries series1 = new XYSeries("Series 1");
    series1.add(1.0, 1.0);
    series1.add(2.0, 2.0);
    series1.add(3.0, 3.0);
    XYDataset dataset = new XYSeriesCollection(series1);

    // create the chart...
    return ChartFactory.createXYLineChart(
        "XY Line Chart",  // chart title
        "Domain",
        "Range",
        dataset,         // data
        PlotOrientation.VERTICAL,
        true,            // include legend
        true,            // tooltips
        true             // urls
    );

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:28,代碼來源:XYLineChartTests.java

示例8: createChart

import org.jfree.chart.ChartFactory; //導入方法依賴的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

示例9: inicializacionJFreeChart

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
public void inicializacionJFreeChart(String title, String xAxisLabel, String yAxisLabel,
		                             PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {    	
    chart1 = ChartFactory.createXYLineChart(
    			title,      // chart title Titulo local del grafico
    			xAxisLabel,                      // x axis label
    			yAxisLabel,                      // y axis label
    			null,                  // data
    			orientation,
    			legend,                     // include legend
    			tooltips,                     // tooltips
    			urls                     // urls
            );        
    
    // get a reference to the plot for further customisation...
 XYPlot   plot = chart1.getXYPlot();
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:17,代碼來源:VisualizacionJfreechart.java

示例10: createNumericalChart

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
private JFreeChart createNumericalChart() {
	JFreeChart chart;
	XYDataset dataset = createNumericalDataSet();
	// create the chart...
	String domainName = dataTable == null ? MODEL_DOMAIN_AXIS_NAME : dataTable.getColumnName(plotColumn);
	chart = ChartFactory.createXYLineChart(null, // chart title
			domainName, // x axis label
			RANGE_AXIS_NAME, // y axis label
			dataset, // data
			PlotOrientation.VERTICAL, true, // include legend
			true, // tooltips
			false // urls
			);

	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 {
		for (int i = 0; i < dataset.getSeriesCount(); i++) {
			renderer.setSeriesStroke(i, stroke);
			Color color = getColorProvider().getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
			renderer.setSeriesPaint(i, color);
			renderer.setSeriesFillPaint(i, color);
		}
	}
	renderer.setAlpha(0.12f);

	XYPlot plot = (XYPlot) chart.getPlot();
	plot.setRenderer(renderer);

	return chart;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:36,代碼來源:DistributionPlotter.java

示例11: createChart

import org.jfree.chart.ChartFactory; //導入方法依賴的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

示例12: createChartXY

import org.jfree.chart.ChartFactory; //導入方法依賴的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: inicializacionJFreeChart

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
public void inicializacionJFreeChart(){    	
    // Creates a SegmentedTimeline instance, the time scope is "09:30-11:30,13:00-15:00".
      chart1 = ChartFactory.createXYLineChart(
      "Victim's Notification and Assignment to Team members ",      // chart title Titulo local del grafico
      "Victim's Notification",                      // x axis label
      "Time in seconds",                      // y axis label
      null,                  // data
      PlotOrientation.VERTICAL,
      true,                     // include legend
      true,                     // tooltips
      false                     // urls
  );

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

  // get a reference to the plot for further customisation...
  plot = chart1.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(chart1);
  chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
  setContentPane(chartPanel);
  this.pack();
  RefineryUtilities.centerFrameOnScreen(this);
  this.setVisible(true);
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:34,代碼來源:VisualizacionJfreechart.java

示例14: showChart

import org.jfree.chart.ChartFactory; //導入方法依賴的package包/類
/**
 * Creates the chart and the frame that displays it to the user in a new thread.
 */
public void showChart() {
    Thread t = new Thread(new Runnable() {
        @Override
        public void run() {
            //Create new frame
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

            //Reset current dataset
            dataset = new XYSeries(name);
            //Create chart with dataset
            chart = ChartFactory.createXYLineChart(
                    name,
                    "Index",
                    "Value",
                    new XYSeriesCollection(dataset),
                    PlotOrientation.VERTICAL,
                    true, false, false);

            chart.getXYPlot().getDomainAxis().setAutoRange(true);
            chart.getXYPlot().getDomainAxis().setFixedAutoRange(1000);

            //Setup new chartpanel
            chartPanel = new ChartPanel(chart);
            chartPanel.setPreferredSize(new Dimension(560, 370));
            f.setContentPane(chartPanel);
            f.pack();
            f.setVisible(true);
        }
    });
    t.start();
}
 
開發者ID:felixnorden,項目名稱:moppepojkar,代碼行數:36,代碼來源:ValuePanel.java

示例15: createChart

import org.jfree.chart.ChartFactory; //導入方法依賴的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


注:本文中的org.jfree.chart.ChartFactory.createXYLineChart方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。