本文整理匯總了Java中org.jfree.chart.plot.PlotOrientation類的典型用法代碼示例。如果您正苦於以下問題:Java PlotOrientation類的具體用法?Java PlotOrientation怎麽用?Java PlotOrientation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PlotOrientation類屬於org.jfree.chart.plot包,在下文中一共展示了PlotOrientation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
private JFreeChart createChart(XYDataset dataset) {
JFreeChart chart = ChartFactory.createScatterPlot(this.title,
this.xAxisLabel, this.yAxisLable, dataset, PlotOrientation.VERTICAL, true, true, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setNoDataMessage("NO DATA");
XYLineAndShapeRenderer renderer
= (XYLineAndShapeRenderer) plot.getRenderer();
renderer.setSeriesOutlinePaint(0, Color.black);
renderer.setUseOutlinePaint(true);
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setAutoRangeIncludesZero(false);
return chart;
}
示例2: XyChartTab
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Instantiates a new XyChartTab.
* @param model the model
*/
public XyChartTab(XyDataModel model, XyChartEditorJPanel parent){
super(ChartFactory.createXYLineChart(
model.getOntologyModel().getChartSettings().getChartTitle(),
model.getOntologyModel().getChartSettings().getXAxisLabel(),
model.getOntologyModel().getChartSettings().getYAxisLabel(),
((XyChartModel)model.getChartModel()).getXySeriesCollection(),
PlotOrientation.VERTICAL,
true, false, false
), parent);
this.dataModel = model;
this.applySettings();
this.dataModel.getChartModel().addObserver(this);
}
示例3: replaceModel
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
@Override
public void replaceModel(DataModel newModel) {
this.dataModel = newModel;
this.chartPanel.setChart(ChartFactory.createXYLineChart(
dataModel.getOntologyModel().getChartSettings().getChartTitle(),
dataModel.getOntologyModel().getChartSettings().getXAxisLabel(),
dataModel.getOntologyModel().getChartSettings().getYAxisLabel(),
((XyChartModel)dataModel.getChartModel()).getXySeriesCollection(),
PlotOrientation.VERTICAL,
true, false, false
));
this.applySettings();
this.dataModel.getChartModel().addObserver(this);
}
示例4: testFindRangeBounds
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Check that the renderer is calculating the range bounds correctly.
*/
public void testFindRangeBounds() {
TableXYDataset dataset
= RendererXYPackageTests.createTestTableXYDataset();
JFreeChart chart = ChartFactory.createXYLineChart(
"Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
false, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setAutoRangeIncludesZero(false);
Range bounds = rangeAxis.getRange();
assertFalse(bounds.contains(1.0));
assertTrue(bounds.contains(2.0));
assertTrue(bounds.contains(5.0));
assertFalse(bounds.contains(6.0));
}
示例5: createCategoryDomainAxis
import org.jfree.chart.plot.PlotOrientation; //導入依賴的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;
}
示例6: createBarChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Creates the histogram chart.
*
* @return
*/
private JFreeChart createBarChart() {
JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL,
false, false, false);
AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
chart.setBackgroundPaint(null);
chart.setBackgroundImageAlpha(0.0f);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setRangeGridlinesVisible(false);
plot.setDomainGridlinesVisible(false);
plot.setOutlineVisible(false);
plot.setRangeZeroBaselineVisible(false);
plot.setDomainGridlinesVisible(false);
plot.setBackgroundPaint(COLOR_INVISIBLE);
plot.setBackgroundImageAlpha(0.0f);
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL));
renderer.setBarPainter(new StandardBarPainter());
renderer.setDrawBarOutline(true);
renderer.setShadowVisible(false);
return chart;
}
示例7: createHistogramChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Creates the histogram chart.
*
* @param exampleSet
* @return
*/
private JFreeChart createHistogramChart(ExampleSet exampleSet) {
JFreeChart chart = ChartFactory.createHistogram(null, null, null, createHistogramDataset(exampleSet),
PlotOrientation.VERTICAL, false, false, false);
AbstractAttributeStatisticsModel.setDefaultChartFonts(chart);
chart.setBackgroundPaint(null);
chart.setBackgroundImageAlpha(0.0f);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeGridlinesVisible(false);
plot.setDomainGridlinesVisible(false);
plot.setOutlineVisible(false);
plot.setRangeZeroBaselineVisible(false);
plot.setDomainZeroBaselineVisible(false);
plot.setBackgroundPaint(COLOR_INVISIBLE);
plot.setBackgroundImageAlpha(0.0f);
XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NUMERICAL));
renderer.setBarPainter(new StandardXYBarPainter());
renderer.setDrawBarOutline(true);
renderer.setShadowVisible(false);
return chart;
}
示例8: test1654215
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* A test for bug 1654215 (where a renderer is added to the plot without
* a corresponding dataset and it throws an exception at drawing time).
*/
public void test1654215() {
DefaultXYDataset dataset = new DefaultXYDataset();
JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
dataset, PlotOrientation.VERTICAL, true, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(1, new XYLineAndShapeRenderer());
boolean success = false;
try {
BufferedImage image = new BufferedImage(200 , 100,
BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
g2.dispose();
success = true;
}
catch (Exception e) {
e.printStackTrace();
success = false;
}
assertTrue(success);
}
示例9: testAutoRange3
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* A simple test for the auto-range calculation looking at a
* NumberAxis used as the range axis for a CategoryPlot. In this
* case, the 'autoRangeIncludesZero' flag is set to false AND the
* original dataset is replaced with a new dataset.
*/
public void testAutoRange3() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(100.0, "Row 1", "Column 1");
dataset.setValue(200.0, "Row 1", "Column 2");
JFreeChart chart = ChartFactory.createLineChart("Test", "Categories",
"Value", dataset, PlotOrientation.VERTICAL, false, false,
false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setAutoRangeIncludesZero(false);
assertEquals(axis.getLowerBound(), 95.0, EPSILON);
assertEquals(axis.getUpperBound(), 205.0, EPSILON);
// now replacing the dataset should update the axis range...
DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
dataset2.setValue(900.0, "Row 1", "Column 1");
dataset2.setValue(1000.0, "Row 1", "Column 2");
plot.setDataset(dataset2);
assertEquals(axis.getLowerBound(), 895.0, EPSILON);
assertEquals(axis.getUpperBound(), 1005.0, EPSILON);
}
示例10: getChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
@Override
public JFreeChart getChart() throws IOException {
if (chart == null) {
final YIntervalSeriesCollection series_collection = getDataset();
chart = ChartFactory.createXYLineChart(chart_title, "Time through experiment (s)", y_axis_label, series_collection, PlotOrientation.VERTICAL, getDataset().getSeriesCount() > 1, false, false);
final XYErrorRenderer error_renderer = new XYErrorRenderer();
error_renderer.setBaseShapesVisible(false);
error_renderer.setBaseLinesVisible(true);
error_renderer.setDrawYError(false);
final XYPlot plot = chart.getXYPlot();
plot.getRangeAxis().setLowerBound(0);
plot.setRenderer(error_renderer);
PlainChartTheme.applyTheme(chart);
}
return chart;
}
示例11: testDrawWithEmptyDataset
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Test chart drawing with an empty dataset to ensure that this special
* case doesn't cause any exceptions.
*/
public void testDrawWithEmptyDataset() {
boolean success = false;
JFreeChart chart = ChartFactory.createStackedXYAreaChart("title", "x",
"y", new DefaultTableXYDataset(), PlotOrientation.VERTICAL,
true, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(new StackedXYAreaRenderer2());
try {
BufferedImage image = new BufferedImage(200 , 100,
BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
g2.dispose();
success = true;
}
catch (Exception e) {
success = false;
}
assertTrue(success);
}
示例12: createChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Create a horizontal bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
// create a dataset...
XYSeries series1 = new XYSeries("Series 1");
series1.add(1.0, 1.0);
series1.add(2.0, 2.0);
series1.add(3.0, 3.0);
XYDataset dataset = new XYSeriesCollection(series1);
// create the chart...
return ChartFactory.createScatterPlot(
"Scatter Plot", // chart title
"Domain",
"Range",
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);
}
示例13: createChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Create a horizontal bar chart with sample data in the range -3 to +3.
*
* @return The chart.
*/
private static JFreeChart createChart() {
// create a dataset...
XYSeries series1 = new XYSeries("Series 1");
series1.add(1.0, 1.0);
series1.add(2.0, 2.0);
series1.add(3.0, 3.0);
XYDataset dataset = new XYSeriesCollection(series1);
// create the chart...
return ChartFactory.createXYStepChart(
"Step Chart", // chart title
"Domain",
"Range",
dataset, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
}
示例14: createChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return The chart.
*/
private static JFreeChart createChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart(
"Performance: JFreeSVG vs Batik", null /* x-axis label*/,
"Milliseconds" /* y-axis label */, dataset, PlotOrientation.HORIZONTAL,false,false,false);
chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG "
+ "format (lower bars = better performance)"));
chart.setBackgroundPaint(Color.white);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
// ******************************************************************
// More than 150 demo applications are included with the JFreeChart
// Developer Guide...for more information, see:
//
// > http://www.object-refinery.com/jfreechart/guide.html
//
// ******************************************************************
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setDrawBarOutline(false);
// chart.getLegend().setFrame(BlockBorder.NONE);
return chart;
}
示例15: inicializacionJFreeChart
import org.jfree.chart.plot.PlotOrientation; //導入依賴的package包/類
public void inicializacionJFreeChart(String title, String xAxisLabel, String yAxisLabel,
PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {
chart1 = ChartFactory.createXYLineChart(
title, // chart title Titulo local del grafico
xAxisLabel, // x axis label
yAxisLabel, // y axis label
null, // data
orientation,
legend, // include legend
tooltips, // tooltips
urls // urls
);
// get a reference to the plot for further customisation...
plot = chart1.getXYPlot();
}