当前位置: 首页>>代码示例>>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;未经允许,请勿转载。