本文整理汇总了Java中org.jfree.chart.LegendItemCollection.getItemCount方法的典型用法代码示例。如果您正苦于以下问题:Java LegendItemCollection.getItemCount方法的具体用法?Java LegendItemCollection.getItemCount怎么用?Java LegendItemCollection.getItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.LegendItemCollection
的用法示例。
在下文中一共展示了LegendItemCollection.getItemCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
}
示例2: 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);
}
}
}
}
示例3: styleChart
import org.jfree.chart.LegendItemCollection; //导入方法依赖的package包/类
/**
* Changes various appearance settings that are common to all the trace
* charts.
*
* @param chart
* A {@link JFreeChart} for which the common trace style is to be
* applied.
* @return A {@link JFreeChart} that has the common trace style.
*/
protected JFreeChart styleChart(JFreeChart chart) {
super.styleChart(chart);
final XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.white);
plot.setRangeGridlinePaint(Color.lightGray);
renderer = new XYLineAndShapeRenderer();
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRenderer(renderer);
LegendItemCollection legendItems = plot.getLegendItems();
for (int i = 0; i < legendItems.getItemCount(); i++) {
int seriesIndex = legendItems.get(i).getSeriesIndex();
renderer.setSeriesLinesVisible(seriesIndex, true);
renderer.setSeriesShapesVisible(seriesIndex, true);
Color seriesColor = (Color) renderer.lookupSeriesPaint(seriesIndex);
colorPalette.add(seriesColor);
}
// Customize the domain axis
final ValueAxis domainAxis = plot.getDomainAxis();
domainAxis.setTickMarksVisible(true);
domainAxis.setAxisLineVisible(true);
domainAxis.setLowerMargin(0.0);
// Customize the range axis
final ValueAxis rangeAxis = plot.getRangeAxis();
rangeAxis.setStandardTickUnits(rangeAxis.getStandardTickUnits());
return chart;
}
示例4: updateColorPalette
import org.jfree.chart.LegendItemCollection; //导入方法依赖的package包/类
/**
* Updates the {@link AbstractChart2D#colorPalette} when the
* {@link CellsInformationTable} has changed.
*/
public void updateColorPalette() {
colorPalette.clear();
LegendItemCollection legendItems = chart.getPlot().getLegendItems();
for(int i=0; i<legendItems.getItemCount(); i++) {
int seriesIndex = legendItems.get(i).getSeriesIndex();
Color seriesColor = (Color) renderer.lookupSeriesPaint(seriesIndex);
colorPalette.add(seriesColor);
}
}
示例5: removeItemFromLegend
import org.jfree.chart.LegendItemCollection; //导入方法依赖的package包/类
protected void removeItemFromLegend(int itemToRemove, JFreeChart chart) {
LegendItemCollection legendItems = chart.getPlot().getLegendItems();
final LegendItemCollection newLegendItems = new LegendItemCollection();
for (int i = 0; i < legendItems.getItemCount(); i++) {
if (itemToRemove != i)
newLegendItems.add(legendItems.get(i));
}
LegendItemSource source = new LegendItemSource() {
@Override
public LegendItemCollection getLegendItems() {
return newLegendItems;
}
};
chart.removeLegend();
chart.addLegend(new LegendTitle(source));
}