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


Java LineAndShapeRenderer.setBaseShapesVisible方法代碼示例

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


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

示例1: setLineRender

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels, boolean isShapesVisible) {
    plot.setNoDataMessage(NO_DATA_MSG);
    plot.setInsets(new RectangleInsets(10, 10, 0, 10), false);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();

    renderer.setStroke(new BasicStroke(1.5F));
    if (isShowDataLabels) {
        renderer.setBaseItemLabelsVisible(true);
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
                NumberFormat.getInstance()));
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
    }
    renderer.setBaseShapesVisible(isShapesVisible);
    setXAixs(plot);
    setYAixs(plot);

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

示例2: setPlotStyle

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
private void setPlotStyle(JFreeChart chart) throws ChartException {
if (chart == null)
	throw new ChartException("chart未正確創建,設置圖表樣式時異常!");
// 獲得線性圖的Plot對象
   CategoryPlot localCategoryPlot = (CategoryPlot)chart.getPlot();
   localCategoryPlot.setBackgroundAlpha(this.getAlpha());
   
   BasicStroke stroke = new BasicStroke();
   localCategoryPlot.setRangeGridlinesVisible(true) ;//數據軸網格是否可見
   localCategoryPlot.setRangeGridlinePaint(Color.black)   ;//數據軸網格線條顏色
   //localCategoryPlot.setRangeGridlineStroke(stroke) ;//數據軸網格線條筆觸

   //localCategoryPlot.setDomainGridlinesVisible(true) ;//數據軸網格是否可見
   //localCategoryPlot.setDomainGridlinePaint(Color.black)   ;//數據軸網格線條顏色
   //localCategoryPlot.setDomainGridlineStroke(stroke);
   CategoryAxis localCategoryXAxis = (CategoryAxis)localCategoryPlot.getDomainAxis();
   NumberAxis localNumberYAxis = (NumberAxis)localCategoryPlot.getRangeAxis();
   localCategoryXAxis.setTickLabelFont(new Font("宋體", Font.PLAIN, 12));
   localCategoryXAxis.setLabelFont(new Font("宋體", Font.PLAIN, 12));
   localNumberYAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
   localNumberYAxis.setTickLabelFont(new Font("宋體", Font.PLAIN, 12));
   localNumberYAxis.setLabelFont(new Font("宋體", Font.PLAIN, 12));
   
   LineAndShapeRenderer localLineAndShapeRenderer = (LineAndShapeRenderer)localCategoryPlot.getRenderer();
   //localLineAndShapeRenderer.setDrawLines(true);//    是否折線的數據點之間用線連
   //localLineAndShapeRenderer.setDrawShapes(true);//   是否折線的數據點根據分類使用不同的形狀
   localLineAndShapeRenderer.setStroke(new BasicStroke(this.getStrok()));//這個是設置線條的粗細
   
   if("1".equals(this.getDisplayNumber())){
   localLineAndShapeRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());//折線上顯示數字
   localLineAndShapeRenderer.setBaseItemLabelsVisible(true);
   }

   localLineAndShapeRenderer.setBaseShapesVisible(true);
   localLineAndShapeRenderer.setBaseShapesFilled(true);
   localLineAndShapeRenderer.setDrawOutlines(true);
   localLineAndShapeRenderer.setUseFillPaint(true);
   localLineAndShapeRenderer.setBaseFillPaint(Color.white);	
   }
 
開發者ID:fanqinghui,項目名稱:TaskExcute,代碼行數:40,代碼來源:LineCharts.java

示例3: NamedDoubleSeriesChartContainer

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
public NamedDoubleSeriesChartContainer()
{
	dataset = new DefaultCategoryDataset();
	renderer = new LineAndShapeRenderer();
	renderer.setBaseShapesVisible(false);
	renderer.setBaseLinesVisible(true);
	CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis(), new NumberAxis(), renderer);
	chart = new JFreeChart(plot);
	plot.setDrawingSupplier(ChartUtils.createDrawingSupplier());
	
}
 
開發者ID:cas-bioinf,項目名稱:cy-dataseries,代碼行數:12,代碼來源:NamedDoubleSeriesChartContainer.java

示例4: createLegend

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected JFreeChart createLegend(CategoryDataset dataset) {
    
    JFreeChart chart = ChartFactory.createLineChart(
        chartTitle,             // chart title
        domainLabel,               // domain axis label
        rangeLabel,                  // range axis label
        dataset,                  // data
        PlotOrientation.VERTICAL, // orientation
        true,                     // include legend
        true,                     // tooltips
        false                     // urls
    );
	 
    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = chart.getCategoryPlot();

    LineAndShapeRenderer renderer 
       = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setDrawOutlines(true);
   // renderer.setUseFillPaint(true);
   // renderer.setFillPaint(Color.white);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    return chart;
    
}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:28,代碼來源:SuperCategoryChart_vertical.java

示例5: createChart

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
   * Creates a sample chart.
   * 
   * @param dataset  a dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
      
      // create the chart...
      JFreeChart chart = ChartFactory.createLineChart(
          chartTitle,   // chart title
          domainLabel,                       // domain axis label
          rangeLabel,                   // range axis label
          dataset,                         // data
          PlotOrientation.VERTICAL,        // orientation
          !legendPanelOn,                           // include legend
          true,                            // tooltips
          false                            // urls
      );

     
      chart.setBackgroundPaint(Color.white);

      CategoryPlot plot = (CategoryPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      // customise the range axis...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      // customise the renderer...
      LineAndShapeRenderer renderer 
          = (LineAndShapeRenderer) plot.getRenderer();
      renderer.setBaseShapesVisible(true);
      renderer.setDrawOutlines(true);
      renderer.setUseFillPaint(true);
      renderer.setBaseFillPaint(Color.white);
      renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

setCategorySummary(dataset);
      return chart;
  }
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:45,代碼來源:LineChartDemo1a.java

示例6: createChart

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
   * Creates a sample chart.
   * 
   * @param dataset  a dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
      
      // create the chart...
      JFreeChart chart = ChartFactory.createLineChart(
          chartTitle,   // chart title
          domainLabel,                       // domain axis label
          rangeLabel,                   // range axis label
          dataset,                         // data
          PlotOrientation.VERTICAL,        // orientation
          !legendPanelOn,                           // include legend
          true,                            // tooltips
          false                            // urls
      );
   
      chart.setBackgroundPaint(Color.white);

      CategoryPlot plot = (CategoryPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      // customise the range axis...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      // customise the renderer...
      LineAndShapeRenderer renderer 
          = (LineAndShapeRenderer) plot.getRenderer();
      renderer.setBaseShapesVisible(true);
      renderer.setDrawOutlines(true);
      renderer.setUseFillPaint(true);
      renderer.setBaseFillPaint(Color.white);
      renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

setCategorySummary(dataset);
      return chart;
  }
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:44,代碼來源:LineChartDemo1b.java

示例7: createLegend

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected JFreeChart createLegend(CategoryDataset dataset) {
       
//  JFreeChart chart = ChartFactory.createAreaChart(
       JFreeChart chart = ChartFactory.createLineChart(
           chartTitle,             // chart title
           domainLabel, // "Category",               // domain axis label
           rangeLabel, //"Value",                  // range axis label
           dataset,                  // data
           PlotOrientation.VERTICAL, // orientation
           true,                     // include legend
           true,                     // tooltips
           false                     // urls
       );

       // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
       chart.setBackgroundPaint(Color.white);
       CategoryPlot plot = chart.getCategoryPlot();

       LineAndShapeRenderer renderer 
          = (LineAndShapeRenderer) plot.getRenderer();
       renderer.setBaseShapesVisible(true);
      // renderer.setDrawOutlines(true);
      // renderer.setUseFillPaint(true);
      // renderer.setFillPaint(Color.white);
       renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
       return chart;
       
   }
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:29,代碼來源:SuperCategoryChart.java

示例8: formatSeries

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected void formatSeries(LineAndShapeRenderer renderer) {
    renderer.setBaseShapesVisible(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseStroke(new BasicStroke(2));
    
    int count = ((CategoryDataset) dataset).getRowCount();
    ColorGenerator colors = format.getColors();
    for(int i=0; i<count; i++) {
        Paint color = colors.nextColor();
        renderer.setSeriesPaint(i, color);
        renderer.setSeriesFillPaint(i, color);
    }
}
 
開發者ID:Depter,項目名稱:JRLib,代碼行數:15,代碼來源:AbstractLineChart.java

示例9: formatSeries

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected void formatSeries(LineAndShapeRenderer renderer) {
    renderer.setBaseShapesVisible(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseStroke(new BasicStroke(2));
    
    int count = ((CategoryDataset) dataset).getRowCount();
    ColorGenerator colors = format.getColors();
    for(int i=0; i<count; i++) {
        Color color = colors.nextColor();
        renderer.setSeriesPaint(i, color);
        renderer.setSeriesFillPaint(i, color);
    }
}
 
開發者ID:Depter,項目名稱:JRLib,代碼行數:15,代碼來源:AbstractLineChart.java

示例10: testEquals

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {
    
    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    LineAndShapeRenderer r2 = new LineAndShapeRenderer();
    assertEquals(r1, r2);
    
    r1.setBaseLinesVisible(!r1.getBaseLinesVisible());
    assertFalse(r1.equals(r2));
    r2.setBaseLinesVisible(r1.getBaseLinesVisible());
    assertTrue(r1.equals(r2));
    
    r1.setSeriesLinesVisible(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesLinesVisible(1, true);
    assertTrue(r1.equals(r2));
    
    r1.setLinesVisible(false);
    assertFalse(r1.equals(r2));
    r2.setLinesVisible(false);
    assertTrue(r1.equals(r2));
    
    r1.setBaseShapesVisible(!r1.getBaseShapesVisible());
    assertFalse(r1.equals(r2));
    r2.setBaseShapesVisible(r1.getBaseShapesVisible());
    assertTrue(r1.equals(r2));
    
    r1.setSeriesShapesVisible(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesShapesVisible(1, true);
    assertTrue(r1.equals(r2));
    
    r1.setShapesVisible(false);
    assertFalse(r1.equals(r2));
    r2.setShapesVisible(false);
    assertTrue(r1.equals(r2));

    r1.setShapesFilled(false);
    assertFalse(r1.equals(r2));
    r2.setShapesFilled(false);
    assertTrue(r1.equals(r2));
    
    r1.setSeriesShapesFilled(1, true);
    assertFalse(r1.equals(r2));
    r2.setSeriesShapesFilled(1, true);
    assertTrue(r1.equals(r2));
    
    r1.setBaseShapesFilled(false);
    assertFalse(r1.equals(r2));
    r2.setBaseShapesFilled(false);
    assertTrue(r1.equals(r2));
    
    r1.setUseOutlinePaint(true);
    assertFalse(r1.equals(r2));
    r2.setUseOutlinePaint(true);
    assertTrue(r1.equals(r2));
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:61,代碼來源:LineAndShapeRendererTests.java

示例11: createLineChart

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected JFreeChart createLineChart() throws JRException 
{
	ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
	JFreeChart freeChart = 
		ChartFactory.createLineChart(
			evaluateTextExpression(getChart().getTitleExpression()),
			evaluateTextExpression( ((JRLinePlot)getPlot()).getCategoryAxisLabelExpression()),
			evaluateTextExpression(((JRLinePlot)getPlot()).getValueAxisLabelExpression()),
			(CategoryDataset)getDataset(),
			getPlot().getOrientationValue().getOrientation(),
			isShowLegend(),
			true,
			false);

	configureChart(freeChart, getPlot());

	CategoryPlot categoryPlot = (CategoryPlot)freeChart.getPlot();
	JRLinePlot linePlot = (JRLinePlot)getPlot();

	LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer)categoryPlot.getRenderer();
	boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes().booleanValue();
	boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines().booleanValue();
	
	lineRenderer.setBaseShapesVisible( isShowShapes );//FIXMECHART check this
	lineRenderer.setBaseLinesVisible( isShowLines );
	
	//FIXME labels?

	// Handle the axis formating for the category axis
	configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
			linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
			linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(), linePlot.getCategoryAxisVerticalTickLabels(),
			linePlot.getOwnCategoryAxisLineColor(), false,
			(Comparable<?>)evaluateExpression(linePlot.getDomainAxisMinValueExpression()),
			(Comparable<?>)evaluateExpression(linePlot.getDomainAxisMaxValueExpression()));

	// Handle the axis formating for the value axis
	configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
			linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
			linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(), linePlot.getValueAxisVerticalTickLabels(),
			linePlot.getOwnValueAxisLineColor(), true,
			(Comparable<?>)evaluateExpression(linePlot.getRangeAxisMinValueExpression()),
			(Comparable<?>)evaluateExpression(linePlot.getRangeAxisMaxValueExpression()));

	return freeChart;
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:47,代碼來源:GenericChartTheme.java

示例12: createLineChart

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected JFreeChart createLineChart() throws JRException 
{
	ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
	JFreeChart freeChart = 
		ChartFactory.createLineChart(
			evaluateTextExpression(getChart().getTitleExpression()),
			evaluateTextExpression( ((JRLinePlot)getPlot()).getCategoryAxisLabelExpression()),
			evaluateTextExpression(((JRLinePlot)getPlot()).getValueAxisLabelExpression()),
			(CategoryDataset)getDataset(),
			getPlot().getOrientationValue().getOrientation(),
			isShowLegend(),
			true,
			false);

	configureChart(freeChart, getPlot());

	CategoryPlot categoryPlot = (CategoryPlot)freeChart.getPlot();
	JRLinePlot linePlot = (JRLinePlot)getPlot();

	LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer)categoryPlot.getRenderer();
	boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes().booleanValue();
	boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines().booleanValue();
	
	lineRenderer.setBaseShapesVisible( isShowShapes );//FIXMECHART check this
	lineRenderer.setBaseLinesVisible( isShowLines );
	
	//FIXME labels?

	// Handle the axis formating for the category axis
	configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
			linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
			linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(), linePlot.getCategoryAxisVerticalTickLabels(),
			linePlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(),
			(Comparable<?>)evaluateExpression(linePlot.getDomainAxisMinValueExpression()), 
			(Comparable<?>)evaluateExpression(linePlot.getDomainAxisMaxValueExpression())
			);


	// Handle the axis formating for the value axis
	configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
			linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
			linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(), linePlot.getValueAxisVerticalTickLabels(),
			linePlot.getOwnValueAxisLineColor(), getRangeAxisSettings(),
			(Comparable<?>)evaluateExpression(linePlot.getRangeAxisMinValueExpression()), 
			(Comparable<?>)evaluateExpression(linePlot.getRangeAxisMaxValueExpression())
			);

	return freeChart;
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:50,代碼來源:SimpleChartTheme.java

示例13: createLineChart

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected JFreeChart createLineChart() throws JRException 
{
	ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
	JFreeChart jfreeChart = ChartFactory.createLineChart(
			evaluateTextExpression(getChart().getTitleExpression()),
			evaluateTextExpression( ((JRLinePlot)getPlot()).getCategoryAxisLabelExpression()),
			evaluateTextExpression(((JRLinePlot)getPlot()).getValueAxisLabelExpression()),
			(CategoryDataset)getDataset(),
			getPlot().getOrientationValue().getOrientation(),
			isShowLegend(),
			true,
			false);

	configureChart(jfreeChart);

	CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
	JRLinePlot linePlot = (JRLinePlot)getPlot();

	LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer)categoryPlot.getRenderer();
	boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes().booleanValue();
	boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines().booleanValue();
	
	lineRenderer.setBaseShapesVisible( isShowShapes );//FIXMECHART check this
	lineRenderer.setBaseLinesVisible( isShowLines );
	
	//FIXME labels?

	// Handle the axis formating for the category axis
	configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
			linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
			linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(), linePlot.getCategoryAxisVerticalTickLabels(),
			linePlot.getCategoryAxisLineColor(),  false,
			(Comparable<?>)evaluateExpression(linePlot.getDomainAxisMinValueExpression()),
			(Comparable<?>)evaluateExpression(linePlot.getDomainAxisMaxValueExpression()));

	// Handle the axis formating for the value axis
	configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
			linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
			linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(), linePlot.getValueAxisVerticalTickLabels(),
			linePlot.getValueAxisLineColor(), true,
			(Comparable<?>)evaluateExpression(linePlot.getRangeAxisMinValueExpression()),
			(Comparable<?>)evaluateExpression(linePlot.getRangeAxisMaxValueExpression()));

	return jfreeChart;
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:46,代碼來源:DefaultChartTheme.java

示例14: createChart

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
/**
   * Creates a sample chart.
   * 
   * @param dataset  a dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
  	 if(isDemo){
  		 chartTitle = "Java Standard Class Library";
  		 domainLabel = "Release";
  		 rangeLabel ="Class Count";
  	 }else chartTitle="Line Chart";
  	 
  	
      // create the chart...
      JFreeChart chart = ChartFactory.createLineChart(
          chartTitle,   // chart title
          domainLabel,                       // domain axis label
          rangeLabel,                   // range axis label
          dataset,                         // data
          PlotOrientation.VERTICAL,        // orientation
          !legendPanelOn,                           // include legend
          true,                            // tooltips
          false                            // urls
      );

      if(isDemo){
       chart.addSubtitle(new TextTitle("Number of Classes By Release"));
       TextTitle source = new TextTitle(
           "Source: Java In A Nutshell (4th Edition) " 
           + "by David Flanagan (O'Reilly)"
       );
       source.setFont(new Font("SansSerif", Font.PLAIN, 10));
       source.setPosition(RectangleEdge.BOTTOM);
       source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
       chart.addSubtitle(source);
      }else{
      	chart.clearSubtitles();
      }
      
      chart.setBackgroundPaint(Color.white);

      CategoryPlot plot = (CategoryPlot) chart.getPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setRangeGridlinePaint(Color.white);

      // customise the range axis...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      // customise the renderer...
      LineAndShapeRenderer renderer 
          = (LineAndShapeRenderer) plot.getRenderer();
      renderer.setBaseShapesVisible(true);
      renderer.setDrawOutlines(true);
      renderer.setUseFillPaint(true);
      renderer.setBaseFillPaint(Color.white);
      renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

setCategorySummary(dataset);
      return chart;
  }
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:64,代碼來源:LineChartDemo1.java

示例15: createLegend

import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
protected JFreeChart createLegend(CategoryDataset dataset) {
  JFreeChart chart = ChartFactory.createLineChart(
            chartTitle,      // chart title
            domainLabel,                   // domain axis label
            rangeLabel,                  // range axis label
            dataset,                  // data
            PlotOrientation.VERTICAL, // orientation
            true,                     // include legend
            true,                     // tooltips
            false                     // urls
        );

        chart.setBackgroundPaint(Color.white);

        Shape[] shapes = new Shape[3];
        int[] xpoints;
        int[] ypoints;

        // right-pointing triangle
        xpoints = new int[] {-3, 3, -3};
        ypoints = new int[] {-3, 0, 3};
        shapes[0] = new Polygon(xpoints, ypoints, 3);

        // vertical rectangle
        shapes[1] = new Rectangle2D.Double(-2, -3, 3, 6);

        // left-pointing triangle
        xpoints = new int[] {-3, 3, 3};
        ypoints = new int[] {0, -3, 3};
        shapes[2] = new Polygon(xpoints, ypoints, 3);

        DrawingSupplier supplier = new DefaultDrawingSupplier(
            DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            shapes
        );
        CategoryPlot plot = chart.getCategoryPlot();
        plot.setOrientation(PlotOrientation.HORIZONTAL);
        plot.setBackgroundPaint(Color.lightGray);
        plot.setDomainGridlinePaint(Color.white);
        plot.setRangeGridlinePaint(Color.white);
        plot.setDrawingSupplier(supplier);

        // set the stroke for each series...
        plot.getRenderer().setSeriesStroke(
            0, 
            new BasicStroke(
                2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 
                1.0f, new float[] {10.0f, 6.0f}, 0.0f
            )
        );
        plot.getRenderer().setSeriesStroke(
            1, 
            new BasicStroke(
                2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
                1.0f, new float[] {6.0f, 6.0f}, 0.0f
            )
        );
        plot.getRenderer().setSeriesStroke(
            2, 
            new BasicStroke(
                2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
                1.0f, new float[] {2.0f, 6.0f}, 0.0f
            )
        );

        // customise the renderer...
        LineAndShapeRenderer renderer 
            = (LineAndShapeRenderer) plot.getRenderer();
        renderer.setBaseShapesVisible(true);
        renderer.setBaseItemLabelsVisible(true);
        renderer.setBaseItemLabelGenerator(
            new StandardCategoryItemLabelGenerator()
        );
		renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    return chart;
    
}
 
開發者ID:SOCR,項目名稱:HTML5_WebSite,代碼行數:81,代碼來源:LineChartDemo5.java


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