• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LayeredBarRenderer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jfree.chart.renderer.category.LayeredBarRenderer的典型用法代码示例。如果您正苦于以下问题:Java LayeredBarRenderer类的具体用法?Java LayeredBarRenderer怎么用?Java LayeredBarRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LayeredBarRenderer类属于org.jfree.chart.renderer.category包,在下文中一共展示了LayeredBarRenderer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testDrawWithNullInfo

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.addValue(1.0, "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset, 
                new CategoryAxis("Category"), new NumberAxis("Value"), 
                new LayeredBarRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:LayeredBarRendererTests.java


示例2: testDrawWithNullInfo

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.addValue(1.0, "S1", "C1");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new LayeredBarRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:LayeredBarRendererTests.java


示例3: testHashcode

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    LayeredBarRenderer r1 = new LayeredBarRenderer();
    LayeredBarRenderer r2 = new LayeredBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:LayeredBarRendererTests.java


示例4: testHashcode

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    LayeredBarRenderer r1 = new LayeredBarRenderer();
    LayeredBarRenderer r2 = new LayeredBarRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:LayeredBarRendererTests.java


示例5: customize

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
@Override
public void customize(JFreeChart chart, ReportParameters reportParameters) {
	BarRenderer categoryRenderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
   LayeredBarRenderer renderer = new LayeredBarRenderer();

   renderer.setBaseItemLabelsVisible(categoryRenderer.getBaseItemLabelsVisible());
   renderer.setBaseItemLabelFont(categoryRenderer.getBaseItemLabelFont());
   renderer.setBaseItemLabelPaint(categoryRenderer.getBaseItemLabelPaint());
   renderer.setBaseItemLabelGenerator(categoryRenderer.getBaseItemLabelGenerator());
	renderer.setShadowVisible(categoryRenderer.getShadowsVisible());
	CategoryDataset categoryDataset = chart.getCategoryPlot().getDataset();
	if(categoryDataset != null)	{
		for(int i = 0; i < categoryDataset.getRowCount(); i++) {
			Paint seriesOutlinePaint = categoryRenderer.getSeriesOutlinePaint(i);
			if (seriesOutlinePaint != null) {
				renderer.setSeriesOutlinePaint(i, seriesOutlinePaint);
			}
			Paint seriesPaint = categoryRenderer.getSeriesPaint(i);
			if (seriesPaint != null) {
				renderer.setSeriesPaint(i, seriesPaint);
			}
		}
	}
	renderer.setItemMargin(categoryRenderer.getItemMargin());
	GradientPaintTransformer gradientPaintTransformer = categoryRenderer.getGradientPaintTransformer();
	if (gradientPaintTransformer != null) {
		renderer.setGradientPaintTransformer(gradientPaintTransformer);
	}

   if (seriesBarWidths != null) {
   	for (int i = 0; i < seriesBarWidths.size(); i++) {
   		renderer.setSeriesBarWidth(i, seriesBarWidths.get(i));
		}
   }

   chart.getCategoryPlot().setRenderer(renderer);
 }
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:38,代码来源:LayeredBarRendererCustomizer.java


示例6: test

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
@Override
public void test() {
	super.test();

	numberOfPagesTest(1);

	JFreeChart chart = getChart("summary.chart1", 0);
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", LayeredBarRenderer.class, categoryPlot.getRenderer().getClass());
	Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible());
	Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible());
	Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible());

	chart = getChart("summary.chart2", 0);
	Axis axis = chart.getCategoryPlot().getDomainAxis();
	Assert.assertEquals("category label", "category", axis.getLabel());
	Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
	Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
	Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
	Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
	CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions().getLabelPosition(RectangleEdge.LEFT);
	Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
	Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

	chart = getChart("summary.chart3", 0);
	axis = chart.getCategoryPlot().getRangeAxis();
	Assert.assertEquals("value label", "value", axis.getLabel());
	Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
	Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
	Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
	Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
	Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
	Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
	Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
	Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:37,代码来源:LayeredBarChartTest.java


示例7: testEquals

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
 * Problem that the equals(...) method distinguishes all fields.
 */
public void testEquals() {
    LayeredBarRenderer r1 = new LayeredBarRenderer();
    LayeredBarRenderer r2 = new LayeredBarRenderer();
    assertEquals(r1, r2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:LayeredBarRendererTests.java


示例8: testEquals

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    LayeredBarRenderer r1 = new LayeredBarRenderer();
    LayeredBarRenderer r2 = new LayeredBarRenderer();
    assertEquals(r1, r2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:LayeredBarRendererTests.java


示例9: createChart

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
   * Creates a sample chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
      
      // create the chart...
      JFreeChart chart = ChartFactory.createBarChart(
          chartTitle,  // chart title
          domainLabel,                  // domain axis label
          rangeLabel,                     // range axis label
          dataset,                     // data
          PlotOrientation.HORIZONTAL,  // orientation
          !legendPanelOn,                        // include legend
          true,                        // tooltips?
          false                        // URLs?
      );

      chart.setBackgroundPaint(Color.white);

      // get a reference to the plot for further customisation...
      CategoryPlot plot = chart.getCategoryPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setDomainGridlinePaint(Color.white);
      plot.setDomainGridlinesVisible(true);
      plot.setRangeGridlinePaint(Color.white);

      // set the range axis to display integers only...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      // disable bar outlines...
      LayeredBarRenderer renderer = new LayeredBarRenderer();
      renderer.setDrawBarOutline(false);
      plot.setRenderer(renderer);
      
      // for this renderer, we need to draw the first series last...
      plot.setRowRenderingOrder(SortOrder.DESCENDING);
      
      // set up gradient paints for series...
      GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 
              0.0f, new Color(0, 0, 64));
      GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 
              0.0f, new Color(0, 64, 0));
      GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 
              0.0f, new Color(64, 0, 0));
      renderer.setSeriesPaint(0, gp0);
      renderer.setSeriesPaint(1, gp1);
      renderer.setSeriesPaint(2, gp2);
renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
setCategorySummary(dataset);
      return chart;
      
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:58,代码来源:LayeredBarChartDemo2.java


示例10: createChart

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
   * Creates a sample chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return The chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
      
      // create the chart...
      JFreeChart chart = ChartFactory.createBarChart(
          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);

      // get a reference to the plot for further customisation...
      CategoryPlot plot = chart.getCategoryPlot();
      plot.setBackgroundPaint(Color.lightGray);
      plot.setDomainGridlinePaint(Color.white);
      plot.setDomainGridlinesVisible(true);
      plot.setRangeGridlinePaint(Color.white);

      // set the range axis to display integers only...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

      // disable bar outlines...
      LayeredBarRenderer renderer = new LayeredBarRenderer();
      renderer.setDrawBarOutline(false);
      plot.setRenderer(renderer);
      
      // for this renderer, we need to draw the first series last...
      plot.setRowRenderingOrder(SortOrder.DESCENDING);
      
      // set up gradient paints for series...
      GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 
              0.0f, new Color(0, 0, 64));
      GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 
              0.0f, new Color(0, 64, 0));
      GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 
              0.0f, new Color(64, 0, 0));
      renderer.setSeriesPaint(0, gp0);
      renderer.setSeriesPaint(1, gp1);
      renderer.setSeriesPaint(2, gp2);
renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
setCategorySummary(dataset);
      return chart;
      
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:58,代码来源:LayeredBarChartDemo1.java


示例11: generateLayeredBarChart

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
private byte[] generateLayeredBarChart (CategoryDataset dataset, int width, int height)
{
	JFreeChart chart = ChartFactory.createBarChart (null, // chart title
			null, // domain axis label
			null, // range axis label
			dataset, // data
			PlotOrientation.VERTICAL, // the plot orientation
			true, // legend
			true, // tooltips
			false // urls
			);

	// 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);

	CategoryPlot plot = (CategoryPlot) chart.getPlot ();

	// disable bar outlines...
	LayeredBarRenderer renderer = new LayeredBarRenderer ();
	renderer.setDrawBarOutline (false);
	renderer.setSeriesBarWidth (0, .6);
	renderer.setSeriesBarWidth (1, .8);
	renderer.setSeriesBarWidth (2, 1.0);
	plot.setRenderer (renderer);

	// for this renderer, we need to draw the first series last...
	plot.setRowRenderingOrder (SortOrder.DESCENDING);

	// set up gradient paints for series...
	GradientPaint gp0 = new GradientPaint (0.0f, 0.0f, Color.blue, 0.0f,
			0.0f, new Color (0, 0, 64));
	GradientPaint gp1 = new GradientPaint (0.0f, 0.0f, Color.green, 0.0f,
			0.0f, new Color (0, 64, 0));
	GradientPaint gp2 = new GradientPaint (0.0f, 0.0f, Color.red, 0.0f,
			0.0f, new Color (64, 0, 0));
	renderer.setSeriesPaint (0, gp0);
	renderer.setSeriesPaint (1, gp1);
	renderer.setSeriesPaint (2, gp2);

	CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis ();
	domainAxis.setCategoryLabelPositions (CategoryLabelPositions.DOWN_45);
	domainAxis.setLowerMargin (0.0);
	domainAxis.setUpperMargin (0.0);

	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,代码行数:62,代码来源:ServerWideReportManagerImpl.java


示例12: testPublicCloneable

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
/**
 * Check that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    LayeredBarRenderer r1 = new LayeredBarRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:LayeredBarRendererTests.java


示例13: customize

import org.jfree.chart.renderer.category.LayeredBarRenderer; //导入依赖的package包/类
@Override
public void customize(JFreeChart chart, ReportParameters reportParameters) {
	CategoryPlot categoryPlot = chart.getCategoryPlot();
	Assert.assertEquals("renderer", LayeredBarRenderer.class, categoryPlot.getRenderer().getClass());
 }
 
开发者ID:svn2github,项目名称:dynamicreports-jasper,代码行数:6,代码来源:LayeredBarChartTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReadableInterval类代码示例发布时间:2022-05-23
下一篇:
Java CellScannable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap