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


Java XYItemRenderer.setSeriesPaint方法代码示例

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


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

示例1: createPlot

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
private XYPlot createPlot( XYSeriesCollection dataset ) {
    XYPlot plot = new XYPlot();

    ValueAxis domainAxis = new NumberAxis( "Time" );
    domainAxis.setTickLabelsVisible( false );
    domainAxis.setRange( 0, RANGE );
    plot.setDomainAxis( domainAxis );

    ValueAxis rangeAxis = new NumberAxis( "Population" );
    rangeAxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
    plot.setRangeAxis( rangeAxis );
    rangeAxis.setRange( 0, 50 );

    plot.setRenderer( new StandardXYItemRenderer() );

    final int seriesIndex = 0;
    plot.setDataset( seriesIndex, dataset );
    XYItemRenderer renderer = new StandardXYItemRenderer(); // TODO: maybe use XYLineAndShapeRenderer?
    renderer.setStroke( new BasicStroke( 2f ) );
    renderer.setSeriesPaint( TOTAL_INDEX, Color.BLACK );
    renderer.setSeriesPaint( FUR_WHITE_INDEX, Color.RED );
    plot.setRenderer( seriesIndex, renderer );

    return plot;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:TestCanvas.java

示例2: applyColorSettings

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * Applies the color settings from the ontology model
 */
public void applyColorSettings(){
	List colors = dataModel.getOntologyModel().getChartSettings().getYAxisColors();
	XYItemRenderer renderer = this.chartPanel.getChart().getXYPlot().getRenderer();
	for(int i=0; i < colors.size(); i++){
		String colorString = (String) colors.get(i);
		if (colorString!=null && colorString.equals("")==false) {
			Color newColor = new Color(Integer.parseInt((String) colors.get(i)));
			renderer.setSeriesPaint(i, newColor);	
		}
	}	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:15,代码来源:ChartTab.java

示例3: GenerateRTMapPNG

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的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

示例4: setSeriesColor

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
public void setSeriesColor(int seriesIndex, Color color) throws NoSuchSeriesException{
	if(seriesIndex < dataModel.getSeriesCount()){
		XYItemRenderer renderer = this.chartPanel.getChart().getXYPlot().getRenderer();
		renderer.setSeriesPaint(seriesIndex, color);
	}else{
		throw new NoSuchSeriesException();
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:9,代码来源:ChartTab.java

示例5: updateChart

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
public void updateChart(double[] data) {

		this.removeAll();
		this.revalidate();

		series = new XYSeries("XYGraph");
		for(int i=0; i<data.length;i++){
			if(data[i]>-1){
				series.add(5*i , data[i]/255 );
			}
		}

		dataset = new XYSeriesCollection();
		dataset.addSeries(series);


		chart = ChartFactory.createScatterPlot(
				null, // Title
				"ω [rad/s]", // x-axis Label
				"Q / Qmax", // y-axis Label
				dataset, // Dataset
				PlotOrientation.VERTICAL, 
				false, // Show Legend
				true, // Use tooltips
				false // Configure chart to generate URLs?
				);
		XYPlot plot = (XYPlot) chart.getPlot();
		plot.setBackgroundPaint( Color.WHITE );

		XYItemRenderer renderer = plot.getRenderer();
		renderer.setSeriesPaint(0, Color.RED);
		double delta = 2.0;
		Shape shape1 = new Rectangle2D.Double(-delta, -delta, delta, delta);
		renderer.setSeriesShape(0, shape1);

		ValueAxis yAxis = plot.getRangeAxis();
		yAxis.setRange(0, 1.1);
		ValueAxis xAxis = plot.getDomainAxis();
		xAxis.setRange(0, 2000);

		ChartPanel cp = new ChartPanel(chart);
		cp.setBackground(Color.WHITE);

		this.setLayout(new BorderLayout());
		this.add(cp, BorderLayout.CENTER);
		this.repaint();

	}
 
开发者ID:Tosbert,项目名称:FizeauExperimentSimulation,代码行数:49,代码来源:GraphPanel.java

示例6: testSetRenderer

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * A test for a bug where setting the renderer doesn't register the plot
 * as a RendererChangeListener.
 */
public void testSetRenderer() {
    XYPlot plot = new XYPlot();
    XYItemRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);
    // now make a change to the renderer and see if it triggers a plot
    // change event...
    MyPlotChangeListener listener = new MyPlotChangeListener();
    plot.addChangeListener(listener);
    renderer.setSeriesPaint(0, Color.black);
    assertTrue(listener.getEvent() != null);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:XYPlotTests.java

示例7: GenerateRTMapPNG

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的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

示例8: testSetRenderer

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * A test for a bug where setting the renderer doesn't register the plot
 * as a RendererChangeListener.
 */
@Test
public void testSetRenderer() {
    XYPlot plot = new XYPlot();
    XYItemRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);
    // now make a change to the renderer and see if it triggers a plot
    // change event...
    MyPlotChangeListener listener = new MyPlotChangeListener();
    plot.addChangeListener(listener);
    renderer.setSeriesPaint(0, Color.black);
    assertTrue(listener.getEvent() != null);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:17,代码来源:XYPlotTest.java

示例9: testSetRenderer

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * A test for a bug where setting the renderer doesn't register the plot
 * as a RendererChangeListener.
 */
@Test
public void testSetRenderer() {
    XYPlot plot = new XYPlot();
    XYItemRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);
    // now make a change to the renderer and see if it triggers a plot
    // change event...
    MyPlotChangeListener listener = new MyPlotChangeListener();
    plot.addChangeListener(listener);
    renderer.setSeriesPaint(0, Color.BLACK);
    assertTrue(listener.getEvent() != null);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:17,代码来源:XYPlotTest.java

示例10: setChartProperties

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * Creates a chart the style we like.
 * 
 * @param chart
 */
public static void setChartProperties(JFreeChart chart,
        List<SimpleEntry<Color, Stroke>> lineStyles) {
    // set the background and title font
    chart.setBackgroundPaint(Color.white);
    chart.getTitle().setFont(new Font("Tahoma", Font.BOLD, 14));
    // set the background and the grid all white
    XYPlot plot = chart.getXYPlot();
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setBackgroundPaint(Color.white);
    // now
    plot.setOutlineStroke(null);

    XYItemRenderer rend = plot.getRenderer();
    Stroke stroke = new BasicStroke(2.0f);
    rend.setBaseStroke(stroke);
    // rend.setDrawSeriesLineAsPath(true);

    // stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND,
    // BasicStroke.JOIN_ROUND, 10, new float[] {10, 10}, 0);
    // strokes.add(stroke);
    // stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND,
    // BasicStroke.JOIN_ROUND, 10, new float[] {2, 4}, 0);
    // strokes.add(stroke);
    int seriesCount = plot.getSeriesCount();
    for (int i = 0; i != seriesCount; i++) {
        SimpleEntry<Color, Stroke> lineStyle =
                lineStyles.get(i % lineStyles.size());
        rend.setSeriesStroke(i, lineStyle.getValue());
        rend.setSeriesPaint(i, lineStyle.getKey());
    }
}
 
开发者ID:Xapagy,项目名称:Xapagy,代码行数:38,代码来源:GraphEvolution.java

示例11: setAxisAndDataSet

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
private static XYItemRenderer setAxisAndDataSet(int i,XYPlot plot, ValueAxis axis,XYDataset dataset,Paint p,XYItemRenderer renderer){
    plot.setRangeAxis(i, axis);
    plot.setDataset(i, dataset);
    plot.mapDatasetToRangeAxis(i, i);


    renderer.setSeriesPaint(0,p);
    axis.setLabelPaint(p);
    axis.setTickLabelPaint(p);
    return renderer;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:12,代码来源:MeasurementGraphAction2.java

示例12: ProbabilityDensityPlot

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
public ProbabilityDensityPlot( XYSeries probabilityDensitySeries ) {
    super();
    
    // Labels (localized)
    String probabilityDensityLabel = QTResources.getString( "axis.probabilityDensity" );
    
    // Dataset
    XYSeriesCollection data = new XYSeriesCollection();
    data.addSeries( probabilityDensitySeries );
    
    // Renderer
    XYItemRenderer renderer = new FastPathRenderer();
    renderer.setSeriesPaint( 0, QTConstants.COLOR_SCHEME.getProbabilityDensityColor() );
    renderer.setSeriesStroke( 0, QTConstants.PROBABILITY_DENSITY_STROKE );
    
    // X axis 
    PositionAxis xAxis = new PositionAxis();
    
    // Y axis
    NumberAxis yAxis = new NumberAxis( probabilityDensityLabel );
    yAxis.setLabelFont( QTConstants.AXIS_LABEL_FONT );
    yAxis.setRange( QTConstants.DEFAULT_PROBABILITY_DENSITY_RANGE );
    yAxis.setTickLabelPaint( QTConstants.COLOR_SCHEME.getTickColor() );
    yAxis.setTickMarkPaint( QTConstants.COLOR_SCHEME.getTickColor() );
    
    setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );
    setBackgroundPaint( QTConstants.COLOR_SCHEME.getChartColor() );
    setDomainGridlinesVisible( QTConstants.SHOW_VERTICAL_GRIDLINES );
    setRangeGridlinesVisible( QTConstants.SHOW_HORIZONTAL_GRIDLINES );
    setDomainGridlinePaint( QTConstants.COLOR_SCHEME.getGridlineColor() );
    setRangeGridlinePaint( QTConstants.COLOR_SCHEME.getGridlineColor() );
    setDataset( data );
    setRenderer( renderer );
    setDomainAxis( xAxis );
    setRangeAxis( yAxis );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:37,代码来源:ProbabilityDensityPlot.java

示例13: copyNumberCDF

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
@NotNull
static JFreeChart copyNumberCDF(@NotNull final List<PurpleCopyNumber> copyNumbers) {
    final XYDataset dataset = CopyNumberCharts.createDataset(copyNumbers);
    JFreeChart chart =
            ChartFactory.createScatterPlot("Copy Number CDF", "BAF Weighting (CDF)", "Ploidy", dataset, PlotOrientation.VERTICAL, false,
                    false, false);
    XYPlot xyPlot = (XYPlot) chart.getPlot();
    XYItemRenderer renderer = ((XYPlot) chart.getPlot()).getRenderer();
    Shape shape = new Ellipse2D.Double(0, 0, 4, 4);
    renderer.setSeriesShape(0, shape);
    renderer.setSeriesPaint(0, Color.blue);
    xyPlot.getRangeAxis().setRange(0, 10);
    return chart;
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:15,代码来源:CopyNumberCharts.java

示例14: configureAxisSeriesColors

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * The series colors set in the main plot of a multiple axis chart are used for
 * all the rendered charts in the plot.  This is a problem with multiple line
 * charts, using different scales and thus different axis.  All the lines will
 * be drawn using the first series color (since they are the first series for that
 * rendered) and it will be impossible to tell them apart.
 * <br>
 * For this reason we interpret series colors for charts included in a multiple
 * axis chart as specify absolute series colors for that renderer.
 *
 * @param renderer the renderer of the chart being created
 * @param jrPlot the Jasper view of that plot
 */
private void configureAxisSeriesColors(XYItemRenderer renderer, JRChartPlot jrPlot)
{
	SortedSet<JRSeriesColor> seriesColors = jrPlot.getSeriesColors();

	if (seriesColors != null)
	{
		Iterator<JRSeriesColor> iter = seriesColors.iterator();
		while (iter.hasNext())
		{
			JRSeriesColor seriesColor = iter.next();
			renderer.setSeriesPaint(seriesColor.getSeriesOrder(), seriesColor.getColor());
		}
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:28,代码来源:JRFillChart.java

示例15: createCombinedChart

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * Creates an overlaid chart.
 *
 * @return The chart.
 */
private static JFreeChart createCombinedChart() {

    // create plot ...
    IntervalXYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
    renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    renderer1.setSeriesStroke(0, new BasicStroke(4.0f,
            BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer1.setSeriesPaint(0, Color.blue);

    DateAxis domainAxis = new DateAxis("Year");
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.02);
    ValueAxis rangeAxis = new NumberAxis("$billion");
    XYPlot plot1 = new XYPlot(data1, null, rangeAxis, renderer1);
    plot1.setBackgroundPaint(Color.lightGray);
    plot1.setDomainGridlinePaint(Color.white);
    plot1.setRangeGridlinePaint(Color.white);

    // add a second dataset and renderer...
    IntervalXYDataset data2 = createDataset2();
    XYBarRenderer renderer2 = new XYBarRenderer() {
        public Paint getItemPaint(int series, int item) {
            XYDataset dataset = getPlot().getDataset();
            if (dataset.getYValue(series, item) >= 0.0) {
                return Color.red;
            }
            else {
                return Color.green;
            }
        }
    };
    renderer2.setSeriesPaint(0, Color.red);
    renderer2.setDrawBarOutline(false);
    renderer2.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));

    XYPlot plot2 = new XYPlot(data2, null, new NumberAxis("$billion"),
            renderer2);
    plot2.setBackgroundPaint(Color.lightGray);
    plot2.setDomainGridlinePaint(Color.white);
    plot2.setRangeGridlinePaint(Color.white);

    CombinedXYPlot cplot = new CombinedXYPlot(domainAxis, rangeAxis);
    cplot.add(plot1, 3);
    cplot.add(plot2, 2);
    cplot.setGap(8.0);
    cplot.setDomainGridlinePaint(Color.white);
    cplot.setDomainGridlinesVisible(true);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart("CombinedXYPlotDemo1",
            JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
    chart.setBackgroundPaint(Color.white);
    LegendTitle legend = new LegendTitle(cplot);
    chart.addSubtitle(legend);
    return chart;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:67,代码来源:CombinedXYPlotDemo1.java


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