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


Java XYLineAndShapeRenderer類代碼示例

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


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

示例1: scatterGridPlot

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
public JFreeChart scatterGridPlot(String xLabel, String yLabel){
    int numDatasets = dataset.size();
    JFreeChart result = ChartFactory.createScatterPlot(chartTitle
            , xLabel
            , yLabel
            , dataset.get(0));
    XYPlot plot = result.getXYPlot();
    plot.getRenderer().setSeriesStroke(0, new BasicStroke(1.0f));
    plot.getRenderer().setSeriesPaint(0, seriesColor.get(0));        
    for(int i=1;i<numDatasets;i++){
        plot.setDataset(i,dataset.get(i));
        //XYItemRenderer renderer = plot.getRenderer(i-0);
        plot.setRenderer(i, new XYLineAndShapeRenderer(true, true));
        plot.getRenderer(i).setSeriesStroke(0, new BasicStroke(1.0f));
        plot.getRenderer(i).setSeriesPaint(0,seriesColor.get(i));
    }

    return result;
}
 
開發者ID:PacktPublishing,項目名稱:Neural-Network-Programming-with-Java-SecondEdition,代碼行數:20,代碼來源:Chart.java

示例2: createChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
private JFreeChart createChart(XYDataset dataset) {

        JFreeChart chart = ChartFactory.createScatterPlot(this.title,
                this.xAxisLabel, this.yAxisLable, dataset, PlotOrientation.VERTICAL, true, true, false);

        XYPlot plot = (XYPlot) chart.getPlot();
        plot.setNoDataMessage("NO DATA");
        XYLineAndShapeRenderer renderer
                = (XYLineAndShapeRenderer) plot.getRenderer();
        renderer.setSeriesOutlinePaint(0, Color.black);
        renderer.setUseOutlinePaint(true);

        NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
        domainAxis.setAutoRangeIncludesZero(false);
        return chart;

    }
 
開發者ID:Fanping,項目名稱:iveely.ml,代碼行數:18,代碼來源:ScatterPlot.java

示例3: plotSeperate

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
private void plotSeperate(XYDataset dataset, String p)
  {
  	NumberAxis rangeAxis1 = new NumberAxis(p);
rangeAxis1.setAutoRangeIncludesZero(false);     // override default
rangeAxis1.setLowerMargin(0.40);                // to leave room for volume bars
DecimalFormat format = new DecimalFormat("0");
rangeAxis1.setNumberFormatOverride(format);

final ValueAxis timeAxis = new DateAxis("Date");
timeAxis.setLowerMargin(0.02);                  // reduce the default margins
timeAxis.setUpperMargin(0.02);

XYPlot plot = new XYPlot(dataset, timeAxis, rangeAxis1, null);

XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
renderer1.setBaseToolTipGenerator(
    new StandardXYToolTipGenerator(
        StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
        new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00#")
    )
);
plot.setRenderer(0, renderer1);

final CombinedDomainXYPlot cplot1 = (CombinedDomainXYPlot)this.candlestickChart.getPlot();
if (plot != null) cplot1.add(plot, 1);      // weight is 1.
  }
 
開發者ID:lead4good,項目名稱:open-java-trade-manager,代碼行數:27,代碼來源:ChartJDialog.java

示例4: createChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
private JFreeChart createChart(XYSeriesCollection xySeriesCollection) {
    JFreeChart chart = ChartFactory.createXYLineChart(
            "PlotDemo",
            "X",
            "Y",
            xySeriesCollection,
            PlotOrientation.VERTICAL,
            true,
            true,
            false);
    chart.setBackgroundPaint(Color.white);

    //...Устанавливаем правила для серий
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(2, false);
    renderer.setSeriesShapesVisible(1, false);
    renderer.setSeriesPaint(0, Color.orange);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.blue);

    XYPlot plot = chart.getXYPlot();
    plot.setOutlinePaint(Color.cyan);
    plot.setRenderer(renderer);

    return chart;
}
 
開發者ID:AllDayAlone,項目名稱:Ordinary-Least-Squares-Demo,代碼行數:27,代碼來源:ChartOne.java

示例5: testGetRendererForDataset

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
/**
 * Some checks for the getRendererForDataset() method.
 */
public void testGetRendererForDataset() {
    XYDataset d0 = new XYSeriesCollection();
    XYDataset d1 = new XYSeriesCollection();
    XYDataset d2 = new XYSeriesCollection();
    XYDataset d3 = new XYSeriesCollection();  // not used by plot
    XYItemRenderer r0 = new XYLineAndShapeRenderer();
    XYItemRenderer r2 = new XYLineAndShapeRenderer();
    XYPlot plot = new XYPlot();
    plot.setDataset(0, d0);
    plot.setDataset(1, d1);
    plot.setDataset(2, d2);
    plot.setRenderer(0, r0);
    // no renderer 1
    plot.setRenderer(2, r2);
    assertEquals(r0, plot.getRendererForDataset(d0));
    assertEquals(r0, plot.getRendererForDataset(d1));
    assertEquals(r2, plot.getRendererForDataset(d2));
    assertEquals(null, plot.getRendererForDataset(d3));
    assertEquals(null, plot.getRendererForDataset(null));
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:24,代碼來源:XYPlotTests.java

示例6: test1654215

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
/**
 * A test for bug 1654215 (where a renderer is added to the plot without
 * a corresponding dataset and it throws an exception at drawing time).
 */
public void test1654215() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
            dataset, PlotOrientation.VERTICAL, true, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(1, new XYLineAndShapeRenderer());
    boolean success = false;
    try {
        BufferedImage image = new BufferedImage(200 , 100, 
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
        success = true;
    }
    catch (Exception e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:26,代碼來源:XYPlotTests.java

示例7: testGetRendererForDataset

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
/**
 * Some checks for the getRendererForDataset() method.
 */
@Test
public void testGetRendererForDataset() {
    XYDataset d0 = new XYSeriesCollection();
    XYDataset d1 = new XYSeriesCollection();
    XYDataset d2 = new XYSeriesCollection();
    XYDataset d3 = new XYSeriesCollection();  // not used by plot
    XYItemRenderer r0 = new XYLineAndShapeRenderer();
    XYItemRenderer r2 = new XYLineAndShapeRenderer();
    XYPlot plot = new XYPlot();
    plot.setDataset(0, d0);
    plot.setDataset(1, d1);
    plot.setDataset(2, d2);
    plot.setRenderer(0, r0);
    // no renderer 1
    plot.setRenderer(2, r2);
    assertEquals(r0, plot.getRendererForDataset(d0));
    assertEquals(r0, plot.getRendererForDataset(d1));
    assertEquals(r2, plot.getRendererForDataset(d2));
    assertEquals(null, plot.getRendererForDataset(d3));
    assertEquals(null, plot.getRendererForDataset(null));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:25,代碼來源:XYPlotTest.java

示例8: test1654215

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
/**
 * A test for bug 1654215 (where a renderer is added to the plot without
 * a corresponding dataset and it throws an exception at drawing time).
 */
@Test
public void test1654215() {
    DefaultXYDataset dataset = new DefaultXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
            dataset, PlotOrientation.VERTICAL, true, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(1, new XYLineAndShapeRenderer());
    try {
        BufferedImage image = new BufferedImage(200 , 100,
                BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
        g2.dispose();
    }
    catch (Exception e) {
        fail("No exception should be thrown.");
    }
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:23,代碼來源:XYPlotTest.java

示例9: testRendererIndices

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
@Test 
public void testRendererIndices() {
    XYDataset dataset = new XYSeriesCollection();
    NumberAxis xAxis = new NumberAxis("X");
    NumberAxis yAxis = new NumberAxis("Y");
    XYItemRenderer renderer = new DefaultXYItemRenderer();
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    
    assertEquals(renderer, plot.getRenderer(0));
    
    // we should be able to give a renderer an arbitrary index
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    plot.setRenderer(20, renderer2);
    assertEquals(2, plot.getRendererCount());
    assertEquals(renderer2, plot.getRenderer(20));
    
    assertEquals(20, plot.getIndexOf(renderer2));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:19,代碼來源:XYPlotTest.java

示例10: testGetRendererForDataset2

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
@Test 
public void testGetRendererForDataset2() {
    XYDataset dataset = new XYSeriesCollection();
    NumberAxis xAxis = new NumberAxis("X");
    NumberAxis yAxis = new NumberAxis("Y");
    XYItemRenderer renderer = new DefaultXYItemRenderer();
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);

    // add a second dataset
    XYSeriesCollection dataset2 = new XYSeriesCollection();
    dataset2.addSeries(new XYSeries("Series in dataset 2"));
    plot.setDataset(99, dataset2);
   
    // by default, the renderer with index 0 is used
    assertEquals(renderer, plot.getRendererForDataset(dataset2));
    
    // add a second renderer with the same index as dataset2, now it will
    // be used
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    plot.setRenderer(99, renderer);
    assertEquals(renderer2, plot.getRendererForDataset(dataset2));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:23,代碼來源:XYPlotTest.java

示例11: testDomainMarkerIndices

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
@Test
public void testDomainMarkerIndices() {
    XYDataset dataset = new XYSeriesCollection();
    NumberAxis xAxis = new NumberAxis("X");
    NumberAxis yAxis = new NumberAxis("Y");
    XYItemRenderer renderer = new DefaultXYItemRenderer();
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    
    // add a second dataset, plotted against a second x axis
    XYSeriesCollection dataset2 = new XYSeriesCollection();
    dataset2.addSeries(new XYSeries("Series in dataset 2"));
    plot.setDataset(99, dataset);    
    NumberAxis xAxis2 = new NumberAxis("X2");
    plot.setDomainAxis(1, xAxis2);
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    plot.setRenderer(99, renderer2);
    plot.mapDatasetToDomainAxis(99, 1);
    
    ValueMarker xMarker1 = new ValueMarker(123);
    plot.addDomainMarker(99, xMarker1, Layer.FOREGROUND);
    assertTrue(plot.getDomainMarkers(99, Layer.FOREGROUND).contains(
            xMarker1));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:24,代碼來源:XYPlotTest.java

示例12: testRangeMarkerIndices

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
@Test
public void testRangeMarkerIndices() {
    XYDataset dataset = new XYSeriesCollection();
    NumberAxis xAxis = new NumberAxis("X");
    NumberAxis yAxis = new NumberAxis("Y");
    XYItemRenderer renderer = new DefaultXYItemRenderer();
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    
    // add a second dataset, plotted against a second axis
    XYSeriesCollection dataset2 = new XYSeriesCollection();
    dataset2.addSeries(new XYSeries("Series in dataset 2"));
    plot.setDataset(99, dataset);    
    NumberAxis yAxis2 = new NumberAxis("Y2");
    plot.setRangeAxis(1, yAxis2);
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    plot.setRenderer(99, renderer2);
    plot.mapDatasetToRangeAxis(99, 1);
    
    ValueMarker yMarker1 = new ValueMarker(123);
    plot.addRangeMarker(99, yMarker1, Layer.FOREGROUND);
    assertTrue(plot.getRangeMarkers(99, Layer.FOREGROUND).contains(yMarker1));
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:23,代碼來源:XYPlotTest.java

示例13: createXYLineChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
/**
 * Creates a line chart (based on an {@link XYDataset}) with default
 * settings.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  a label for the X-axis (<code>null</code> permitted).
 * @param yAxisLabel  a label for the Y-axis (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param orientation  the plot orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createXYLineChart(String title, String xAxisLabel,
        String yAxisLabel, XYDataset dataset, PlotOrientation orientation,
        boolean legend, boolean tooltips, boolean urls) {

    ParamChecks.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

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

示例14: createXYLineChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
/**
 * Creates a line chart (based on an {@link XYDataset}) with default
 * settings.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param xAxisLabel  a label for the X-axis ({@code null} permitted).
 * @param yAxisLabel  a label for the Y-axis ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 * @param orientation  the plot orientation (horizontal or vertical)
 *                     ({@code null} NOT permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return The chart.
 */
public static JFreeChart createXYLineChart(String title, String xAxisLabel,
        String yAxisLabel, XYDataset dataset, PlotOrientation orientation,
        boolean legend, boolean tooltips, boolean urls) {

    Args.nullNotPermitted(orientation, "orientation");
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(orientation);
    if (tooltips) {
        renderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator());
    }
    if (urls) {
        renderer.setURLGenerator(new StandardXYURLGenerator());
    }

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    currentTheme.apply(chart);
    return chart;

}
 
開發者ID:jfree,項目名稱:jfreechart,代碼行數:41,代碼來源:ChartFactory.java

示例15: OrderParameterVsTimeChart

import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入依賴的package包/類
public OrderParameterVsTimeChart( int maxItemCount ) {
    this.maxItemCount = maxItemCount;

    meanSeries = new XYSeries( "Order Parameter vs Time" );
    xySeriesCollection = new XYSeriesCollection( meanSeries );
    domainAxis = new NumberAxis( "Time" );
    rangeAxis = new NumberAxis( "Order Parameter" );
    renderer = new XYLineAndShapeRenderer();

    int MEAN_SERIES = 0;
    renderer.setSeriesStroke( MEAN_SERIES, new BasicStroke( 2 ) );
    renderer.setSeriesLinesVisible( MEAN_SERIES, true );
    renderer.setSeriesShapesVisible( MEAN_SERIES, false );

    xyPlot = new XYPlot( xySeriesCollection,
                         domainAxis,
                         rangeAxis, renderer );
    chart = new JFreeChart( "Order Parameter vs. Time", xyPlot );
    rangeAxis.setRange( -0.01, 1.01 );
    domainAxis.setAutoRange( false );
    domainAxis.setRange( 0, maxItemCount * PlotOrderParameterVsTime.MOD );
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:23,代碼來源:OrderParameterVsTimeChart.java


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