當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。