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


Java CombinedDomainXYPlot.setGap方法代码示例

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


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

示例1: createGeneralChartPanel

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
public ChartPanel createGeneralChartPanel() {
	CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Generations"));
	plot.setGap(10.0);
	
	for (int i = 0; i < this.gCtrl.getNumOfSelectedObjectives(); i++) {
		XYPlot subp = this.createSubplot(i);
		this.subplots.add(subp);
		plot.add(subp);
	}
       plot.setOrientation(PlotOrientation.VERTICAL);
       
       LegendItemCollection chartLegend = new LegendItemCollection();
       chartLegend.add(new LegendItem("Population range", null, null, null, new Rectangle(10, 10), blue));
       chartLegend.add(new LegendItem("Generation average", null, null, null, new Rectangle(10, 1), stroke1, blue1));
       chartLegend.add(new LegendItem("Absolute best", null, null, null, new Rectangle(10, 1), stroke2, blue2));
       plot.setFixedLegendItems(chartLegend);
	
	return new ChartPanel(new JFreeChart("", plot));
}
 
开发者ID:hecoding,项目名称:Pac-Man,代码行数:20,代码来源:CenterPanel.java

示例2: createCandlestickChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private JFreeChart createCandlestickChart(OHLCDataset priceOHLCDataset) {
    final String title = "Chart";
    
    final ValueAxis timeAxis = new DateAxis("Date");
    final NumberAxis valueAxis = new NumberAxis("Price");
    valueAxis.setAutoRangeIncludesZero(false);
    valueAxis.setUpperMargin(0.0);
    valueAxis.setLowerMargin(0.0);
    XYPlot plot = new XYPlot(priceOHLCDataset, timeAxis, valueAxis, null);

    final CandlestickRenderer candlestickRenderer = new CandlestickRenderer();
    plot.setRenderer(candlestickRenderer);
    //plot.getRangeAxis().setAutoRange(true);
    
    
    // Give good width when zoom in, but too slow in calculation.
    ((CandlestickRenderer)plot.getRenderer()).setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);

    CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(timeAxis);
    cplot.add(plot, 3);
    cplot.setGap(8.0);

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, cplot, true);

    applyChartTheme(chart);

    // Handle zooming event.
    chart.addChangeListener(this.getChartChangeListner());

    return chart;        
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:32,代码来源:ChartJDialog.java

示例3: createPlot

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Creates a sample plot.
 * 
 * @return A sample plot.
 */
private CombinedDomainXYPlot createPlot() {
    // create subplot 1...
    XYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    
    XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);
    
    // create subplot 2...
    XYDataset data2 = createDataset2();
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);
    
    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    return plot;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:CombinedDomainXYPlotTests.java

示例4: createPlot

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Creates a sample plot.
 * 
 * @return A sample plot.
 */
private CombinedDomainXYPlot createPlot() {
    // create subplot 1...
    XYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    
    XYTextAnnotation annotation 
        = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);
    
    // create subplot 2...
    XYDataset data2 = createDataset2();
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    CombinedDomainXYPlot plot 
        = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);
    
    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    return plot;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:CombinedDomainXYPlotTests.java

示例5: createCombinedChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Creates a combined chart.
 *
 * @return the combined chart.
 */
private static JFreeChart createCombinedChart() {

    // create subplot 1...
    final XYDataset data1 = createDataset1();
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
    final XYPlot subplot1 = new XYPlot( data1, null, rangeAxis1, renderer1 );
    subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );

    final XYTextAnnotation annotation = new XYTextAnnotation( "Hello!", 50.0, 10000.0 );
    annotation.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
    annotation.setRotationAngle( Math.PI / 4.0 );
    subplot1.addAnnotation( annotation );

    // create subplot 2...
    final XYDataset data2 = createDataset2();
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
    rangeAxis2.setAutoRangeIncludesZero( false );
    final XYPlot subplot2 = new XYPlot( data2, null, rangeAxis2, renderer2 );
    subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );

    // parent plot...
    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot( new NumberAxis( "Domain" ) );
    plot.setGap( 10.0 );

    // add the subplots...
    plot.add( subplot1, 1 );
    plot.add( subplot2, 1 );
    plot.setOrientation( PlotOrientation.VERTICAL );

    // return a new chart containing the overlaid plot...
    return new JFreeChart( "CombinedDomainXYPlot Demo",
                           JFreeChart.DEFAULT_TITLE_FONT, plot, true );

}
 
开发者ID:mleoking,项目名称:PhET,代码行数:42,代码来源:CombinedXYPlotDemo1.java

示例6: BSCombinedChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Sole constructor.
 */
public BSCombinedChart() {
    super( null, null, new CombinedDomainXYPlot(), CREATE_LEGEND );
    
    // Energy plot...
    { 
        _energyPlot = new BSEnergyPlot();
        _energyPlot.setDomainAxis( null );
    }
    
    // Wave Function plot...
    {
        _bottomPlot = new BSBottomPlot();
        _bottomPlot.setDomainAxis( null );
    }

    // Common X axis...
    BSPositionAxis positionAxis = new BSPositionAxis();
    
    // Parent plot configuration...
    {
        CombinedDomainXYPlot plot = (CombinedDomainXYPlot) getPlot();
        
        // Misc properties
        plot.setDomainAxis( positionAxis );
        plot.setGap( CHART_SPACING );
        plot.setOrientation( PlotOrientation.VERTICAL );

        // Add the subplots, energy plot is twice the size of wave function plot.
        plot.add( _energyPlot, 2 );
        plot.add( _bottomPlot, 1 );
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:36,代码来源:BSCombinedChart.java

示例7: createCombinedChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private static JFreeChart createCombinedChart() {

        // create subplot 1...
        final XYItemRenderer renderer1 = new StandardXYItemRenderer();
        final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
        final XYPlot subplot1 = new XYPlot( createDataset1(), null, rangeAxis1, renderer1 );
        subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );

        final XYTextAnnotation annotation = new XYTextAnnotation( "Hello!", 50.0, 10000.0 );
        annotation.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
        annotation.setRotationAngle( Math.PI / 4.0 );
        subplot1.addAnnotation( annotation );

        // create subplot 2...
        final XYItemRenderer renderer2 = new StandardXYItemRenderer();
        final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
        rangeAxis2.setAutoRangeIncludesZero( false );
        final XYPlot subplot2 = new XYPlot( createDataset2(), null, rangeAxis2, renderer2 );
        subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );

        // parent plot...
        final CombinedDomainXYPlot plot = new CombinedDomainXYPlot( new NumberAxis( "Domain" ) );
        plot.setGap( 10.0 );

        // add the subplots...
        plot.add( subplot1, 1 );
        plot.add( subplot2, 1 );
        plot.setOrientation( PlotOrientation.VERTICAL );

        // return a new chart containing the overlaid plot...
        return new JFreeChart( "CombinedDomainXYPlot Demo",
                               JFreeChart.DEFAULT_TITLE_FONT, plot, true );

    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:35,代码来源:TestCombinedChartNode.java

示例8: createCombinedChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Creates a combined chart.
 *
 * @return The combined chart.
 */
private JFreeChart createCombinedChart(DataSequence tsOne, DataSequence tsTwo, ArrayList<Anomaly> anomalyList) {

    // create subplot 1.
    final XYDataset data1 = createDataset(tsOne, "Original");
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis("Original Value");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    
    // plot anomalies on subplot 1.
    addAnomalies(subplot1, anomalyList);
    
    // create subplot 2.
    final XYDataset data2 = createDataset(tsTwo, "Forecast");
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis2 = new NumberAxis("Forecast Value");
    rangeAxis2.setAutoRangeIncludesZero(false);
    final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot.
    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time"));
    plot.setGap(10.0);
    
    // add the subplots.
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    
    // Add anomaly score time-series.
    addAnomalyTS(plot, tsOne, tsTwo);
    
    plot.setOrientation(PlotOrientation.VERTICAL);

    // return a new chart containing the overlaid plot.
    return new JFreeChart("EGADS GUI",
                          JFreeChart.DEFAULT_TITLE_FONT,
                          plot,
                          true);
}
 
开发者ID:yahoo,项目名称:egads,代码行数:45,代码来源:GUIUtils.java

示例9: createPlot

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Creates a sample plot.
 *
 * @return A sample plot.
 */
private CombinedDomainXYPlot createPlot() {
    // create subplot 1...
    XYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    XYTextAnnotation annotation
        = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);

    // create subplot 2...
    XYDataset data2 = createDataset2();
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    CombinedDomainXYPlot plot
        = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);

    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    return plot;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:39,代码来源:CombinedDomainXYPlotTests.java

示例10: createCombinedChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Creates a combined chart.
 *
 * @return the combined chart.
 */
private JFreeChart createCombinedChart() {

    // create subplot 1...
    final XYDataset data1 = createDataset1();
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);

    // create subplot 2...
    final XYDataset data2 = createDataset2();
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);

    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);

    // return a new chart containing the overlaid plot...
    return new JFreeChart("CombinedDomainXYPlot Demo",
                          JFreeChart.DEFAULT_TITLE_FONT, plot, true);

}
 
开发者ID:josejamilena,项目名称:pfc-jose,代码行数:42,代码来源:CombinedXYPlotDemo1.java

示例11: createChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private JFreeChart createChart() {

      final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
      final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
      final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer();
      final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

      final TimeSeries seriests = new TimeSeries("Series");
      final TimeSeries seasonalts = new TimeSeries("Seasonal");
      final TimeSeries trendts = new TimeSeries("Trend");
      final TimeSeries remainderts = new TimeSeries("Remainder");

      final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts};
      final String[] labels = new String[]{"Series", "Seasonal", "Trend"};

      for (int i = 0; i < series.length; i++) {
        final Date d = new Date((long) times[i]);
        RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault());
        seriests.addOrUpdate(rtp, series[i]);
        seasonalts.addOrUpdate(rtp, seasonal[i]);
        trendts.addOrUpdate(rtp, trend[i]);
        remainderts.addOrUpdate(rtp, remainder[i]);
      }

      plot.setGap(10.0);
      renderer.setSeriesPaint(0, black);
      barRenderer.setSeriesPaint(0, black);
      plot.setOrientation(PlotOrientation.VERTICAL);

      for (int i = 0; i < tsArray.length; i++) {
        final XYDataset ts = new TimeSeriesCollection(tsArray[i]);
        final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer);
        plot.add(p);
      }

      final XYDataset rts = new TimeSeriesCollection(remainderts);
      final XYDataset sts = new TimeSeriesCollection(seriests);
      final XYDataset tts = new TimeSeriesCollection(trendts);
      final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer);
      final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer);

      seriesAndTrend.setDataset(1, tts);
      seriesAndTrend.setRenderer(1, renderer);

      plot.add(rplot);
      plot.add(seriesAndTrend);

      return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    }
 
开发者ID:ruananswer,项目名称:twitter-anomalyDetection-java,代码行数:50,代码来源:StlPlotter.java

示例12: createWeeklyLoginChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private byte[] createWeeklyLoginChart (int width, int height)
{
	IntervalXYDataset dataset1 = getWeeklyLoginsDataSet ();
       IntervalXYDataset dataset2 = getWeeklySiteUserDataSet ();
	
	if ((dataset1 == null) || (dataset2 == null)) {
		return generateNoDataChart(width, height);
	}
	
       // create plot ...
       XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
       renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
       renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
	renderer1.setSeriesPaint(0, Color.RED);
	renderer1.setSeriesPaint(0, Color.BLUE);
       
       DateAxis domainAxis = new DateAxis("");
       domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.DAY, 7, new SimpleDateFormat ("yyyy-MM-dd")));
       domainAxis.setTickMarkPosition (DateTickMarkPosition.START);
       domainAxis.setVerticalTickLabels (true);
	domainAxis.setLowerMargin (0.01);
	domainAxis.setUpperMargin (0.01);
       
       NumberAxis rangeAxis = new NumberAxis("count");
	rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ());
	
       XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1);
       plot1.setBackgroundPaint(Color.lightGray);
       plot1.setDomainGridlinePaint(Color.white);
       plot1.setRangeGridlinePaint(Color.white);
       
       // add a second dataset and renderer...
       XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false);
       renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
       renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
       renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
       renderer2.setSeriesPaint(0, Color.GREEN);
       renderer2.setSeriesPaint(1, Color.BLACK);
       renderer2.setSeriesPaint(2, Color.CYAN);
       
       rangeAxis = new NumberAxis("count");
	rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ());

	XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2);
       plot2.setBackgroundPaint(Color.lightGray);
       plot2.setDomainGridlinePaint(Color.white);
       plot2.setRangeGridlinePaint(Color.white);
       
       CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis);
       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(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
       LegendTitle legend = new LegendTitle(cplot);
       chart.addSubtitle(legend);		
	
	// set background
	chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ()));

	// set chart border
	chart.setPadding (new RectangleInsets (10, 5, 5, 5));
	chart.setBorderVisible (true);
	chart.setBorderPaint (parseColor ("#cccccc"));

	// set anti alias
	chart.setAntiAlias (true);

	BufferedImage img = chart.createBufferedImage (width, height);
	final ByteArrayOutputStream out = new ByteArrayOutputStream();
	try{
		ImageIO.write(img, "png", out);
	}catch(IOException e){
		log.warn("Error occurred while generating SiteStats chart image data", e);
	}
	return out.toByteArray();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:81,代码来源:ServerWideReportManagerImpl.java

示例13: createChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private JFreeChart createChart() {

            final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
            final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
            final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer();
            final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

            final TimeSeries seriests = new TimeSeries("Series");
            final TimeSeries seasonalts = new TimeSeries("Seasonal");
            final TimeSeries trendts = new TimeSeries("Trend");
            final TimeSeries remainderts = new TimeSeries("Remainder");

            final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts};
            final String[] labels = new String[]{"Series", "Seasonal", "Trend"};

            for (int i = 0; i < series.length; i++) {
                final Date d = new Date((long) times[i]);
                RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault());
                seriests.addOrUpdate(rtp, series[i]);
                seasonalts.addOrUpdate(rtp, seasonal[i]);
                trendts.addOrUpdate(rtp, trend[i]);
                remainderts.addOrUpdate(rtp, remainder[i]);
            }

            plot.setGap(10.0);
            renderer.setSeriesPaint(0, black);
            barRenderer.setSeriesPaint(0, black);
            plot.setOrientation(PlotOrientation.VERTICAL);

            for (int i = 0; i < tsArray.length; i++) {
                final XYDataset ts = new TimeSeriesCollection(tsArray[i]);
                final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer);
                plot.add(p);
            }

            final XYDataset rts = new TimeSeriesCollection(remainderts);
            final XYDataset sts = new TimeSeriesCollection(seriests);
            final XYDataset tts = new TimeSeriesCollection(trendts);
            final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer);
            final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer);

            seriesAndTrend.setDataset(1, tts);
            seriesAndTrend.setRenderer(1, renderer);

            plot.add(rplot);
            plot.add(seriesAndTrend);

            return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        }
 
开发者ID:kevoree,项目名称:kevoree-brain,代码行数:50,代码来源:StlPlotter.java

示例14: createCombinedChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
 * Creates a combined chart.
 *
 * @return The combined chart.
 */
private JFreeChart createCombinedChart() {

    // create subplot 1...
    final XYDataset data1 = createDataset1();
    final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    final XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

    // add secondary axis
    subplot1.setDataset(1, createDataset2());
    final NumberAxis axis2 = new NumberAxis("Range Axis 2");
    axis2.setAutoRangeIncludesZero(false);
    subplot1.setRangeAxis(1, axis2);
    subplot1.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
    subplot1.setRenderer(1, new StandardXYItemRenderer());
    subplot1.mapDatasetToRangeAxis(1, 1);

    final XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    annotation.setRotationAngle(Math.PI / 4.0);
    subplot1.addAnnotation(annotation);

    // create subplot 2...
    final XYDataset data2 = createDataset2();
    final XYItemRenderer renderer2 = new StandardXYItemRenderer();
    final NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    rangeAxis2.setAutoRangeIncludesZero(false);
    final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    // parent plot...
    final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    plot.setGap(10.0);

    // add the subplots...
    plot.add(subplot1, 1);
    plot.add(subplot2, 1);
    plot.setOrientation(PlotOrientation.VERTICAL);

    // return a new chart containing the overlaid plot...
    return new JFreeChart("CombinedDomainXYPlot Demo",
                          JFreeChart.DEFAULT_TITLE_FONT, plot, true);

}
 
开发者ID:josejamilena,项目名称:pfc-jose,代码行数:51,代码来源:CombinedXYPlotDemo4.java

示例15: addVerticalSectionChart

import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
public static JFreeChart addVerticalSectionChart(JFreeChart transectChart,
        JFreeChart verticalSectionChart) {
    /*
     * Create the combined chart with both the transect and the vertical
     * section
     */
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(
            new NumberAxis("Distance along path (km)"));
    plot.setGap(20.0);
    plot.add(transectChart.getXYPlot(), 1);
    plot.add(verticalSectionChart.getXYPlot(), 1);
    plot.setOrientation(PlotOrientation.VERTICAL);
    String title = transectChart.getTitle().getText();
    String copyright = null;
    for (int i = 0; i < transectChart.getSubtitleCount(); i++) {
        Title subtitle = transectChart.getSubtitle(i);
        if (subtitle instanceof TextTitle) {
            copyright = ((TextTitle) transectChart.getSubtitle(0)).getText();
            break;
        }
    }

    JFreeChart combinedChart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot,
            false);

    /* Set left margin to 10 to avoid number wrap at color bar */
    RectangleInsets r = new RectangleInsets(0, 10, 0, 0);
    transectChart.setPadding(r);

    /*
     * This is not ideal. We have already added the copyright label to the
     * first chart, but then we extract the actual plot, so we need to add
     * it again here
     */
    if (copyright != null) {
        final TextTitle textTitle = new TextTitle(copyright);
        textTitle.setFont(new Font("SansSerif", Font.PLAIN, 10));
        textTitle.setPosition(RectangleEdge.BOTTOM);
        textTitle.setHorizontalAlignment(HorizontalAlignment.RIGHT);
        combinedChart.addSubtitle(textTitle);
    }

    /* Use the legend from the vertical section chart */
    combinedChart.addSubtitle(verticalSectionChart.getSubtitle(0));

    return combinedChart;
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:48,代码来源:Charting.java


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