use of org.jfree.chart.axis.NumberAxis3D in project sonar-scanner-jenkins by SonarSource.
the class BarChart3D method configureRangeAxis.
private void configureRangeAxis(CategoryPlot plot, String valueLabelSuffix, Font font) {
NumberAxis3D numberAxis = new NumberAxis3D();
numberAxis.setUpperMargin(0.3);
numberAxis.setTickLabelFont(font);
numberAxis.setTickLabelPaint(OUTLINE_COLOR);
String suffix = "";
if (valueLabelSuffix != null && !"".equals(valueLabelSuffix)) {
suffix = new StringBuilder().append("'").append(valueLabelSuffix).append("'").toString();
}
numberAxis.setNumberFormatOverride(new DecimalFormat("0" + suffix));
numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
plot.setRangeAxis(numberAxis);
}
use of org.jfree.chart.axis.NumberAxis3D in project pentaho-platform by pentaho.
the class JFreeChartEngine method createXYSeriesCollectionChart.
private static JFreeChart createXYSeriesCollectionChart(final XYSeriesCollectionChartDefinition chartDefinition) {
JFreeChart chart = null;
// TODO Make the following accessible from the chartDefinition
String domainAxisLabel = null;
String rangeAxisLabel = null;
boolean tooltips = true;
boolean urls = true;
// -----------------------------------------------------------
String title = chartDefinition.getTitle();
boolean legend = chartDefinition.isLegendIncluded();
NumberAxis domainAxis = chartDefinition.isThreeD() ? new NumberAxis3D(domainAxisLabel) : new NumberAxis(domainAxisLabel);
domainAxis.setAutoRangeIncludesZero(chartDefinition.isDomainIncludesZero());
domainAxis.setAutoRangeStickyZero(chartDefinition.isDomainStickyZero());
ValueAxis rangeAxis = new NumberAxis(rangeAxisLabel);
AbstractXYItemRenderer renderer = null;
switch(chartDefinition.getChartType()) {
case LINE_CHART_TYPE:
renderer = chartDefinition.isThreeD() ? new XYLine3DRenderer() : new XYLineAndShapeRenderer(true, false);
((XYLineAndShapeRenderer) renderer).setShapesVisible(chartDefinition.isMarkersVisible());
((XYLineAndShapeRenderer) renderer).setBaseShapesFilled(chartDefinition.isMarkersVisible());
break;
case AREA_CHART_TYPE:
renderer = new XYAreaRenderer();
break;
case STEP_CHART_TYPE:
renderer = new XYStepRenderer();
break;
case STEP_AREA_CHART_TYPE:
renderer = new XYStepAreaRenderer();
break;
case DIFFERENCE_CHART_TYPE:
renderer = new XYDifferenceRenderer();
break;
case DOT_CHART_TYPE:
renderer = new XYDotRenderer();
((XYDotRenderer) renderer).setDotHeight(chartDefinition.getDotHeight());
((XYDotRenderer) renderer).setDotWidth(chartDefinition.getDotWidth());
break;
default:
// should log an error if invalid chart type passed in - at least return null for no renderer
return null;
}
if (renderer != null && legend) {
renderer.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
}
if (tooltips) {
XYToolTipGenerator generator = new StandardXYToolTipGenerator(chartDefinition.getTooltipContent(), new DecimalFormat(chartDefinition.getTooltipXFormat()), new DecimalFormat(chartDefinition.getTooltipYFormat()));
renderer.setToolTipGenerator(generator);
}
if (urls) {
renderer.setURLGenerator(new StandardXYURLGenerator());
}
renderer.setStroke(JFreeChartEngine.getLineStyleStroke(chartDefinition.getLineStyle(), chartDefinition.getLineWidth()));
XYPlot plot = new XYPlot(chartDefinition, domainAxis, rangeAxis, renderer);
JFreeChartEngine.updatePlot(plot, chartDefinition);
chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
use of org.jfree.chart.axis.NumberAxis3D in project pentaho-platform by pentaho.
the class JFreeChartEngine method createXYZSeriesCollectionChart.
/*
* New char types based on the XYZSeriesCollectionChartDefinition
*/
private static JFreeChart createXYZSeriesCollectionChart(final XYZSeriesCollectionChartDefinition chartDefinition) {
JFreeChart chart = null;
// TODO Make the following accessible from the chartDefinition
String domainAxisLabel = null;
String rangeAxisLabel = null;
boolean tooltips = true;
boolean urls = true;
// -----------------------------------------------------------
String title = chartDefinition.getTitle();
boolean legend = chartDefinition.isLegendIncluded();
NumberAxis domainAxis = chartDefinition.isThreeD() ? new NumberAxis3D(domainAxisLabel) : new NumberAxis(domainAxisLabel);
domainAxis.setAutoRangeIncludesZero(chartDefinition.isDomainIncludesZero());
domainAxis.setAutoRangeStickyZero(chartDefinition.isDomainStickyZero());
NumberAxis rangeAxis = new NumberAxis(rangeAxisLabel);
rangeAxis.setAutoRangeIncludesZero(chartDefinition.isRangeIncludesZero());
rangeAxis.setAutoRangeStickyZero(chartDefinition.isRangeStickyZero());
BubbleRenderer renderer = null;
// So far only Bubble charts are supported
switch(chartDefinition.getChartType()) {
case BUBBLE_CHART_TYPE:
renderer = new BubbleRenderer();
break;
default:
// should log an error if invalid chart type passed in - at least return null for no renderer
return null;
}
if (tooltips) {
// creating the label definition
renderer.setToolTipGenerator(new StandardXYZToolTipGenerator(chartDefinition.getBubbleLabelContent(), chartDefinition.getXFormat(), chartDefinition.getYFormat(), chartDefinition.getZFormat()));
}
if (urls) {
renderer.setURLGenerator(new StandardBubbleURLGenerator());
}
renderer.setMaxSize(chartDefinition.getMaxBubbleSize());
renderer.setMaxZ(chartDefinition.getMaxZValue());
XYPlot plot = new XYPlot(chartDefinition, domainAxis, rangeAxis, renderer);
JFreeChartEngine.updatePlot(plot, chartDefinition);
chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
Aggregations