當前位置: 首頁>>代碼示例>>Java>>正文


Java XYLineAndShapeRenderer.setBaseStroke方法代碼示例

本文整理匯總了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setBaseStroke方法的典型用法代碼示例。如果您正苦於以下問題:Java XYLineAndShapeRenderer.setBaseStroke方法的具體用法?Java XYLineAndShapeRenderer.setBaseStroke怎麽用?Java XYLineAndShapeRenderer.setBaseStroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.renderer.xy.XYLineAndShapeRenderer的用法示例。


在下文中一共展示了XYLineAndShapeRenderer.setBaseStroke方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createScatterChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
@Override
protected JFreeChart createScatterChart() throws JRException
{
	JFreeChart jfreeChart = super.createScatterChart();
	XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
	xyPlot.setDomainGridlinesVisible(false);
	XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot)jfreeChart.getPlot()).getRenderer();
	plotRenderer.setBaseShapesFilled(false);
	plotRenderer.setBaseStroke(new BasicStroke(1f));
	return jfreeChart;
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:12,代碼來源:AegeanChartTheme.java

示例2: createChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
/**
 * Creates a chart.
 *
 * @param dataset  a dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "International Coffee Organisation : Coffee Prices",    // title
        null,             // x-axis label
        "US cents/lb",      // y-axis label
        dataset);

    String fontName = "Palatino";
    chart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));
    chart.addSubtitle(new TextTitle("Source: http://www.ico.org/historical/2010-19/PDF/HIST-PRICES.pdf", 
            new Font(fontName, Font.PLAIN, 14)));

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    chart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    chart.getLegend().setFrame(BlockBorder.NONE);
    chart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(false);
        renderer.setDrawSeriesLineAsPath(true);
        // set the default stroke for all series
        renderer.setAutoPopulateSeriesStroke(false);
        renderer.setBaseStroke(new BasicStroke(3.0f, BasicStroke.CAP_ROUND, 
                BasicStroke.JOIN_BEVEL), false);
        renderer.setSeriesPaint(0, Color.RED);
        renderer.setSeriesPaint(1, new Color(24, 123, 58));
        renderer.setSeriesPaint(2, new Color(149, 201, 136));
        renderer.setSeriesPaint(3, new Color(1, 62, 29));
        renderer.setSeriesPaint(4, new Color(81, 176, 86));
        renderer.setSeriesPaint(5, new Color(0, 55, 122));
        renderer.setSeriesPaint(6, new Color(0, 92, 165));
    }

    return chart;

}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:55,代碼來源:TimeSeriesChartFXDemo1.java

示例3: createJFreeChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
/**
 * Creates a Growth rate Of Population chart.
 * 
 * @param dataset  a dataset.
 * 
 * @return The chart.
 */
public JFreeChart createJFreeChart(final XYDataset dataset) {
        final JFreeChart chart = ChartFactory.createXYLineChart(
             "Growth rate and growth curve of several populations", 
             "Time t [h]", 
             "Cell Number N", 
             dataset, 
             PlotOrientation.VERTICAL, 
             true, 
             true, 
             false);
    
        chart.setBackgroundPaint(Color.white);
        LegendTitle legend = chart.getLegend();
        legend.setPosition(RectangleEdge.RIGHT);
        legend.setVisible(true);
        
        final XYPlot plot = chart.getXYPlot();
        plot.setBackgroundPaint(Color.white);
        plot.setRangeGridlinePaint(Color.lightGray); 

        XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(){
                Stroke soild = new BasicStroke(2.0f);
                Stroke dashed =  new BasicStroke(1.0f,BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] {5.0f}, 0.0f);
                @Override
                public Stroke getItemStroke(int row, int column) {
                    if ( (row % 2) == 1) {
                            return dashed;
                    } else
                        return super.getItemStroke(row, column);
                }
            };
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setBaseStroke(new BasicStroke(3));
        plot.setRenderer(renderer);
        
        plot.setDomainGridlinesVisible(true);
        plot.setDomainGridlinePaint(Color.lightGray);

        // customise the range axis...
        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setAutoRangeIncludesZero(false);
        rangeAxis.setStandardTickUnits(rangeAxis.getStandardTickUnits());

        return chart;
    }
 
開發者ID:modsim,項目名稱:vizardous,代碼行數:54,代碼來源:ComparisonGrowthRateChart2D.java

示例4: configureRenderer

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
private void configureRenderer(MsSpectrumDataSet dataset, int datasetIndex) {

    final MsSpectrumType renderingType = dataset.getRenderingType();
    final XYPlot plot = chartNode.getChart().getXYPlot();

    // Set renderer
    AbstractXYItemRenderer newRenderer;
    switch (renderingType) {
      case PROFILE:
      case THRESHOLDED:
        XYLineAndShapeRenderer newLineRenderer = new XYLineAndShapeRenderer();
        final int lineThickness = dataset.getLineThickness();
        newLineRenderer.setBaseShape(new Ellipse2D.Double(-2 * lineThickness, -2 * lineThickness,
            4 * lineThickness + 1, 4 * lineThickness + 1));
        newLineRenderer.setBaseShapesFilled(true);
        newLineRenderer.setBaseShapesVisible(dataset.getShowDataPoints());
        newLineRenderer.setDrawOutlines(false);

        Stroke baseStroke = new BasicStroke(lineThickness);
        newLineRenderer.setBaseStroke(baseStroke);
        newRenderer = newLineRenderer;
        break;
      case CENTROIDED:
      default:
        XYBarRenderer newBarRenderer = new XYBarRenderer();
        // Avoid gradients
        newBarRenderer.setBarPainter(new StandardXYBarPainter());
        newBarRenderer.setShadowVisible(false);
        newRenderer = newBarRenderer;
        break;
    }

    // Set tooltips for legend
    newRenderer.setLegendItemToolTipGenerator((ds, series) -> {
      if (ds instanceof MsSpectrumDataSet) {
        return ((MsSpectrumDataSet) ds).getDescription();
      } else
        return null;
    });

    // Set color
    Color baseColor = dataset.getColor();
    newRenderer.setBasePaint(JavaFXUtil.convertColorToAWT(baseColor));

    // Set label generator
    XYItemLabelGenerator intelligentLabelGenerator =
        new IntelligentItemLabelGenerator(chartNode, 100, dataset);
    newRenderer.setBaseItemLabelGenerator(intelligentLabelGenerator);
    newRenderer.setBaseItemLabelPaint(JavaFXUtil.convertColorToAWT(labelsColor));
    newRenderer.setBaseItemLabelsVisible(itemLabelsVisible.get());

    // Set tooltip generator
    newRenderer.setBaseToolTipGenerator(dataset);

    plot.setRenderer(datasetIndex, newRenderer);

  }
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:58,代碼來源:MsSpectrumPlotWindowController.java

示例5: configureRenderer

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
private void configureRenderer(ChromatogramPlotDataSet dataset, int datasetIndex) {

    final XYPlot plot = chartNode.getChart().getXYPlot();

    XYLineAndShapeRenderer newRenderer = new XYLineAndShapeRenderer();
    final int lineThickness = dataset.getLineThickness();
    newRenderer.setBaseShape(new Ellipse2D.Double(-2 * lineThickness, -2 * lineThickness,
        4 * lineThickness + 1, 4 * lineThickness + 1));
    newRenderer.setBaseShapesFilled(true);
    newRenderer.setBaseShapesVisible(dataset.getShowDataPoints());
    newRenderer.setDrawOutlines(false);

    Stroke baseStroke = new BasicStroke(lineThickness);
    newRenderer.setBaseStroke(baseStroke);

    // Set tooltips for legend
    newRenderer.setLegendItemToolTipGenerator((ds, series) -> {
      if (ds instanceof ChromatogramPlotDataSet) {
        return ((ChromatogramPlotDataSet) ds).getDescription();
      } else
        return null;
    });

    // Set color
    Color baseColor = dataset.getColor();
    newRenderer.setBasePaint(JavaFXUtil.convertColorToAWT(baseColor));

    // Set label generator
    XYItemLabelGenerator intelligentLabelGenerator =
        new IntelligentItemLabelGenerator(chartNode, 100, dataset);
    newRenderer.setBaseItemLabelGenerator(intelligentLabelGenerator);
    newRenderer.setBaseItemLabelPaint(JavaFXUtil.convertColorToAWT(labelsColor));
    newRenderer.setBaseItemLabelsVisible(itemLabelsVisible.get());
    newRenderer.setBaseItemLabelsVisible(true);

    // Set tooltip generator
    newRenderer.setBaseToolTipGenerator(dataset);

    plot.setRenderer(datasetIndex, newRenderer);

  }
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:42,代碼來源:ChromatogramPlotWindowController.java


注:本文中的org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setBaseStroke方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。