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


Java LegendItemCollection类代码示例

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


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

示例1: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns a (possibly empty) collection of legend items for the series
 * that this renderer is responsible for drawing.
 *
 * @return The legend item collection (never {@code null}).
 */
@Override
public LegendItemCollection getLegendItems() {
    if (this.plot == null) {
        return new LegendItemCollection();
    }
    LegendItemCollection result = new LegendItemCollection();
    int index = this.plot.getIndexOf(this);
    XYDataset dataset = this.plot.getDataset(index);
    if (dataset != null) {
        int seriesCount = dataset.getSeriesCount();
        for (int i = 0; i < seriesCount; i++) {
            if (isSeriesVisibleInLegend(i)) {
                LegendItem item = getLegendItem(index, i);
                if (item != null) {
                    result.add(item);
                }
            }
        }

    }
    return result;
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:29,代码来源:AbstractXYItemRenderer.java

示例2: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns the legend items for the plot.  Each legend item is generated by the plot's
 * m_Renderer, since the m_Renderer is responsible for the visual representation of the
 * data.
 *
 * @return the legend items.
 */
public LegendItemCollection getLegendItems() {
    LegendItemCollection result = new LegendItemCollection();
   
    // get the legend items for the main m_Dataset...
    if (this.dataset != null) {
        if (this.renderer != null) {
            int seriesCount = this.dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = this.renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }      
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:PolarPlot.java

示例3: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns a collection of legend items for the plot.
 *
 * @return the legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            CategoryPlot plot = (CategoryPlot) iterator.next();
            LegendItemCollection more = plot.getLegendItems();
            result.addAll(more);
        }
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:CombinedRangeCategoryPlot.java

示例4: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns a collection of legend items for the plot.
 *
 * @return the legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            XYPlot plot = (XYPlot) iterator.next();
            LegendItemCollection more = plot.getLegendItems();
            result.addAll(more);
        }
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:CombinedRangeXYPlot.java

示例5: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns a collection of legend items for the plot.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.subplots != null) {
        Iterator iterator = this.subplots.iterator();
        while (iterator.hasNext()) {
            CategoryPlot plot = (CategoryPlot) iterator.next();
            LegendItemCollection more = plot.getLegendItems();
            result.addAll(more);
        }
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:CombinedDomainCategoryPlot.java

示例6: testEquals

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    LegendItemCollection c1 = new LegendItemCollection();
    LegendItemCollection c2 = new LegendItemCollection();
    assertTrue(c1.equals(c2));
    assertTrue(c2.equals(c1));

    LegendItem item1 = new LegendItem("Label", "Description", 
            "ToolTip", "URL", true,  
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), true, Color.red, 
            true, Color.blue, new BasicStroke(1.2f), true, 
            new Line2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(2.1f), Color.green);
    LegendItem item2 = new LegendItem("Label", "Description", 
            "ToolTip", "URL", true, 
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            true, Color.red, true, Color.blue, new BasicStroke(1.2f), true, 
            new Line2D.Double(1.0, 2.0, 3.0, 4.0), new BasicStroke(2.1f), 
            Color.green);
    c1.add(item1);
    c2.add(item2);
    assertTrue(c1.equals(c2));
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:LegendItemCollectionTests.java

示例7: fetchLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Fetches the latest legend items.
 */
protected void fetchLegendItems() {
    this.items.clear();
    RectangleEdge p = getPosition();
    if (RectangleEdge.isTopOrBottom(p)) {
        this.items.setArrangement(this.hLayout);   
    }
    else {
        this.items.setArrangement(this.vLayout);   
    }
    for (int s = 0; s < this.sources.length; s++) {
        LegendItemCollection legendItems = this.sources[s].getLegendItems();
        if (legendItems != null) {
            for (int i = 0; i < legendItems.getItemCount(); i++) {
                LegendItem item = legendItems.get(i);
                Block block = createLegendItemBlock(item);
                this.items.add(block);
            }
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:LegendTitle.java

示例8: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns a (possibly empty) collection of legend items for the series
 * that this renderer is responsible for drawing.
 *
 * @return The legend item collection (never <code>null</code>).
 */
public LegendItemCollection getLegendItems() {
    if (this.plot == null) {
        return new LegendItemCollection();
    }
    LegendItemCollection result = new LegendItemCollection();
    int index = this.plot.getIndexOf(this);
    XYDataset dataset = this.plot.getDataset(index);
    if (dataset != null) {
        int seriesCount = dataset.getSeriesCount();
        for (int i = 0; i < seriesCount; i++) {
            if (isSeriesVisibleInLegend(i)) {
                LegendItem item = getLegendItem(index, i);
                if (item != null) {
                    result.add(item);
                }
            }
        }

    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:AbstractXYItemRenderer.java

示例9: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns a (possibly empty) collection of legend items for the series
 * that this renderer is responsible for drawing.
 *
 * @return The legend item collection (never <code>null</code>).
 *
 * @see #getLegendItem(int, int)
 */
public LegendItemCollection getLegendItems() {
    if (this.plot == null) {
        return new LegendItemCollection();
    }
    LegendItemCollection result = new LegendItemCollection();
    int index = this.plot.getIndexOf(this);
    CategoryDataset dataset = this.plot.getDataset(index);
    if (dataset != null) {
        int seriesCount = dataset.getRowCount();
        for (int i = 0; i < seriesCount; i++) {
            if (isSeriesVisibleInLegend(i)) {
                LegendItem item = getLegendItem(index, i);
                if (item != null) {
                    result.add(item);
                }
            }
        }

    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:AbstractCategoryItemRenderer.java

示例10: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns an item for each interval.
 *
 * @return A collection of legend items.
 */
public LegendItemCollection getLegendItems() {
    LegendItemCollection result = new LegendItemCollection();
    Iterator iterator = this.intervals.iterator();
    while (iterator.hasNext()) {
        MeterInterval mi = (MeterInterval) iterator.next();
        Paint color = mi.getBackgroundPaint();
        if (color == null) {
            color = mi.getOutlinePaint();
        }
        LegendItem item = new LegendItem(mi.getLabel(), mi.getLabel(),
                null, null, new Rectangle2D.Double(-4.0, -4.0, 8.0, 8.0), 
                color);
        result.add(item);
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:MeterPlot.java

示例11: getLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Returns the legend items for the plot.  Each legend item is generated by
 * the plot's m_Renderer, since the m_Renderer is responsible for the visual
 * representation of the data.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {
    LegendItemCollection result = new LegendItemCollection();
   
    // get the legend items for the main m_Dataset...
    if (this.dataset != null) {
        if (this.renderer != null) {
            int seriesCount = this.dataset.getSeriesCount();
            for (int i = 0; i < seriesCount; i++) {
                LegendItem item = this.renderer.getLegendItem(i);
                result.add(item);
            }
        }
    }      
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:PolarPlot.java

示例12: updateLegend

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Update legend
 */
private void updateLegend() {
	_chart.removeLegend();
	final LegendTitle legend = new LegendTitle(() -> {
		final LegendItemCollection collection = new LegendItemCollection();
		if (_currentMode == DisplayMode.TIME) {
			collection.add(new LegendItem(Legend.LATENCY.label, null, null, null, new Rectangle(30, 20), Legend.LATENCY.color));
			if (_dnsLookup && _services.isEmbeddedTRAvailable() && !Env.INSTANCE.isUseOSTraceroute()) {
				collection.add(new LegendItem(Legend.DNS.label, null, null, null, new Rectangle(30, 20), Legend.DNS.color));
			}
		} else {
			collection.add(new LegendItem(Legend.DISTANCE.label, Legend.DISTANCE.color));
		}
		return collection;
	});
	legend.setPosition(RectangleEdge.BOTTOM);
	_chart.addLegend(legend);
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:21,代码来源:GanttPanel.java

示例13: test2947660

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * A test that reproduces the problem reported in bug 2947660.
 */
@Test
public void test2947660() {
    AbstractCategoryItemRenderer r = new LineAndShapeRenderer();
    assertNotNull(r.getLegendItems());
    assertEquals(0, r.getLegendItems().getItemCount());

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    CategoryPlot plot = new CategoryPlot();
    plot.setDataset(dataset);
    plot.setRenderer(r);
    assertEquals(0, r.getLegendItems().getItemCount());

    dataset.addValue(1.0, "S1", "C1");
    LegendItemCollection lic = r.getLegendItems();
    assertEquals(1, lic.getItemCount());
    assertEquals("S1", lic.get(0).getLabel());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:21,代码来源:AbstractCategoryItemRendererTest.java

示例14: testGetLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Fetches the legend items and checks the values.
 */
@Test
public void testGetLegendItems() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(35.0, "S1", "C1");
    dataset.addValue(45.0, "S1", "C2");
    dataset.addValue(55.0, "S2", "C1");
    dataset.addValue(15.0, "S2", "C2");
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    JFreeChart chart = new JFreeChart(plot);
    LegendItemCollection legendItems = plot.getLegendItems();
    assertEquals(2, legendItems.getItemCount());
    LegendItem item1 = legendItems.get(0);
    assertEquals("S1", item1.getLabel());
    assertEquals("S1", item1.getSeriesKey());
    assertEquals(0, item1.getSeriesIndex());
    assertEquals(dataset, item1.getDataset());
    assertEquals(0, item1.getDatasetIndex());

    LegendItem item2 = legendItems.get(1);
    assertEquals("S2", item2.getLabel());
    assertEquals("S2", item2.getSeriesKey());
    assertEquals(1, item2.getSeriesIndex());
    assertEquals(dataset, item2.getDataset());
    assertEquals(0, item2.getDatasetIndex());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:29,代码来源:MultiplePiePlotTest.java

示例15: testGetLegendItems

import org.jfree.chart.LegendItemCollection; //导入依赖的package包/类
/**
 * Some checks for the getLegendItems() method.
 */
@Test
public void testGetLegendItems() {
    XYSeriesCollection d = new XYSeriesCollection();
    d.addSeries(new XYSeries("A"));
    d.addSeries(new XYSeries("B"));
    DefaultPolarItemRenderer r = new DefaultPolarItemRenderer();
    PolarPlot plot = new PolarPlot();
    plot.setDataset(d);
    plot.setRenderer(r);
    LegendItemCollection items = plot.getLegendItems();
    assertEquals(2, items.getItemCount());
    LegendItem item1 = items.get(0);
    assertEquals("A", item1.getLabel());
    LegendItem item2 = items.get(1);
    assertEquals("B", item2.getLabel());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:20,代码来源:PolarPlotTest.java


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