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


Java CategoryMarker.setLabelTextAnchor方法代码示例

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


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

示例1: setMarkers

import org.jfree.chart.plot.CategoryMarker; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private void setMarkers(final CategoryPlot plot, final Map params) {
    final Marker[] domainMarkers = (Marker[]) params.get("domainMarkers");
    // this method may be extended for range markers in future.
    if (domainMarkers != null && domainMarkers.length > 0) {
        for (final Marker marker : domainMarkers) {
            final CategoryMarker cmarker = (CategoryMarker) marker;
            cmarker.setDrawAsLine(true);
            if (cmarker.getLabel() != null) {
                cmarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
                cmarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
            }
            plot.addDomainMarker(cmarker);
        }
    }
}
 
开发者ID:mateli,项目名称:OpenCyclos,代码行数:17,代码来源:ChartPostProcessorImpl.java

示例2: createChart

import org.jfree.chart.plot.CategoryMarker; //导入方法依赖的package包/类
/**
   * Creates a sample chart.
   * 
   * @param dataset  the dataset.
   * 
   * @return a sample chart.
   */
  protected JFreeChart createChart(CategoryDataset dataset) {
  
      JFreeChart chart = ChartFactory.createBarChart(
          chartTitle,       // chart title
          domainLabel,               // domain axis label
          rangeLabel,                  // range axis label
          dataset,                  // data
          PlotOrientation.VERTICAL, // the plot orientation
          !legendPanelOn,                    // include legend
          true,
          false
      );

      chart.setBackgroundPaint(Color.lightGray);

      // get a reference to the plot for further customisation...
      CategoryPlot plot = (CategoryPlot) chart.getPlot();
      plot.setNoDataMessage("NO DATA!");

      CategoryItemRenderer renderer = new CustomBarRenderer(
          new Paint[] {Color.red, Color.blue, Color.green,
              Color.yellow, Color.orange, Color.cyan,
              Color.magenta, Color.blue}
      );
      renderer.setBaseItemLabelGenerator(
          new StandardCategoryItemLabelGenerator()
      );
      renderer.setBaseItemLabelsVisible(true);
      ItemLabelPosition p = new ItemLabelPosition(
          ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 45.0
      );
      renderer.setBasePositiveItemLabelPosition(p);
      plot.setRenderer(renderer);

      CategoryMarker marker = new CategoryMarker("Category 3");
      marker.setLabel("Special");
      marker.setPaint(new Color(0xDD, 0xFF, 0xDD, 0x80));
      marker.setAlpha(0.5f);
      marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
      marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
      marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT);
      plot.addDomainMarker(marker, Layer.BACKGROUND);
      
      // change the margin at the top of the range axis...
      NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
      rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
      rangeAxis.setLowerMargin(0.15);
      rangeAxis.setUpperMargin(0.15);

      BarRenderer seriesRenderer = (BarRenderer) plot.getRenderer();
seriesRenderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

setCategorySummary(dataset);
      return chart;

  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:64,代码来源:BarChartDemo3.java

示例3: addDomainMarker

import org.jfree.chart.plot.CategoryMarker; //导入方法依赖的package包/类
public void addDomainMarker(CategoryPlot plot, cfCHARTDOMAINMARKERData dmData) throws cfmRunTimeException {
	CategoryMarker domainMarker = new CategoryMarker(dmData.getValue());
	boolean drawAsLine = false;
	if (dmData.getShape().equals("line"))
		drawAsLine = true;
	domainMarker.setDrawAsLine(drawAsLine);
	domainMarker.setPaint(convertStringToColor(dmData.getColor()));
	if (dmData.getLabel() != null) {
		domainMarker.setLabel(dmData.getLabel());
		domainMarker.setLabelPaint(convertStringToColor(dmData.getLabelColor()));
		String labelPos = dmData.getLabelPosition();
		if (labelPos.equals("top_left")) {
			domainMarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
		} else if (labelPos.equals("top")) {
			domainMarker.setLabelAnchor(RectangleAnchor.TOP);
			domainMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER);
		} else if (labelPos.equals("top_right")) {
			domainMarker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
		} else if (labelPos.equals("left")) {
			domainMarker.setLabelAnchor(RectangleAnchor.LEFT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_RIGHT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
		} else if (labelPos.equals("center")) {
			domainMarker.setLabelAnchor(RectangleAnchor.CENTER);
			domainMarker.setLabelTextAnchor(TextAnchor.CENTER);
		} else if (labelPos.equals("right")) {
			domainMarker.setLabelAnchor(RectangleAnchor.RIGHT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_RIGHT);
		} else if (labelPos.equals("bottom_left")) {
			domainMarker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
		} else if (labelPos.equals("bottom")) {
			domainMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
			domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_CENTER);
		} else if (labelPos.equals("bottom_right")) {
			domainMarker.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
		}
		domainMarker.setLabelOffsetType(LengthAdjustmentType.NO_CHANGE);
		domainMarker.setLabelFont(getFont(dmData.getFont(), dmData.getFontBold(), dmData.getFontItalic(), dmData.getFontSize()));
	}
	plot.addDomainMarker(domainMarker, Layer.BACKGROUND);
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:63,代码来源:cfCHART.java


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