本文整理匯總了Java中org.jfree.chart.axis.ValueAxis.setUpperMargin方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueAxis.setUpperMargin方法的具體用法?Java ValueAxis.setUpperMargin怎麽用?Java ValueAxis.setUpperMargin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.axis.ValueAxis
的用法示例。
在下文中一共展示了ValueAxis.setUpperMargin方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: plotSeperate
import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
private void plotSeperate(XYDataset dataset, String p)
{
NumberAxis rangeAxis1 = new NumberAxis(p);
rangeAxis1.setAutoRangeIncludesZero(false); // override default
rangeAxis1.setLowerMargin(0.40); // to leave room for volume bars
DecimalFormat format = new DecimalFormat("0");
rangeAxis1.setNumberFormatOverride(format);
final ValueAxis timeAxis = new DateAxis("Date");
timeAxis.setLowerMargin(0.02); // reduce the default margins
timeAxis.setUpperMargin(0.02);
XYPlot plot = new XYPlot(dataset, timeAxis, rangeAxis1, null);
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
renderer1.setBaseToolTipGenerator(
new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00#")
)
);
plot.setRenderer(0, renderer1);
final CombinedDomainXYPlot cplot1 = (CombinedDomainXYPlot)this.candlestickChart.getPlot();
if (plot != null) cplot1.add(plot, 1); // weight is 1.
}
示例2: testAxisMargins
import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
/**
* Tests the the lower and upper margin settings produce the expected results.
*/
public void testAxisMargins() {
XYSeries series = new XYSeries("S1");
series.add(100.0, 1.1);
series.add(200.0, 2.2);
XYSeriesCollection dataset = new XYSeriesCollection(series);
dataset.setIntervalWidth(0.0);
JFreeChart chart = ChartFactory.createScatterPlot(
"Title", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false
);
ValueAxis domainAxis = chart.getXYPlot().getDomainAxis();
Range r = domainAxis.getRange();
assertTrue(NumberUtils.equal(110.0, r.getLength()));
domainAxis.setLowerMargin(0.10);
domainAxis.setUpperMargin(0.10);
r = domainAxis.getRange();
assertTrue(NumberUtils.equal(120.0, r.getLength()));
}
示例3: testAxisMargins
import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
/**
* Tests the the lower and upper margin settings produce the expected
* results.
*/
public void testAxisMargins() {
XYSeries series = new XYSeries("S1");
series.add(100.0, 1.1);
series.add(200.0, 2.2);
XYSeriesCollection dataset = new XYSeriesCollection(series);
dataset.setIntervalWidth(0.0);
JFreeChart chart = ChartFactory.createScatterPlot(
"Title", "X", "Y", dataset, PlotOrientation.VERTICAL,
false, false, false
);
ValueAxis domainAxis = ((XYPlot) chart.getPlot()).getDomainAxis();
Range r = domainAxis.getRange();
assertEquals(110.0, r.getLength(), EPSILON);
domainAxis.setLowerMargin(0.10);
domainAxis.setUpperMargin(0.10);
r = domainAxis.getRange();
assertEquals(120.0, r.getLength(), EPSILON);
}
示例4: init
import org.jfree.chart.axis.ValueAxis; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public void init() {
CategoryDataset dataset = getDataSet();
JFreeChart chart = ChartFactory.createBarChart3D("Number Ranking", // 圖表標題
"Book Types", // 目錄軸的顯示標簽
"The Number of Books", // 數值軸的顯示標簽
dataset, // 數據集
PlotOrientation.VERTICAL, // 圖表方向:水平、垂直
true, false, // 是否生成工具
false // 是否生成URL鏈接
);
// 從這裏開始
CategoryPlot plot = chart.getCategoryPlot();// 獲取圖表區域對象
BarRenderer3D renderer =new BarRenderer3D();
renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setItemLabelFont(new Font("黑體",Font.BOLD,14));//12號黑體加粗
renderer.setItemLabelPaint(Color.black);//字體為黑色
renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.BASELINE_CENTER));
renderer.setItemLabelsVisible(true);
plot.setRenderer(renderer);
CategoryAxis domainAxis = plot.getDomainAxis(); // 水平底部列表
domainAxis.setLabelFont(new Font("黑體", Font.BOLD, 14)); // 水平底部標題
domainAxis.setTickLabelFont(new Font("宋體", Font.BOLD, 12)); // 垂直標題
ValueAxis rangeAxis = plot.getRangeAxis();// 獲取柱狀
rangeAxis.setUpperMargin(0.1);
rangeAxis.setLabelFont(new Font("黑體", Font.BOLD, 15));
chart.getLegend().setItemFont(new Font("黑體", Font.BOLD, 15));
chart.getTitle().setFont(new Font("宋體", Font.BOLD, 20));// 設置標題字體
chartPane = new ChartPanel(chart, true);
// File dir = new File("images\\");
// if (!dir.exists()) {
// dir.mkdir();
// }
// String fName = String.valueOf(System.currentTimeMillis()) + "bar.png";
// File file = new File("images\\", fName);
// try {
// ChartUtilities.saveChartAsPNG(file, chart, 550, 400);
// } catch (IOException e) {
//
// e.printStackTrace();
// }
}