Package org.jfree.chart.labels

Examples of org.jfree.chart.labels.StandardCategoryItemLabelGenerator


    {
      renderer.setBaseItemURLGenerator(new FormulaCategoryURLGenerator(getRuntime(), getUrlFormula()));
    }
    if (this.categoricalLabelFormat != null)
    {
      final StandardCategoryItemLabelGenerator scilg;
      if (categoricalLabelDecimalFormat != null)
      {
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat,
            new DecimalFormat(categoricalLabelDecimalFormat));
      }
      else if (categoricalLabelDateFormat != null)
      {
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat,
            new SimpleDateFormat(categoricalLabelDateFormat));
      }
      else
      {
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat, new DecimalFormat());
      }
      renderer.setBaseItemLabelGenerator(scilg);
    }
    renderer.setBaseItemLabelsVisible(Boolean.TRUE.equals(getItemsLabelVisible()));
    if (getItemLabelFont() != null)
View Full Code Here


  /**
   *
   */
  public StandardCategoryItemLabelGenerator getLabelGenerator()
  {
    return labelsMap != null ? new CategoryLabelGenerator(labelsMap) : new StandardCategoryItemLabelGenerator();
  }
View Full Code Here

    SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent();
    ChartSettings chartSettings = chartComponent.getChartSettings();
    SpiderPlot plot = (SpiderPlot)chartComponent.getPlot();
   
    DefaultCategoryDataset dataset = null;
    StandardCategoryItemLabelGenerator labelGenerator = null;
   
    if(FILL_DATASET.equals(datasetType))
    {
      dataset = ((FillSpiderDataset)spiderchartBean.getDataset()).getCustomDataset();
      labelGenerator = ((FillSpiderDataset)spiderchartBean.getDataset()).getLabelGenerator();
    }
    else
    {
      dataset = getSampleDataset();
      labelGenerator = new StandardCategoryItemLabelGenerator();
    }
   
    SpiderWebPlot spiderWebPlot = new SpiderWebPlot(dataset);

        if(plot.getAxisLineColor() != null)
View Full Code Here

        JFreeChart chart = ChartFactory.createBarChart(
                "Best score summary (higher score is better)", "Data", "Score",
                dataset, PlotOrientation.VERTICAL, true, true, false
        );
        CategoryItemRenderer renderer = ((CategoryPlot) chart.getPlot()).getRenderer();
        CategoryItemLabelGenerator generator = new StandardCategoryItemLabelGenerator();
        renderer.setBaseItemLabelGenerator(generator);
        renderer.setBaseItemLabelsVisible(true);
        BufferedImage chartImage = chart.createBufferedImage(1024, 768);
        File chartSummaryFile = new File(solverStatisticFilesDirectory, "summary.png");
        OutputStream out = null;
View Full Code Here

    {
      renderer.setBaseItemURLGenerator(new FormulaCategoryURLGenerator(getRuntime(), getUrlFormula()));
    }
    if (this.categoricalLabelFormat != null)
    {
      final StandardCategoryItemLabelGenerator scilg;
      if (categoricalLabelDecimalFormat != null)
      {
        final DecimalFormat numFormat = new DecimalFormat(categoricalLabelDecimalFormat,
                                                          new DecimalFormatSymbols(getRuntime().getResourceBundleFactory().getLocale()));
        numFormat.setRoundingMode(RoundingMode.HALF_UP);
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat, numFormat);
      }
      else if (categoricalLabelDateFormat != null)
      {
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat,
            new SimpleDateFormat(categoricalLabelDateFormat, getRuntime().getResourceBundleFactory().getLocale()));
      }
      else
      {
        final DecimalFormat formatter = new DecimalFormat();
        formatter.setDecimalFormatSymbols
            (new DecimalFormatSymbols(getRuntime().getResourceBundleFactory().getLocale()));
        scilg = new StandardCategoryItemLabelGenerator(categoricalLabelFormat, formatter);
      }
      renderer.setBaseItemLabelGenerator(scilg);
    }
    renderer.setBaseItemLabelsVisible(Boolean.TRUE.equals(getItemsLabelVisible()));
    if (getItemLabelFont() != null)
View Full Code Here

        BarRenderer renderer = (BarRenderer) ciRenderer;
        renderer.setDrawBarOutline(outline);
        renderer.setItemMargin(itemMargin);

        if (showItemLabels) {
          renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
          renderer.setBaseItemLabelsVisible(true);
          renderer.setBaseItemLabelPaint(itemLabelColor);
          Font font = new Font(fontName,
                    (isBold ? Font.BOLD : 0) + (isItalic ? Font.ITALIC : 0),
                    fontSize);
View Full Code Here

      if (type == SPIDER) {
        AdvancedSpiderWebPlot plot = new AdvancedSpiderWebPlot(dataset);
        chart = new JFreeChart(title, titleFont, plot, groupNames != null);
        if (labelFormat != null) {
          plot.setLabelGenerator(new StandardCategoryItemLabelGenerator(
              labelFormat, NumberFormat.getNumberInstance(), new DecimalFormat(
                  "0.0%")));
        }
        plot.setLabelFont(labelFont);
        if (keys != null) {
          plot.setMaxValue(Double.parseDouble(keys[0]));
        }
      } else {
        if (type == LINE) {
          chart = ChartFactory.createLineChart(title, keys[0], keys[1],
              dataset, PlotOrientation.VERTICAL, groupNames != null, false,
              false);
        } else {
          chart = ChartFactory.createBarChart(title, keys[0], keys[1], dataset,
              type == VBAR ? PlotOrientation.VERTICAL
                  : PlotOrientation.HORIZONTAL, groupNames != null, false,
              false);
        }
        CategoryPlot plot = chart.getCategoryPlot();
        // 设置显示值的数字
        AbstractCategoryItemRenderer renderer = (AbstractCategoryItemRenderer) plot
            .getRenderer();
        if (labelFormat != null) {
          renderer.setBaseItemLabelFont(labelFont);
          renderer.setBaseItemLabelsVisible(true);
          renderer
              .setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        }
        if (type == LINE) {
          // 线条模式设置显示节点图形
          ((LineAndShapeRenderer) renderer).setBaseShapesVisible(true);
        }
View Full Code Here

        r2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{2}",
                NumberFormat.getInstance()));
        assertTrue(r1.equals(r2));

        // itemLabelGenerator
        r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        assertFalse(r1.equals(r2));
        r2.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        assertTrue(r1.equals(r2));

        // itemLabelGeneratorList
        r1.setSeriesItemLabelGenerator(1,
                new StandardCategoryItemLabelGenerator());
        assertFalse(r1.equals(r2));
        r2.setSeriesItemLabelGenerator(1,
                new StandardCategoryItemLabelGenerator());
        assertTrue(r1.equals(r2));

        // baseItemLabelGenerator
        r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
                "{2}", NumberFormat.getInstance()));
        assertFalse(r1.equals(r2));
        r2.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
                "{2}", NumberFormat.getInstance()));
        assertTrue(r1.equals(r2));

        // urlGenerator
        r1.setItemURLGenerator(new StandardCategoryURLGenerator());
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning1() {
        AbstractCategoryItemRenderer r1 = new BarRenderer();
        r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        AbstractCategoryItemRenderer r2 = null;
        try {
            r2 = (BarRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(r1 != r2);
        assertTrue(r1.getClass() == r2.getClass());
        assertTrue(r1.equals(r2));

        r1 = new BarRenderer();
        r1.setSeriesItemLabelGenerator(0,
                new StandardCategoryItemLabelGenerator());
        r2 = null;
        try {
            r2 = (BarRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(r1 != r2);
        assertTrue(r1.getClass() == r2.getClass());
        assertTrue(r1.equals(r2));

        r1 = new BarRenderer();
        r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        r2 = null;
        try {
            r2 = (BarRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        BarRenderer r1 = new BarRenderer();
        r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        r1.setBarPainter(new GradientBarPainter(0.11, 0.22, 0.33));
        BarRenderer r2 = null;
        try {
            r2 = (BarRenderer) r1.clone();
        }
View Full Code Here

TOP

Related Classes of org.jfree.chart.labels.StandardCategoryItemLabelGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.