本文整理汇总了Java中org.jfree.chart.axis.CategoryLabelPositions.STANDARD属性的典型用法代码示例。如果您正苦于以下问题:Java CategoryLabelPositions.STANDARD属性的具体用法?Java CategoryLabelPositions.STANDARD怎么用?Java CategoryLabelPositions.STANDARD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.chart.axis.CategoryLabelPositions
的用法示例。
在下文中一共展示了CategoryLabelPositions.STANDARD属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCategoryLabelPosition
public static CategoryLabelPositions getCategoryLabelPosition(double angle)
{
if (angle == 0.0) return CategoryLabelPositions.STANDARD;
if (angle > 0.0 && angle < 1.0) return CategoryLabelPositions.UP_45;
if (angle >= 1.0) return CategoryLabelPositions.UP_90;
if (angle < 0.0 && angle > -1.0) return CategoryLabelPositions.DOWN_45;
if (angle <= -1.0) return CategoryLabelPositions.DOWN_90;
return CategoryLabelPositions.STANDARD;
}
示例2: createChartFromQuery
/**
* Creates a JFreeChart based on the current query results produced by the
* given chart.
*
* @param c
* The chart from which to produce a JFreeChart component. Must
* not be null.
* @return A chart based on the data and settings in the given chart, or
* null if the given chart is not sufficiently configured (for
* example, if its type is not set) or it is currently unable to
* produce a result set.
*/
public static JFreeChart createChartFromQuery(Chart c) throws SQLException, QueryInitializationException, InterruptedException {
logger.debug("Creating JFreeChart for Wabit chart " + c);
ChartType chartType = c.getType();
if (chartType == null) {
logger.debug("Returning null (chart's type is not set)");
return null;
}
final JFreeChart chart;
if (chartType.getDatasetType().equals(DatasetType.CATEGORY)) {
JFreeChart categoryChart = createCategoryChart(c);
logger.debug("Made a new category chart: " + categoryChart);
if (categoryChart != null && categoryChart.getPlot() instanceof CategoryPlot) {
double rotationRads = Math.toRadians(c.getXAxisLabelRotation());
CategoryLabelPositions clp;
if (Math.abs(rotationRads) < 0.05) {
clp = CategoryLabelPositions.STANDARD;
} else if (rotationRads < 0) {
clp = CategoryLabelPositions.createUpRotationLabelPositions(-rotationRads);
} else {
clp = CategoryLabelPositions.createDownRotationLabelPositions(rotationRads);
}
CategoryAxis domainAxis = categoryChart.getCategoryPlot().getDomainAxis();
domainAxis.setMaximumCategoryLabelLines(5);
domainAxis.setCategoryLabelPositions(clp);
}
chart = categoryChart;
} else if (chartType.getDatasetType().equals(DatasetType.XY)) {
JFreeChart xyChart = createXYChart(c);
logger.debug("Made a new XY chart: " + xyChart);
chart = xyChart;
} else {
throw new IllegalStateException(
"Unknown chart dataset type " + chartType.getDatasetType());
}
if (chart != null) {
makeChartNice(chart);
}
return chart;
}
示例3: CategoryLabelConfig
public CategoryLabelConfig(Font font, double marginTop, double marginBottom) {
this(CategoryLabelPositions.STANDARD, font, Color.black, marginTop, marginBottom,
Border.NONE, null, null, null, false);
}