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


Java XYSplineRenderer类代码示例

本文整理汇总了Java中org.jfree.chart.renderer.xy.XYSplineRenderer的典型用法代码示例。如果您正苦于以下问题:Java XYSplineRenderer类的具体用法?Java XYSplineRenderer怎么用?Java XYSplineRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XYSplineRenderer类属于org.jfree.chart.renderer.xy包,在下文中一共展示了XYSplineRenderer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawChart

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
public void drawChart(String filename, int width, int height) throws IOException {
  // Create plot
  NumberAxis xAxis = new NumberAxis(xAxisLabel);
  NumberAxis yAxis = new NumberAxis(yAxisLabel);
  XYSplineRenderer renderer = new XYSplineRenderer();
  XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
  plot.setBackgroundPaint(Color.lightGray);
  plot.setDomainGridlinePaint(Color.white);
  plot.setRangeGridlinePaint(Color.white);
  plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));

  // Create chart
  JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
  ChartUtilities.applyCurrentTheme(chart);
  ChartPanel chartPanel = new ChartPanel(chart, false);

  // Draw png
  BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
  Graphics graphics = bi.getGraphics();
  chartPanel.setBounds(0, 0, width, height);
  chartPanel.paint(graphics);
  ImageIO.write(bi, "png", new File(filename));
}
 
开发者ID:Kurento,项目名称:kurento-java,代码行数:24,代码来源:ChartWriter.java

示例2: createLineChart

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
private JFreeChart createLineChart(String title, XYSeriesCollection data) {
	// plot
	final NumberAxis xAxis = new NumberAxis("X");
	xAxis.setAutoRangeIncludesZero(false);
	final NumberAxis yAxis = new NumberAxis("Y");
	yAxis.setAutoRangeIncludesZero(false);

	final XYSplineRenderer renderer = new XYSplineRenderer();
	final XYPlot plot = new XYPlot(data, xAxis, yAxis, renderer);
	{
		plot.setBackgroundPaint(Color.lightGray);
		plot.setDomainGridlinePaint(Color.white);
		plot.setRangeGridlinePaint(Color.white);
		plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
	}

	// chart
	return new JFreeChart(title, plot);
}
 
开发者ID:testobject,项目名称:visual-scripting,代码行数:20,代码来源:JFreeChartPlotter.java

示例3: run

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
@Override
public void run(final String arg0) {
	// http://www.math.hu-berlin.de/~ccafm/lehre_BZQ_Numerik/allg/JAVA_Pakete/JFreeChart/JFreeChart-Tutorial.html
	final String title = "Contrast Transfer Function";
	final XYSplineRenderer spline = new XYSplineRenderer();
	spline.setSeriesPaint(0, Color.RED);
	spline.setSeriesPaint(1, Color.BLUE);
	spline.setSeriesShapesVisible(0, false);
	spline.setSeriesShapesVisible(1, false);
	final NumberAxis xax = new NumberAxis("q in 1/nm");
	final NumberAxis yax = new NumberAxis("CTF");
	final XYPlot plot = new XYPlot(createDataset(), xax, yax, spline);
	final JFreeChart chart = new JFreeChart(plot);
	final ChartPanel chartPanel = new ChartPanel(chart);
	final ApplicationFrame chartFrame = new ApplicationFrame(title);
	chartFrame.setContentPane(chartPanel);
	chartFrame.pack();
	RefineryUtilities.centerFrameOnScreen(chartFrame);
	chartFrame.setVisible(true);
}
 
开发者ID:EFTEMj,项目名称:EFTEMj,代码行数:21,代码来源:CTF.java

示例4: customize

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
@Override
public void customize(JFreeChart jfc, JRChart jrc) 
{
	Plot plot = jfc.getPlot();
	if (plot instanceof XYPlot)
	{
		((XYPlot)plot).setRenderer( new XYSplineRenderer());
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:10,代码来源:SplineCustomizer.java

示例5: createChartImage

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
public BufferedImage createChartImage(MediaMatrix mat, Color bgColor, int width, int height) {
    final XYSplineRenderer renderer = new XYSplineRenderer();
    final NumberAxis xAxis = new NumberAxis("Time");
    final NumberAxis yAxis = new NumberAxis("Score");
    final XYPlot plot = new XYPlot(new MediaMatrixXYDataSetAdapter(mat), xAxis, yAxis, renderer);
    plot.setBackgroundPaint(bgColor);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
    final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    chart.setBackgroundPaint(Color.white);
    final LegendTitle legendTitle = chart.getLegend();
    legendTitle.setItemFont(new Font("SanSerif", Font.PLAIN, 14));
    return chart.createBufferedImage(width, height);
}
 
开发者ID:shuichi,项目名称:MediaMatrix,代码行数:16,代码来源:VisualizationEngine.java

示例6: testEquals

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {

    XYSplineRenderer r1 = new XYSplineRenderer();
    XYSplineRenderer r2 = new XYSplineRenderer();
    assertEquals(r1, r2);
    assertEquals(r2, r1);

    r1.setPrecision(9);
    assertFalse(r1.equals(r2));
    r2.setPrecision(9);
    assertTrue(r1.equals(r2));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:XYSplineRendererTests.java

示例7: testHashcode

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    XYSplineRenderer r1 = new XYSplineRenderer();
    XYSplineRenderer r2 = new XYSplineRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:XYSplineRendererTests.java

示例8: LineChart

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
public LineChart(List<Fetch> fetches) {
    final XYDataset dataset = updateDataset(fetches);

    final JFreeChart chart = ChartFactory.createXYLineChart(
    	fetches.get(0).getBrand(),         // chart title
        "Time",               // domain axis label
        "Number",                  // range axis label
        dataset,                  // data
        PlotOrientation.VERTICAL, // orientation
        true,                     // include legend
        true,                     // tooltips?
        false                     // URLs?
    );
    
    XYPlot plot = (XYPlot) chart.getPlot();
    DateAxis range = new DateAxis("Date");
    range.setDateFormatOverride(new SimpleDateFormat("dd/MM/yyyy"));
    plot.setDomainAxis(range);
    
    chart.getXYPlot().setRenderer(new XYSplineRenderer());
    
    chart.setBackgroundPaint(Color.WHITE);
    lineChartPanel = new ChartPanel(chart);
    lineChartPanel.setPreferredSize(new Dimension(930, 700));
}
 
开发者ID:thibaultcha,项目名称:TweetStats,代码行数:26,代码来源:LineChart.java

示例9: testPublicCloneable

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
/**
 * Verify that this class implements {@link PublicCloneable}.
 */
public void testPublicCloneable() {
    XYSplineRenderer r1 = new XYSplineRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:XYSplineRendererTests.java

示例10: createGraghPanel

import org.jfree.chart.renderer.xy.XYSplineRenderer; //导入依赖的package包/类
private void createGraghPanel(JPanel dataPanel) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false, true, false);
    chart.setBorderVisible(true);
    mafChartPanel = new MafChartPanel(chart, this);
    
    GridBagConstraints gbl_chartPanel = new GridBagConstraints();
    gbl_chartPanel.anchor = GridBagConstraints.PAGE_START;
    gbl_chartPanel.insets = insets0;
    gbl_chartPanel.fill = GridBagConstraints.BOTH;
    gbl_chartPanel.weightx = 1.0;
    gbl_chartPanel.weighty = 1.0;
    gbl_chartPanel.gridx = 0;
    gbl_chartPanel.gridy = 2;
    dataPanel.add(mafChartPanel.getChartPanel(), gbl_chartPanel);

    XYSplineRenderer lineRenderer = new XYSplineRenderer(3);
    lineRenderer.setUseFillPaint(true);
    lineRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator( 
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, 
            new DecimalFormat("0.00"), new DecimalFormat("0.00")));
    
    Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f);
    lineRenderer.setSeriesStroke(0, stroke);
    lineRenderer.setSeriesStroke(1, stroke);
    lineRenderer.setSeriesPaint(0, new Color(201, 0, 0));
    lineRenderer.setSeriesPaint(1, new Color(0, 0, 255));
    lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5));
    lineRenderer.setSeriesShape(1, ShapeUtilities.createUpTriangle((float) 2.5));
    
    ValueAxis mafvDomain = new NumberAxis(XAxisName);
    ValueAxis mafgsRange = new NumberAxis(YAxisName);
    
    XYSeriesCollection lineDataset = new XYSeriesCollection();

    lineDataset.addSeries(currMafData);
    lineDataset.addSeries(corrMafData);
    
    XYPlot plot = chart.getXYPlot();
    plot.setRangePannable(true);
    plot.setDomainPannable(true);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    plot.setBackgroundPaint(new Color(224, 224, 224));
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    plot.setDataset(0, lineDataset);
    plot.setRenderer(0, lineRenderer);
    plot.setDomainAxis(0, mafvDomain);
    plot.setRangeAxis(0, mafgsRange);
    plot.mapDatasetToDomainAxis(0, 0);
    plot.mapDatasetToRangeAxis(0, 0);

    
    LegendTitle legend = new LegendTitle(plot.getRenderer()); 
    legend.setItemFont(new Font("Arial", 0, 10));
    legend.setPosition(RectangleEdge.TOP);
    chart.addLegend(legend);
}
 
开发者ID:vimsh,项目名称:mafscaling,代码行数:59,代码来源:MafRescale.java


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