本文整理汇总了Java中org.jfree.chart.axis.CategoryLabelPositions类的典型用法代码示例。如果您正苦于以下问题:Java CategoryLabelPositions类的具体用法?Java CategoryLabelPositions怎么用?Java CategoryLabelPositions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CategoryLabelPositions类属于org.jfree.chart.axis包,在下文中一共展示了CategoryLabelPositions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCategoryDomainAxis
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
public static CategoryAxis createCategoryDomainAxis(PlotConfiguration plotConfiguration) {
CategoryAxis domainAxis = new CategoryAxis(null);
String label = plotConfiguration.getDomainConfigManager().getLabel();
if (label == null) {
label = I18N.getGUILabel("plotter.unnamed_value_label");
}
domainAxis.setLabel(label);
Font axesFont = plotConfiguration.getAxesFont();
if (axesFont != null) {
domainAxis.setLabelFont(axesFont);
domainAxis.setTickLabelFont(axesFont);
}
// rotate labels
if (plotConfiguration.getOrientation() != PlotOrientation.HORIZONTAL) {
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d));
}
formatAxis(plotConfiguration, domainAxis);
return domainAxis;
}
示例2: testEquals
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
/**
* Problem equals method.
*/
public void testEquals() {
CategoryLabelPositions p1 = new CategoryLabelPositions(
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER)
);
CategoryLabelPositions p2 = new CategoryLabelPositions(
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER)
);
assertEquals(p1, p2);
}
示例3: testHashCode
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
CategoryLabelPositions p1 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER)
);
CategoryLabelPositions p2 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER)
);
assertTrue(p1.equals(p2));
int h1 = p1.hashCode();
int h2 = p2.hashCode();
assertEquals(h1, h2);
}
示例4: createTestResultsChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
/**
* Test results chart.
*
* @param stats SortedMap with dates as keys and
* TestStatistics as value.
* @param categoryLabel - label to place on X axis.
* @param out OutputStream to write image to.
*/
public static void createTestResultsChart(final SortedMap stats, final String categoryLabel,
final String dateFormat, final OutputStream out) throws IOException {
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
final Map.Entry entry = (Map.Entry) iter.next();
final Date date = (Date) entry.getKey();
final TestStatistics tst = (TestStatistics) entry.getValue();
if (tst.getTotalTests() == 0) continue; // skip no-test values
final String dateAsString = StringUtils.formatDate(date, dateFormat);
dataset.addValue(new Integer(tst.getAverageFailedTests()), CAPTION_FAILED_TESTS, dateAsString);
dataset.addValue(new Integer(tst.getAverageErrorTests()), CAPTION_ERROR_TESTS, dateAsString);
dataset.addValue(new Integer(tst.getAverageSuccessfulTests()), CAPTION_SUCCESSFUL_TESTS, dateAsString);
}
// create the chart object
createTestsResultsChartHelper(categoryLabel, dataset, out, CategoryLabelPositions.UP_45);
}
示例5: getJFreeChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
@Override
public JFreeChart getJFreeChart( String name, PlotOrientation orientation, CategoryLabelPositions labelPositions,
Map<String, Double> categoryValues )
{
DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
for ( Entry<String, Double> entry : categoryValues.entrySet() )
{
dataSet.addValue( entry.getValue(), name, entry.getKey() );
}
CategoryPlot plot = getCategoryPlot( dataSet, getBarRenderer(), orientation, labelPositions );
JFreeChart jFreeChart = getBasicJFreeChart( plot );
jFreeChart.setTitle( name );
return jFreeChart;
}
示例6: getStackedAreaChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
private JFreeChart getStackedAreaChart( BaseChart chart, CategoryDataset dataSet )
{
JFreeChart stackedAreaChart = ChartFactory.createStackedAreaChart( chart.getName(), chart.getDomainAxisLabel(),
chart.getRangeAxisLabel(), dataSet, PlotOrientation.VERTICAL, !chart.isHideLegend(), false, false );
setBasicConfig( stackedAreaChart, chart );
CategoryPlot plot = (CategoryPlot) stackedAreaChart.getPlot();
plot.setOrientation( PlotOrientation.VERTICAL );
plot.setRenderer( getStackedAreaRenderer() );
CategoryAxis xAxis = plot.getDomainAxis();
xAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
xAxis.setLabelFont( LABEL_FONT );
return stackedAreaChart;
}
示例7: getStackedBarChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
private JFreeChart getStackedBarChart( BaseChart chart, CategoryDataset dataSet, boolean horizontal )
{
JFreeChart stackedBarChart = ChartFactory.createStackedBarChart( chart.getName(), chart.getDomainAxisLabel(),
chart.getRangeAxisLabel(), dataSet, PlotOrientation.VERTICAL, !chart.isHideLegend(), false, false );
setBasicConfig( stackedBarChart, chart );
CategoryPlot plot = (CategoryPlot) stackedBarChart.getPlot();
plot.setOrientation( horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL );
plot.setRenderer( getStackedBarRenderer() );
CategoryAxis xAxis = plot.getDomainAxis();
xAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
return stackedBarChart;
}
示例8: getOrganisationUnitDistributionChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
@Override
public JFreeChart getOrganisationUnitDistributionChart( OrganisationUnitGroupSet groupSet, OrganisationUnit organisationUnit )
{
Map<String, Double> categoryValues = new HashMap<>();
Grid grid = getOrganisationUnitDistribution( groupSet, organisationUnit, true );
if ( grid == null || grid.getHeight() != 1 )
{
return null;
}
for ( int i = 1; i < grid.getWidth() - 2; i++ ) // Skip name, none and total column
{
categoryValues.put( grid.getHeaders().get( i ).getName(), Double.valueOf( String.valueOf( grid.getRow( 0 ).get( i ) ) ) );
}
String title = groupSet.getName() + TITLE_SEP + organisationUnit.getName();
JFreeChart chart = chartService.getJFreeChart( title, PlotOrientation.VERTICAL, CategoryLabelPositions.DOWN_45, categoryValues );
return chart;
}
示例9: getStackedBarChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
private JFreeChart getStackedBarChart( BaseChart chart, CategoryDataset dataSet, boolean horizontal )
{
JFreeChart stackedBarChart = ChartFactory.createStackedBarChart( chart.getName(), chart.getDomainAxisLabel(),
chart.getRangeAxisLabel(), dataSet, PlotOrientation.VERTICAL, !chart.isHideLegend(), false, false );
setBasicConfig( stackedBarChart, chart );
CategoryPlot plot = (CategoryPlot) stackedBarChart.getPlot();
plot.setOrientation( horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL );
plot.setRenderer( getStackedBarRenderer() );
CategoryAxis xAxis = plot.getDomainAxis();
xAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
return stackedBarChart;
}
示例10: createGraph
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
@Override
protected JFreeChart createGraph() {
final JFreeChart chart = ChartFactory.createLineChart(null, "Build Number #", this.yLabel, this.dataset, PlotOrientation.VERTICAL, true, true, true);
chart.setBackgroundPaint(Color.WHITE);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
CategoryAxis domainAxis = new CategoryAxis();
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
domainAxis.setCategoryMargin(0.0);
plot.setDomainAxis(domainAxis);
plot.setBackgroundPaint(Color.WHITE);
ValueAxis yAxis = plot.getRangeAxis();
yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
//yAxis.setRange(0.0, 100.0);
URLAndTooltipRenderer urlRenderer = new URLAndTooltipRenderer(this.project.getProject());
ColorPalette.apply(urlRenderer);
plot.setRenderer(urlRenderer);
return chart;
}
示例11: testHashCode
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
CategoryLabelPositions p1 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
CategoryLabelPositions p2 = new CategoryLabelPositions(
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER),
new CategoryLabelPosition(RA_TOP, TextBlockAnchor.CENTER));
assertTrue(p1.equals(p2));
int h1 = p1.hashCode();
int h2 = p2.hashCode();
assertEquals(h1, h2);
}
示例12: configureAxes
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
/** Configures display of domain and range axes */
private void configureAxes(CategoryPlot plot) {
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setAutoRangeIncludesZero(includeZero);
if (integerRange) {
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
}
rangeAxis.setUpperMargin(0.15);
rangeAxis.setVisible(rangeAxisVisible);
CategoryAxis domainAxis = plot.getDomainAxis();
if (orientation == EPlotOrientation.HORIZONTAL) {
domainAxis
.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
domainAxis.setMaximumCategoryLabelWidthRatio(.5f);
} else {
domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
}
domainAxis.setVisible(domainAxisVisible);
}
示例13: createChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
public Drawable createChart(ADCDataset dataset) {
final JFreeChart chart = ChartFactory.createBarChart(
dataset.get(Attribute.TITLE),
dataset.get(Attribute.X_AXIS_LABEL),
dataset.get(Attribute.Y_AXIS_LABEL),
dataset,
PlotOrientation.VERTICAL,
true, false, false);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
ValueAxis raxis = plot.getRangeAxis();
raxis.setRange(0, 100.0);
CategoryAxis cAxis = plot.getDomainAxis();
cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
BarRenderer renderer = (BarRenderer)plot.getRenderer();
renderer.setSeriesPaint(0, Colors.fromHex("#0AA1D8"));
renderer.setSeriesPaint(1, Colors.fromHex("#932832"));
renderer.setSeriesPaint(2, Colors.fromHex("#94BA4D"));
renderer.setBarPainter(new StandardBarPainter());
renderer.setItemMargin(0.01);
return new JFreeChartDrawable(chart, new Dimension(750, 500));
}
示例14: createChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
public static Drawable createChart(ADCDataset dataset, Dimension dimension) {
final JFreeChart chart = ChartFactory.createBarChart(
dataset.get(Attribute.TITLE),// chart title
dataset.get(Attribute.X_AXIS_LABEL),// domain axis label
dataset.get(Attribute.Y_AXIS_LABEL),// range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
false, // tooltips?
false // URLs?
);
chart.setBackgroundPaint(Color.white);
final CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
final BarRenderer renderer = (BarRenderer)plot.getRenderer();
Colors.setSeriesPaint(renderer, dataset.get(Attribute.SERIES_COLORS));
renderer.setItemMargin(0);
renderer.setBarPainter(new StandardBarPainter());
final CategoryAxis cAxis = plot.getDomainAxis();
cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
chart.getTitle().setFont(cAxis.getLabelFont());
chart.getLegend().setMargin(2, 60, 2, 20);
return new JFreeChartDrawable(chart, dimension);
}
示例15: createChart
import org.jfree.chart.axis.CategoryLabelPositions; //导入依赖的package包/类
public static Drawable createChart(final ADSCDataset dataset, ChartType type,
Region region, Dimension dimension) {
JFreeChart chart;
if(region == Region.GBR) {
chart = createChart(rearrange(dataset), type);
CategoryPlot plot = (CategoryPlot)chart.getPlot();
CategoryAxis cAxis = getSubCategoryAxis(dataset);
cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
cAxis.setLabelFont(plot.getRangeAxis().getLabelFont());
cAxis.setTickLabelFont(plot.getRangeAxis().getTickLabelFont());
cAxis.setTickMarksVisible(false);
cAxis.setLabel(dataset.get(Attribute.X_AXIS_LABEL));
plot.setDomainAxis(cAxis);
} else {
chart = createChart(dataset, type);
}
return new JFreeChartDrawable(chart, dimension);
}