本文整理匯總了Java中org.jfree.chart.title.LegendTitle.setItemPaint方法的典型用法代碼示例。如果您正苦於以下問題:Java LegendTitle.setItemPaint方法的具體用法?Java LegendTitle.setItemPaint怎麽用?Java LegendTitle.setItemPaint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.title.LegendTitle
的用法示例。
在下文中一共展示了LegendTitle.setItemPaint方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createLegendTitles
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
* Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
* Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
* {@link DimensionConfig} s.
*/
private List<LegendTitle> createLegendTitles() {
List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();
LegendTitle legendTitle = new SmartLegendTitle(this, new FlowArrangement(HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 30, 2), new ColumnArrangement(
HorizontalAlignment.LEFT, VerticalAlignment.CENTER, 0, 2));
legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());
RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
if (position == null) {
return legendTitles;
}
legendTitle.setPosition(position);
if (legendConfiguration.isShowLegendFrame()) {
legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
}
ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
wrapper.add(legendTitle.getItemContainer());
wrapper.setPadding(3, 3, 3, 3);
legendTitle.setWrapper(wrapper);
legendTitles.add(legendTitle);
return legendTitles;
}
示例2: createLegendTitles
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
* Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
* Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
* {@link DimensionConfig} s.
*/
private List<LegendTitle> createLegendTitles() {
List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();
LegendTitle legendTitle = new SmartLegendTitle(this, new FlowArrangement(HorizontalAlignment.CENTER,
VerticalAlignment.CENTER, 30, 2), new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER,
0, 2));
legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());
RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
if (position == null) {
return legendTitles;
}
legendTitle.setPosition(position);
if (legendConfiguration.isShowLegendFrame()) {
legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
}
ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
wrapper.add(legendTitle.getItemContainer());
wrapper.setPadding(3, 3, 3, 3);
legendTitle.setWrapper(wrapper);
legendTitles.add(legendTitle);
return legendTitles;
}
示例3: applyToTitle
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
* Applies the attributes of this theme to the specified title.
*
* @param title the title.
*/
protected void applyToTitle(Title title) {
if (title instanceof TextTitle) {
TextTitle tt = (TextTitle) title;
tt.setFont(this.largeFont);
tt.setPaint(this.subtitlePaint);
}
else if (title instanceof LegendTitle) {
LegendTitle lt = (LegendTitle) title;
if (lt.getBackgroundPaint() != null) {
lt.setBackgroundPaint(this.legendBackgroundPaint);
}
lt.setItemFont(this.regularFont);
lt.setItemPaint(this.legendItemPaint);
if (lt.getWrapper() != null) {
applyToBlockContainer(lt.getWrapper());
}
}
else if (title instanceof PaintScaleLegend) {
PaintScaleLegend psl = (PaintScaleLegend) title;
psl.setBackgroundPaint(this.legendBackgroundPaint);
ValueAxis axis = psl.getAxis();
if (axis != null) {
applyToValueAxis(axis);
}
}
else if (title instanceof CompositeTitle) {
CompositeTitle ct = (CompositeTitle) title;
BlockContainer bc = ct.getContainer();
List blocks = bc.getBlocks();
Iterator iterator = blocks.iterator();
while (iterator.hasNext()) {
Block b = (Block) iterator.next();
if (b instanceof Title) {
applyToTitle((Title) b);
}
}
}
}
示例4: createLegendTitles
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
* Creates {@link LegendTitle}s for all dimensions from the PlotConfiguration of this Plotter2D.
* Expects that all {@link ValueSource} s in the provided PlotConfiguration use the same
* {@link DimensionConfig} s.
*/
private List<LegendTitle> createLegendTitles() {
List<LegendTitle> legendTitles = new LinkedList<LegendTitle>();
LegendConfiguration legendConfiguration = plotInstance.getCurrentPlotConfigurationClone().getLegendConfiguration();
LegendTitle legendTitle = new SmartLegendTitle(this,
new FlowArrangement(HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 30, 2),
new ColumnArrangement(HorizontalAlignment.LEFT, VerticalAlignment.CENTER, 0, 2));
legendTitle.setItemPaint(legendConfiguration.getLegendFontColor());
RectangleEdge position = legendConfiguration.getLegendPosition().getPosition();
if (position == null) {
return legendTitles;
}
legendTitle.setPosition(position);
if (legendConfiguration.isShowLegendFrame()) {
legendTitle.setFrame(new BlockBorder(legendConfiguration.getLegendFrameColor()));
}
ColoredBlockContainer wrapper = new ColoredBlockContainer(legendConfiguration.getLegendBackgroundColor());
wrapper.add(legendTitle.getItemContainer());
wrapper.setPadding(3, 3, 3, 3);
legendTitle.setWrapper(wrapper);
legendTitles.add(legendTitle);
return legendTitles;
}
示例5: setLegend
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private void setLegend(JFreeChart chart, Plot plot, Font font) {
if(!showlegend) return;
Color bg = backgroundcolor==null?databackgroundcolor:backgroundcolor;
if(font==null)font=getFont();
LegendTitle legend = legendMultiLine?
new LegendTitle(plot,new ColumnArrangement(), new ColumnArrangement()):
new LegendTitle(plot);
legend.setBackgroundPaint(bg);
legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
legend.setFrame(new LineBorder());
legend.setPosition(RectangleEdge.BOTTOM);
legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
legend.setWidth(chartwidth-20);// geht nicht
legend.setItemFont(font);
legend.setItemPaint(foregroundcolor);
//RectangleInsets labelPadding;
legend.setItemLabelPadding(new RectangleInsets(2,2,2,2));
legend.setBorder(0,0,0,0);
legend.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
legend.setLegendItemGraphicPadding(new RectangleInsets(8,10,0,0));
chart.addLegend(legend);
}
示例6: setChartLegend
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
protected void setChartLegend(JFreeChart jfreeChart, Integer baseFontSize)
{
//The legend visibility is already taken into account in the jfreeChart object's constructor
LegendTitle legend = jfreeChart.getLegend();
if (legend != null)
{
Font themeLegendFont = getFont((JRFont)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FONT), getChart().getLegendFont(), baseFontSize);
legend.setItemFont(themeLegendFont);
Color legendForecolor = getChart().getOwnLegendColor() != null ?
getChart().getOwnLegendColor() :
(getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FORECOLOR) != null ?
(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FORECOLOR) :
getChart().getLegendColor());
if (legendForecolor != null)
legend.setItemPaint(legendForecolor);
Color legendBackcolor = getChart().getOwnLegendBackgroundColor() != null ?
getChart().getOwnLegendBackgroundColor() :
(getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_BACKCOLOR) != null ?
(Color)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_BACKCOLOR) :
getChart().getLegendBackgroundColor());
if (legendBackcolor != null)
legend.setBackgroundPaint(legendBackcolor);
BlockFrame frame = (BlockFrame)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_FRAME);
if (frame != null)
legend.setFrame(frame);
HorizontalAlignment defaultLegendHAlignment = (HorizontalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_HORIZONTAL_ALIGNMENT);
if (defaultLegendHAlignment != null)
legend.setHorizontalAlignment(defaultLegendHAlignment);
VerticalAlignment defaultLegendVAlignment = (VerticalAlignment)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_VERTICAL_ALIGNMENT);
if (defaultLegendVAlignment != null)
legend.setVerticalAlignment(defaultLegendVAlignment);
RectangleInsets defaultLegendPadding = (RectangleInsets)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_PADDING);
RectangleInsets legendPadding = legend.getPadding() != null ? legend.getPadding() : defaultLegendPadding;
if (legendPadding != null)
legend.setPadding(legendPadding);
RectangleEdge defaultLegendPosition = (RectangleEdge)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.LEGEND_POSITION);
if (getEdge(getChart().getLegendPositionValue(), defaultLegendPosition) != null)
legend.setPosition(getEdge(getChart().getLegendPositionValue(), defaultLegendPosition));
}
}
示例7: configureChart
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
/**
*
*/
protected void configureChart(JFreeChart jfreeChart) throws JRException
{
if (getChart().getModeValue() == ModeEnum.OPAQUE)
{
jfreeChart.setBackgroundPaint(getChart().getBackcolor());
}
else
{
jfreeChart.setBackgroundPaint(null);
}
RectangleEdge titleEdge = getEdge(getChart().getTitlePositionValue(), RectangleEdge.TOP);
if (jfreeChart.getTitle() != null)
{
TextTitle title = jfreeChart.getTitle();
title.setPaint(getChart().getTitleColor());
title.setFont(fontUtil.getAwtFont(getFont(getChart().getTitleFont()), getLocale()));
title.setPosition(titleEdge);
}
String subtitleText = evaluateTextExpression(getChart().getSubtitleExpression());
if (subtitleText != null)
{
TextTitle subtitle = new TextTitle(subtitleText);
subtitle.setPaint(getChart().getSubtitleColor());
subtitle.setFont(fontUtil.getAwtFont(getFont(getChart().getSubtitleFont()), getLocale()));
subtitle.setPosition(titleEdge);
jfreeChart.addSubtitle(subtitle);
}
// Apply all of the legend formatting options
LegendTitle legend = jfreeChart.getLegend();
if (legend != null)
{
legend.setItemPaint(getChart().getLegendColor());
if (getChart().getOwnLegendBackgroundColor() == null)// in a way, legend backcolor inheritance from chart is useless
{
legend.setBackgroundPaint(null);
}
else
{
legend.setBackgroundPaint(getChart().getLegendBackgroundColor());
}
legend.setItemFont(fontUtil.getAwtFont(getFont(getChart().getLegendFont()), getLocale()));
legend.setPosition(getEdge(getChart().getLegendPositionValue(), RectangleEdge.BOTTOM));
}
configurePlot(jfreeChart.getPlot());
}
示例8: setLegend
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
private void setLegend(JFreeChart chart, boolean bShowLegend, Font font, Color foregroundColor, Color backgroundColor, cfCHARTLEGENDData legendData) throws cfmRunTimeException {
LegendTitle legend = new LegendTitle(chart.getPlot());
legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
// If a CFCHARTLEGEND tag was used then use it's attributes to configure the
// legend
if (legendData != null) {
// A CFCHARTLEGEND tag is present so use its attributes to configure the
// legend
legend.setItemFont(getFont(legendData.getFont(), legendData.getFontBold(), legendData.getFontItalic(), legendData.getFontSize()));
legend.setItemPaint(convertStringToColor(legendData.getLabelColor()));
legend.setBackgroundPaint(convertStringToColor(legendData.getBackgroundColor()));
String pos = legendData.getPosition();
if (pos.equals("top"))
legend.setPosition(RectangleEdge.TOP);
else if (pos.equals("bottom"))
legend.setPosition(RectangleEdge.BOTTOM);
else if (pos.equals("left"))
legend.setPosition(RectangleEdge.LEFT);
else if (pos.equals("right"))
legend.setPosition(RectangleEdge.RIGHT);
if (!legendData.getShowBorder())
legend.setBorder(BlockBorder.NONE);
else
legend.setBorder(new BlockBorder());
} else {
// A CFCHARTLEGEND tag is NOT present so use the attributes from the
// CFCHART tag to configure the legend
if (!bShowLegend)
return;
legend.setItemFont(font);
legend.setItemPaint(foregroundColor);
legend.setBackgroundPaint(backgroundColor);
// By default CFMX 7 places the legend at the top with no border
legend.setPosition(RectangleEdge.TOP);
legend.setBorder(BlockBorder.NONE);
}
// Add the legend to the chart
chart.addSubtitle(legend);
}
示例9: formatLegend
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
protected void formatLegend(LegendTitle legend) {
legend.setBackgroundPaint(format.getBackgroundColor());
legend.setItemPaint(format.getForeColor());
legend.setPosition(format.getLegendPosition());
}
示例10: formatLegend
import org.jfree.chart.title.LegendTitle; //導入方法依賴的package包/類
protected void formatLegend(LegendTitle legend) {
legend.setBackgroundPaint(format.getBackgroundColor());
legend.setItemPaint(format.getForeColor());
}