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


Java XYDifferenceRenderer类代码示例

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


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

示例1: customize

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
@Override
public void customize(JFreeChart chart, ReportParameters reportParameters) {
	XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) chart.getXYPlot().getRenderer();
   XYDifferenceRenderer renderer = new XYDifferenceRenderer();

   renderer.setBaseItemLabelsVisible(lineRenderer.getBaseItemLabelsVisible());
   renderer.setBaseItemLabelFont(lineRenderer.getBaseItemLabelFont());
   renderer.setBaseItemLabelPaint(lineRenderer.getBaseItemLabelPaint());
   renderer.setBaseItemLabelGenerator(lineRenderer.getBaseItemLabelGenerator());

   if (positiveColor != null) {
   	renderer.setPositivePaint(positiveColor);
   }
   if (negativeColor != null) {
   	renderer.setNegativePaint(negativeColor);
   }
   if (showShapes != null) {
   	renderer.setShapesVisible(showShapes);
   }
   chart.getXYPlot().setRenderer(renderer);
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:22,代码来源:DifferenceRendererCustomizer.java

示例2: testHashcode

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

示例3: testHashcode

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

示例4: plotar

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
@Override
public void plotar(final XYPlot plot, final JanelaGraficos janela, final int contador) {
    float[] color = getCor().getComponents(null);
    XYDifferenceRenderer r = new XYDifferenceRenderer(new Color(color[0],color[1],color[2],.1f), Color.red, false);
    r.setStroke(new BasicStroke(.75f));
    r.setPaint(getCor());
    plot.setRenderer(contador, r);
    plot.setDataset(contador, getDataSet(janela));
}
 
开发者ID:wrbraga,项目名称:JGrafix,代码行数:10,代码来源:IndiceBollinger.java

示例5: createTeamGoldDifferenceGraph

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
public static JFreeChart createTeamGoldDifferenceGraph( AppState appState ) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart( GameStatisticsComponent.TEAM_XP, Statics.EXPERIENCE, "Time",
                    createTeamGoldDiffDataSet( appState ), true, // legend
                    true, // tool tips
                    false // URLs
                    );

    final XYDifferenceRenderer renderer = new XYDifferenceRenderer( Color.GREEN, Color.RED, false );

    renderer.setSeriesPaint( 0, Color.GREEN );
    renderer.setSeriesPaint( 1, Color.RED );
    final XYPlot plot = chart.getXYPlot();
    plot.setRenderer( renderer );

    final DateAxis domainAxis = new DateAxis( Statics.TIME );
    domainAxis.setTickMarkPosition( DateTickMarkPosition.MIDDLE );
    domainAxis.setLowerMargin( 0.0 );
    domainAxis.setUpperMargin( 0.0 );
    plot.setDomainAxis( domainAxis );
    plot.setForegroundAlpha( 0.5f );

    final NumberAxis rangeAxis = new NumberAxis( Statics.GOLD );
    rangeAxis.setLowerMargin( 0.15 );
    rangeAxis.setUpperMargin( 0.15 );
    plot.setRangeAxis( rangeAxis );
    return chart;
}
 
开发者ID:petosorus,项目名称:dotalys-cli,代码行数:28,代码来源:ChartCreator.java

示例6: createTeamXpDifferenceGraph

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
public static JFreeChart createTeamXpDifferenceGraph( AppState state ) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart( GameStatisticsComponent.TEAM_XP, Statics.EXPERIENCE, "Time",
                    createTeamXPDiffDataSet( state ), true, // legend
                    true, // tool tips
                    false // URLs
                    );

    final XYDifferenceRenderer renderer = new XYDifferenceRenderer( Color.GREEN, Color.RED, false );

    renderer.setSeriesPaint( 0, Color.GREEN );
    renderer.setSeriesPaint( 1, Color.RED );
    final XYPlot plot = chart.getXYPlot();
    plot.setRenderer( renderer );

    final DateAxis domainAxis = new DateAxis( Statics.TIME );
    domainAxis.setTickMarkPosition( DateTickMarkPosition.MIDDLE );
    domainAxis.setLowerMargin( 0.0 );
    domainAxis.setUpperMargin( 0.0 );
    plot.setDomainAxis( domainAxis );
    plot.setForegroundAlpha( 0.5f );

    final NumberAxis rangeAxis = new NumberAxis( Statics.EXPERIENCE );
    rangeAxis.setLowerMargin( 0.15 );
    rangeAxis.setUpperMargin( 0.15 );
    plot.setRangeAxis( rangeAxis );
    return chart;

}
 
开发者ID:petosorus,项目名称:dotalys-cli,代码行数:29,代码来源:ChartCreator.java

示例7: createChart

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
/**
   * Creates a chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(XYDataset dataset) {
      JFreeChart chart = ChartFactory.createTimeSeriesChart(
          chartTitle,
          domainLabel, rangeLabel,
          dataset,
          !legendPanelOn,  // legend
          true,  // tool tips
          false  // URLs
      );
      chart.setBackgroundPaint(Color.white);
     
      XYPlot plot = chart.getXYPlot();
      plot.setRenderer(new XYDifferenceRenderer(
          Color.green, Color.red, false)
      );
      plot.setBackgroundPaint(Color.lightGray);
      plot.setDomainGridlinePaint(Color.white);
      plot.setRangeGridlinePaint(Color.white);
      plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
      
XYItemRenderer renderer = plot.getRenderer();
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

      ValueAxis domainAxis = new DateAxis("Time");
      domainAxis.setLowerMargin(0.0);
      domainAxis.setUpperMargin(0.0);
      plot.setDomainAxis(domainAxis);
      plot.setForegroundAlpha(0.5f);  

//setXSummary(dataset) X is time;          
      return chart; 

  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:41,代码来源:DifferenceChartDemo1.java

示例8: createXYDifferenceChart

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
private JFreeChart createXYDifferenceChart(String title, String xLabel, String yLabel, XYDataset dataset) {
 JFreeChart chart = ChartFactory.createTimeSeriesChart(
           title,
           xLabel, yLabel,
           dataset,
           true,  // legend
           true,  // tool tips
           false  // URLs
       );
       chart.setBackgroundPaint(Color.white);

       XYPlot plot = chart.getXYPlot();
       plot.setRenderer(new XYDifferenceRenderer(
           Color.green, Color.red, false)
       );
       plot.setBackgroundPaint(Color.lightGray);
       plot.setDomainGridlinePaint(Color.white);
       plot.setRangeGridlinePaint(Color.white);
       plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

	XYItemRenderer renderer = plot.getRenderer();
	//renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
	setDateAxis(plot);

    /*   ValueAxis domainAxis = new DateAxis("Time");
       domainAxis.setLowerMargin(0.0);
       domainAxis.setUpperMargin(0.0);
       plot.setDomainAxis(domainAxis);
       plot.setForegroundAlpha(0.5f);  */

	//setXSummary(dataset) X is time;
       return chart;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:34,代码来源:ChartGenerator_JTable.java

示例9: testHashcode

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

示例10: testGetLegendItemSeriesIndex

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
public void testGetLegendItemSeriesIndex() {
    XYSeriesCollection d1 = new XYSeriesCollection();
    XYSeries s1 = new XYSeries("S1");
    s1.add(1.0, 1.1);
    XYSeries s2 = new XYSeries("S2");
    s2.add(1.0, 1.1);
    d1.addSeries(s1);
    d1.addSeries(s2);

    XYSeriesCollection d2 = new XYSeriesCollection();
    XYSeries s3 = new XYSeries("S3");
    s3.add(1.0, 1.1);
    XYSeries s4 = new XYSeries("S4");
    s4.add(1.0, 1.1);
    XYSeries s5 = new XYSeries("S5");
    s5.add(1.0, 1.1);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    XYDifferenceRenderer r = new XYDifferenceRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:XYDifferenceRendererTests.java

示例11: test

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
@Override
public void test() {
	super.test();

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	XYItemRenderer renderer = chart.getXYPlot().getRenderer();
	Assert.assertEquals("renderer", XYDifferenceRenderer.class, renderer.getClass());
	Assert.assertFalse("show shapes", ((XYDifferenceRenderer) renderer).getShapesVisible());
	Assert.assertEquals("positive paint", Color.BLUE, ((XYDifferenceRenderer) renderer).getPositivePaint());
	Assert.assertEquals("negative paint", Color.MAGENTA, ((XYDifferenceRenderer) renderer).getNegativePaint());

	chart = getChart("summary.chart2", 0);
	Axis axis = chart.getXYPlot().getDomainAxis();
	Assert.assertEquals("category label", "time", axis.getLabel());
	Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
	Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
	Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
	Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
	Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
	Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());

	chart = getChart("summary.chart3", 0);
	axis = chart.getXYPlot().getRangeAxis();
	Assert.assertEquals("value label", "value", axis.getLabel());
	Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
	Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
	Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
	Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
	Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
	//Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
	Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
	Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
	Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:37,代码来源:DifferenceChartTest.java

示例12: testEquals

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
/**
 * Problem that the equals(...) method distinguishes all fields.
 */
public void testEquals() {
    XYDifferenceRenderer r1 = new XYDifferenceRenderer(Color.red, Color.blue, false);
    XYDifferenceRenderer r2 = new XYDifferenceRenderer(Color.red, Color.blue, false);
    assertEquals(r1, r2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:XYDifferenceRendererTests.java

示例13: createSubplot

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的package包/类
public XYPlot createSubplot(int numOfPlot) {
	ArrayList<XYSeries> serie = new ArrayList<>(4);
	serie.add(new XYSeries("Worst of generation"));
	serie.add(new XYSeries("Best of generation"));
	serie.add(new XYSeries("Generation average"));
	serie.add(new XYSeries("Absolute best"));
	this.series.add(serie);
	
	XYSeriesCollection dataset1 = new XYSeriesCollection();
	XYSeriesCollection dataset2 = new XYSeriesCollection();
	ArrayList<XYSeriesCollection> datasetCol = new ArrayList<>(2);
	datasetCol.add(dataset1);
	datasetCol.add(dataset2);
	this.datasets.add(datasetCol);
	
	XYPlot plot = new XYPlot();
	plot.setDataset(0, dataset2);
	XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(true, false);
	lineRenderer.setSeriesPaint(0, blue1);
	lineRenderer.setSeriesStroke(0, stroke1);
	lineRenderer.setSeriesPaint(1, blue2);
	lineRenderer.setSeriesStroke(1, stroke2);
	if(numOfPlot == 0) {
		lineRenderer.setSeriesVisibleInLegend(0, true);
		lineRenderer.setSeriesVisibleInLegend(1, true);
	}
	else {
		lineRenderer.setSeriesVisibleInLegend(0, false);
		lineRenderer.setSeriesVisibleInLegend(1, false);
	}
	plot.setRenderer(0, lineRenderer);
	
	plot.setDataset(1, dataset1);
	XYDifferenceRenderer diffRenderer = new XYDifferenceRenderer(
			blue, blue, false
		);
	diffRenderer.setSeriesPaint(0, transparent);
	diffRenderer.setSeriesPaint(1, transparent);
	diffRenderer.setSeriesVisibleInLegend(0, false);
	diffRenderer.setSeriesVisibleInLegend(1, false);
	plot.setRenderer(1, diffRenderer);
	plot.setOutlinePaint(null);
	plot.setBackgroundPaint(Color.white);
	plot.setForegroundAlpha(1);
	plot.setDomainGridlinePaint(lighterGray);
	plot.setRangeGridlinePaint(lighterGray);
	
	NumberAxis domainAxis = new NumberAxis("");
	plot.setDomainAxis(domainAxis);
	domainAxis.setTickMarkPaint(Color.black);
	domainAxis.setLowerMargin(0.0);
	domainAxis.setUpperMargin(0.0);
	domainAxis.setAutoRangeIncludesZero(false);
	
	NumberAxis rangeAxis = new NumberAxis(this.gCtrl.getFitnessName(numOfPlot));
	plot.setRangeAxis(rangeAxis);
	rangeAxis.setTickMarkPaint(Color.black);
	rangeAxis.setLowerMargin(0.01);
	rangeAxis.setUpperMargin(0.01);
	rangeAxis.setAutoRangeIncludesZero(false);
	
	return plot;
}
 
开发者ID:hecoding,项目名称:Pac-Man,代码行数:64,代码来源:CenterPanel.java

示例14: createChart

import org.jfree.chart.renderer.xy.XYDifferenceRenderer; //导入依赖的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);
    //plot.setForegroundAlpha(0.5f);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }

    // code to test the alpha channel
    IntervalMarker interv = new IntervalMarker(120, 150,
            Color.blue, new BasicStroke(5.0f),null,null,0.2f);
    plot.addRangeMarker(interv);

    // code to test the alpha channel within awt colors
    XYDifferenceRenderer differenceRenderer= new XYDifferenceRenderer(
            new Color(255, 0, 0, 128),new Color(0, 255, 0, 128), false);
    plot.setRenderer(differenceRenderer);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));

    return chart;

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:54,代码来源:SWTTimeSeriesDemo.java

示例15: testPublicCloneable

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


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