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


Java XYItemRenderer.setSeriesStroke方法代码示例

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


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

示例1: 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

示例2: applyLineWidthsSettings

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
/**
 * Applies the line width settings from the ontology model
 */
public void applyLineWidthsSettings(){
	List lineWidths = dataModel.getOntologyModel().getChartSettings().getYAxisLineWidth();
	XYItemRenderer renderer = this.chartPanel.getChart().getXYPlot().getRenderer();
	
	for(int i = 0; i < lineWidths.size(); i++){
		Stroke newStroke = new BasicStroke((Float) lineWidths.get(i));
		renderer.setSeriesStroke(i, newStroke);
	}
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:14,代码来源:ChartTab.java

示例3: setSeriesLineWidth

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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: GenerateMassCalibrationRTMap

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
public void GenerateMassCalibrationRTMap() throws IOException {
    String pngfile = FilenameUtils.getFullPath(ScanCollectionName) + "/" + FilenameUtils.getBaseName(ScanCollectionName) + "_masscaliRT.png";
    XYSeries series = new XYSeries("PSM");
    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
    LoessInterpolator loessInterpolator = new LoessInterpolator(
            0.75,//bandwidth,
            2//robustnessIters
    );

    for (PSM psm : this.IDsummary.PSMList.values()) {
        float ppm = InstrumentParameter.CalcSignedPPM(psm.ObserPrecursorMass, psm.NeutralPepMass);
        series.add(new XYDataItem(psm.RetentionTime, ppm));
    }
    double x[] = new double[IDsummary.PSMList.size()];
    double y[] = new double[x.length];
    double currentmin = 0f;
    for (int i = 0; i < series.getItemCount(); i++) {
        x[i] = (double) series.getX(i);
        if (x[i] <= currentmin) {
            x[i] = currentmin + 0.0001f;
        }
        currentmin = x[i];
        y[i] = (double) series.getY(i);
    }

    Masscalibrationfunction = loessInterpolator.interpolate(x, y);
    XYSeries smoothline = new XYSeries("Loess Regression");

    double xvalue = series.getMinX();

    while (xvalue < series.getMaxX()) {
        smoothline.add(xvalue, Masscalibrationfunction.value(xvalue));
        xvalue += 0.05d;
    }
    xySeriesCollection.addSeries(smoothline);
    xySeriesCollection.addSeries(series);

    JFreeChart chart = ChartFactory.createScatterPlot("Mass calibration", "RT", "Mass error (ppm)", 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(1.0f));
    xyPlot.setBackgroundPaint(Color.white);
    ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}
 
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:52,代码来源:LCMSPeakMS1.java

示例9: handleXYPlotSettings

import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
protected void handleXYPlotSettings(XYPlot p, JRChartPlot jrPlot)
	{
		PlotSettings plotSettings = getPlotSettings();
		XYItemRenderer xyItemRenderer = p.getRenderer();
		Paint[] paintSequence = getPaintSequence(plotSettings, jrPlot);	
		if (paintSequence != null)
		{
			for (int i = 0; i < paintSequence.length; i++)
			{
				xyItemRenderer.setSeriesPaint(i, paintSequence[i]);
			}
		}
		Paint[] outlinePaintSequence = getOutlinePaintSequence(plotSettings);	
		if (outlinePaintSequence != null)
		{
			for (int i = 0; i < outlinePaintSequence.length; i++)
			{
				xyItemRenderer.setSeriesOutlinePaint(i, outlinePaintSequence[i]);
			}
		}
		Stroke[] strokeSequence = getStrokeSequence(plotSettings);
		if (strokeSequence != null)
		{
			for (int i = 0; i < strokeSequence.length; i++)
			{
				xyItemRenderer.setSeriesStroke(i, strokeSequence[i]);
			}
		}
		Stroke[] outlineStrokeSequence = getOutlineStrokeSequence(plotSettings);
		if (outlineStrokeSequence != null)
		{
			for (int i = 0; i < outlineStrokeSequence.length; i++)
			{
				xyItemRenderer.setSeriesOutlineStroke(i, outlineStrokeSequence[i]);
			}
		}
		
		Boolean domainGridlineVisible = plotSettings.getDomainGridlineVisible();
		if (domainGridlineVisible == null || domainGridlineVisible.booleanValue())
		{
			PaintProvider domainGridlinePaint = plotSettings.getDomainGridlinePaint();
			if (domainGridlinePaint != null)
			{
				p.setDomainGridlinePaint(domainGridlinePaint.getPaint());
			}
			Stroke domainGridlineStroke = plotSettings.getDomainGridlineStroke();
			if (domainGridlineStroke != null)
			{
				p.setDomainGridlineStroke(domainGridlineStroke);
			}
			
		}
		Boolean rangeGridlineVisible = plotSettings.getRangeGridlineVisible();
		if (rangeGridlineVisible == null || rangeGridlineVisible.booleanValue())
		{
			PaintProvider rangeGridlinePaint = plotSettings.getRangeGridlinePaint();
			if (rangeGridlinePaint != null)
			{
				p.setRangeGridlinePaint(rangeGridlinePaint.getPaint());
			}
			Stroke rangeGridlineStroke = plotSettings.getRangeGridlineStroke();
			if (rangeGridlineStroke != null)
			{
				p.setRangeGridlineStroke(rangeGridlineStroke);
			}
		}
		
//		p.setRangeZeroBaselineVisible(true);
		
	}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:71,代码来源:SimpleChartTheme.java


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