本文整理汇总了Java中org.jfree.chart.renderer.category.StackedBarRenderer.setBarPainter方法的典型用法代码示例。如果您正苦于以下问题:Java StackedBarRenderer.setBarPainter方法的具体用法?Java StackedBarRenderer.setBarPainter怎么用?Java StackedBarRenderer.setBarPainter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.category.StackedBarRenderer
的用法示例。
在下文中一共展示了StackedBarRenderer.setBarPainter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makePlot
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入方法依赖的package包/类
@Override
protected Plot makePlot(final JFreeChartBuilder.PlotParameters parameters) {
final DefaultKeyedValues2DDataset tmpDataset = this.getDataset();
final CategoryAxis tmpCategoryAxis = this.makeCategoryAxis(domain);
final ValueAxis tmpValueAxis = this.makeValueAxis(range);
final StackedBarRenderer tmpRenderer = new StackedBarRenderer();
tmpRenderer.setBarPainter(new StandardBarPainter());
tmpRenderer.setShadowVisible(false);
if (this.isTooltips()) {
tmpRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
}
if (this.isUrls()) {
tmpRenderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
}
this.setColours(tmpRenderer, tmpDataset);
final CategoryPlot retVal = new CategoryPlot(tmpDataset, tmpCategoryAxis, tmpValueAxis, tmpRenderer);
retVal.setOrientation(parameters.getOrientation());
retVal.setBackgroundPaint(parameters.getBackground());
retVal.setOutlinePaint(parameters.getOutline());
return retVal;
}
示例2: createChart
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入方法依赖的package包/类
/**
* Creates the chart with the data from the given data set.
*
* @param dataset the data to plot.
* @return the chart.
*/
private static JFreeChart createChart(final CategoryDataset dataset) {
final JFreeChart chart = ChartFactory.createStackedBarChart("", "", "", dataset, PlotOrientation.VERTICAL, false, true, false);
StackedBarRenderer renderer = new StackedBarRenderer(true);
renderer.setShadowVisible(false);
renderer.setBarPainter(new StandardBarPainter()); // Remove shine
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
CategoryPlot plot = chart.getCategoryPlot();
plot.setRenderer(renderer);
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(new Color(192, 192, 192));
plot.getDomainAxis().setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
plot.getDomainAxis().setVisible(false);
plot.getRangeAxis().setVisible(false);
plot.getDomainAxis().setLowerMargin(.025);
plot.getDomainAxis().setUpperMargin(.025);
chart.setBackgroundPaint(new Color(214, 217, 233, 30));
return chart;
}
示例3: createChart
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入方法依赖的package包/类
/**
* Creates a chart when given a data set.
*
* @param dataset to be plotted.
* @return the created chart.
*/
private static JFreeChart createChart(final CategoryDataset dataset) {
final JFreeChart chart = ChartFactory.createStackedBarChart("", "", "", dataset, PlotOrientation.HORIZONTAL, false, true, false);
chart.setPadding(RectangleInsets.ZERO_INSETS);
chart.setBorderVisible(false);
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setBarPainter(new StandardBarPainter()); // Remove shine
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
renderer.setShadowVisible(false);
CategoryPlot plot = chart.getCategoryPlot();
plot.setRenderer(renderer);
// plot.setBackgroundAlpha(0.0f);
plot.setDomainGridlinesVisible(false);
plot.setRangeGridlinesVisible(false);
plot.getRangeAxis().setVisible(false);
plot.getRangeAxis().setLowerMargin(0);
plot.getRangeAxis().setUpperMargin(0);
plot.getDomainAxis().setVisible(false);
plot.getDomainAxis().setLowerMargin(0);
plot.getDomainAxis().setUpperMargin(0);
return chart;
}
示例4: makeSequenceLogo
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入方法依赖的package包/类
/**
* Creates the logo instance
*/
private void makeSequenceLogo()
{
CategoryDataset dataSet = prepareData();
chart = ChartFactory.createStackedBarChart(
null,
"",
this.asBit ? "Bit Score" : "Frequency",
dataSet,
PlotOrientation.VERTICAL,
false,
true,
false
);
//set modified painter
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setBarPainter(new LogoBarPainter(letter_matrix));
chart.getCategoryPlot().setRenderer(renderer);
//disable shadows
renderer.setShadowVisible(false);
CategoryPlot plot = chart.getCategoryPlot();
//space between bars
plot.getDomainAxis().setCategoryMargin(0.05);
plot.getDomainAxis().setLowerMargin(0.01);
plot.getDomainAxis().setUpperMargin(0.01);
//paint outlines around letters
renderer.setDrawBarOutline(false);
//background, transparent
plot.setBackgroundPaint(null);
plot.setBackgroundAlpha(0.0f);
chart.setBackgroundPaint(null);
//remove horizontal lines
plot.setDomainGridlinesVisible(false);
plot.setRangeGridlinesVisible(false);
//disable border
plot.setOutlineVisible(false);
//rotate category axis 45 degrees, but only for context
if (letters == contexts)
{
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
}
//y axis ticks
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setTickUnit(new NumberTickUnit(1));
//ranges
if (this.asBit)
{
plot.getRangeAxis().setRange(0, 2);
}
else
{
plot.getRangeAxis().setRange(0, 1);
}
}
示例5: getRawLogoPanel
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入方法依赖的package包/类
public ChartPanel getRawLogoPanel()
{
CategoryDataset dataSet = prepareData();
JFreeChart rawchart = ChartFactory.createStackedBarChart(
null,
"",
null,
dataSet,
PlotOrientation.VERTICAL,
false,
true,
false
);
//set modified painter
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setBarPainter(new LogoBarPainter(letter_matrix));
rawchart.getCategoryPlot().setRenderer(renderer);
//disable shadows
renderer.setShadowVisible(false);
CategoryPlot plot = rawchart.getCategoryPlot();
//space between bars
plot.getDomainAxis().setCategoryMargin(0.05);
plot.getDomainAxis().setLowerMargin(0.01);
plot.getDomainAxis().setUpperMargin(0.01);
//paint outlines around letters
renderer.setDrawBarOutline(false);
//background, transparent
plot.setBackgroundPaint(null);
plot.setBackgroundAlpha(0.0f);
rawchart.setBackgroundPaint(null);
//disable border
plot.setOutlineVisible(false);
//remove axis ticks
plot.getRangeAxis().setVisible(false);
plot.getDomainAxis().setVisible(false);
//ranges
if (this.asBit)
{
plot.getRangeAxis().setRange(0, 2);
}
else
{
plot.getRangeAxis().setRange(0, 1);
}
return new ChartPanel(rawchart);
}
示例6: getSummaryLogoPanel
import org.jfree.chart.renderer.category.StackedBarRenderer; //导入方法依赖的package包/类
public ChartPanel getSummaryLogoPanel()
{
CategoryDataset dataSet = prepareData();
JFreeChart rawchart = ChartFactory.createStackedBarChart(
null,
"",
null,
dataSet,
PlotOrientation.VERTICAL,
false,
true,
false
);
//set modified painter
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setBarPainter(new LogoBarPainter(letter_matrix));
rawchart.getCategoryPlot().setRenderer(renderer);
//disable shadows
renderer.setShadowVisible(false);
CategoryPlot plot = rawchart.getCategoryPlot();
//space between bars
plot.getDomainAxis().setCategoryMargin(0.05);
plot.getDomainAxis().setLowerMargin(0.01);
plot.getDomainAxis().setUpperMargin(0.01);
//remove horizontal lines
plot.setDomainGridlinesVisible(false);
plot.setRangeGridlinesVisible(false);
//paint outlines around letters
renderer.setDrawBarOutline(false);
//background, transparent
plot.setBackgroundPaint(null);
plot.setBackgroundAlpha(0.0f);
rawchart.setBackgroundPaint(null);
//disable border
plot.setOutlineVisible(false);
//axis ticks
plot.getRangeAxis().setVisible(true);
plot.getDomainAxis().setVisible(true);
//ranges
if (this.asBit)
{
plot.getRangeAxis().setRange(0, 2);
}
else
{
plot.getRangeAxis().setRange(0, 1);
}
return new ChartPanel(rawchart);
}