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


Java LineAndShapeRenderer.setBaseItemLabelsVisible方法代碼示例

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


在下文中一共展示了LineAndShapeRenderer.setBaseItemLabelsVisible方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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.setBaseItemLabelsVisible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。