本文整理汇总了Java中org.jfree.chart.axis.DateAxis.setUpperMargin方法的典型用法代码示例。如果您正苦于以下问题:Java DateAxis.setUpperMargin方法的具体用法?Java DateAxis.setUpperMargin怎么用?Java DateAxis.setUpperMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.axis.DateAxis
的用法示例。
在下文中一共展示了DateAxis.setUpperMargin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TimeSeriesViewObserver
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 构造分时图的全部元素
*/
public TimeSeriesViewObserver() {
timeSeriesPrice = new TimeSeries("分时图", Hour.class);
timeSeriesPrice.add(new Hour(count++, day), StockSubject.OPENING_PRICE);
timeSeriesPrice.setMaximumItemAge(MAXIMUM_ITEM_AGE);
TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
timeseriescollection.addSeries(timeSeriesPrice);
DateAxis dateaxis = new DateAxis("时间");
NumberAxis numberaxis = new NumberAxis("股票价格");
dateaxis.setTickLabelFont(new Font("微软雅黑", 0, 12));
numberaxis.setTickLabelFont(new Font("微软雅黑", 0, 12));
dateaxis.setLabelFont(new Font("微软雅黑", 0, 12));
numberaxis.setLabelFont(new Font("微软雅黑", 0, 12));
XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
xylineandshaperenderer.setSeriesPaint(0, Color.red);
xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(1F, 0, 1));
XYPlot xyplot = new XYPlot(timeseriescollection, dateaxis, numberaxis, xylineandshaperenderer);
xyplot.setAxisOffset(new RectangleInsets(0D, 0D, 0D, 0D));
dateaxis.setAutoRange(true);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setTickLabelsVisible(true);
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
JFreeChart chart = new JFreeChart("中国铁通股票", new Font("微软雅黑", 1, 12), xyplot, true);
chartPanel = new ChartPanel(chart);
}
示例2: DataChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public DataChart(ComponentRegistry registry, String title, String yaxis) {
DateAxis domain = new DateAxis("Time");
NumberAxis range = new NumberAxis(yaxis);
XYPlot xyplot = new XYPlot();
xyplot.setDomainAxis(domain);
xyplot.setRangeAxis(range);
// xyplot.setBackgroundPaint(Color.black);
xyplot.setDataset(dataset = new TimeSeriesCollection());
DefaultXYItemRenderer renderer = new DefaultXYItemRenderer();
renderer.setSeriesPaint(0, Color.red);
renderer.setSeriesPaint(1, Color.green);
renderer.setSeriesPaint(2, Color.blue);
renderer.setSeriesPaint(3, Color.black);
// renderer.setBaseStroke(
// new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)
// );
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesShapesVisible(1, false);
renderer.setSeriesShapesVisible(2, false);
renderer.setSeriesShapesVisible(3, false);
xyplot.setRenderer(renderer);
domain.setAutoRange(true);
domain.setLowerMargin(0.0);
domain.setUpperMargin(0.0);
domain.setTickLabelsVisible(true);
range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
JFreeChart chart = new JFreeChart(title,
JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);
ChartPanel chartPanel = new ChartPanel(chart);
setLayout(new BorderLayout());
setPreferredSize(new Dimension(400, 200));
add(chartPanel, BorderLayout.CENTER);
}
示例3: createAverageTeamDistanceGraph
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public static JFreeChart createAverageTeamDistanceGraph( AppState state ) {
final JFreeChart chart = ChartFactory.createTimeSeriesChart( GameStatisticsComponent.AVERAGE_TEAM_DISTANCE, // chart title
Statics.MILISECONDS, // x axis label
"", // y axis label
createAverageTeamDistanceDataSet( state ), // data
true, // include legend
true, // tooltips
false // urls
);
final XYPlot plot = chart.getXYPlot();
final DateAxis domainAxis = new DateAxis( Statics.TIME );
domainAxis.setTickMarkPosition( DateTickMarkPosition.MIDDLE );
domainAxis.setLowerMargin( 0.0 );
domainAxis.setUpperMargin( 0.0 );
plot.setDomainAxis( domainAxis );
plot.setForegroundAlpha( 0.5f );
plot.setDomainPannable( false );
plot.setRangePannable( false );
final NumberAxis rangeAxis = new NumberAxis( GameStatisticsComponent.AVERAGE_TEAM_DISTANCE );
rangeAxis.setLowerMargin( 0.15 );
rangeAxis.setUpperMargin( 0.15 );
plot.setRangeAxis( rangeAxis );
return chart;
}
示例4: createPlayerHistogram
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public static JFreeChart createPlayerHistogram( String selectedItem, List<String> selectedValuesList, AppState state ) {
final JFreeChart chart = ChartFactory.createXYLineChart( selectedItem, // chart title
Statics.MILISECONDS, // x axis label
"", // y axis label
createPlayerDataSet( selectedItem, selectedValuesList, state ), // data
PlotOrientation.VERTICAL, true, // include legend
true, // tooltips
false // urls
);
final XYPlot plot = chart.getXYPlot();
final DateAxis domainAxis = new DateAxis( Statics.TIME );
domainAxis.setTickMarkPosition( DateTickMarkPosition.MIDDLE );
domainAxis.setLowerMargin( 0.0 );
domainAxis.setUpperMargin( 0.0 );
plot.setDomainAxis( domainAxis );
plot.setForegroundAlpha( 0.5f );
plot.setDomainPannable( false );
plot.setRangePannable( false );
final NumberAxis rangeAxis = new NumberAxis( selectedItem );
rangeAxis.setLowerMargin( 0.15 );
rangeAxis.setUpperMargin( 0.15 );
plot.setRangeAxis( rangeAxis );
return chart;
}
示例5: createTeamGoldDifferenceGraph
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public static JFreeChart createTeamGoldDifferenceGraph( AppState appState ) {
final JFreeChart chart = ChartFactory.createTimeSeriesChart( GameStatisticsComponent.TEAM_XP, Statics.EXPERIENCE, "Time",
createTeamGoldDiffDataSet( appState ), true, // legend
true, // tool tips
false // URLs
);
final XYDifferenceRenderer renderer = new XYDifferenceRenderer( Color.GREEN, Color.RED, false );
renderer.setSeriesPaint( 0, Color.GREEN );
renderer.setSeriesPaint( 1, Color.RED );
final XYPlot plot = chart.getXYPlot();
plot.setRenderer( renderer );
final DateAxis domainAxis = new DateAxis( Statics.TIME );
domainAxis.setTickMarkPosition( DateTickMarkPosition.MIDDLE );
domainAxis.setLowerMargin( 0.0 );
domainAxis.setUpperMargin( 0.0 );
plot.setDomainAxis( domainAxis );
plot.setForegroundAlpha( 0.5f );
final NumberAxis rangeAxis = new NumberAxis( Statics.GOLD );
rangeAxis.setLowerMargin( 0.15 );
rangeAxis.setUpperMargin( 0.15 );
plot.setRangeAxis( rangeAxis );
return chart;
}
示例6: createTeamXpDifferenceGraph
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public static JFreeChart createTeamXpDifferenceGraph( AppState state ) {
final JFreeChart chart = ChartFactory.createTimeSeriesChart( GameStatisticsComponent.TEAM_XP, Statics.EXPERIENCE, "Time",
createTeamXPDiffDataSet( state ), true, // legend
true, // tool tips
false // URLs
);
final XYDifferenceRenderer renderer = new XYDifferenceRenderer( Color.GREEN, Color.RED, false );
renderer.setSeriesPaint( 0, Color.GREEN );
renderer.setSeriesPaint( 1, Color.RED );
final XYPlot plot = chart.getXYPlot();
plot.setRenderer( renderer );
final DateAxis domainAxis = new DateAxis( Statics.TIME );
domainAxis.setTickMarkPosition( DateTickMarkPosition.MIDDLE );
domainAxis.setLowerMargin( 0.0 );
domainAxis.setUpperMargin( 0.0 );
plot.setDomainAxis( domainAxis );
plot.setForegroundAlpha( 0.5f );
final NumberAxis rangeAxis = new NumberAxis( Statics.EXPERIENCE );
rangeAxis.setLowerMargin( 0.15 );
rangeAxis.setUpperMargin( 0.15 );
plot.setRangeAxis( rangeAxis );
return chart;
}
示例7: createChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
true,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
false,// !legendPanelOn,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator(
"{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")
);
renderer.setBaseToolTipGenerator(generator);
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
plot.setBackgroundPaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.white);
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
axis.setLowerMargin(0.01);
axis.setUpperMargin(0.01);
// setXSummary(dataset); X is time
return chart;
}
示例8: createChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
protected JFreeChart createChart(IntervalXYDataset dataset) {
JFreeChart chart = ChartFactory.createXYBarChart(
chartTitle,
domainLabel,
true,
rangeLabel,
dataset,
PlotOrientation.VERTICAL,
!legendPanelOn,
true,
false
);
// then customise it a little...
// chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
chart.setBackgroundPaint(Color.white);
XYPlot plot = chart.getXYPlot();
plot.setRenderer(new ClusteredXYBarRenderer());
XYItemRenderer renderer = plot.getRenderer();
StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator(
"{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")
);
renderer.setBaseToolTipGenerator(generator);
renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());
plot.setBackgroundPaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.white);
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
axis.setLowerMargin(0.01);
axis.setUpperMargin(0.01);
// setXSummary(dataset); X is time
return chart;
}
示例9: buildDateAxis
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
private DateAxis buildDateAxis() {
DateAxis dateAxis = new DateAxis();
dateAxis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM"));
dateAxis.setLowerMargin(.02);
dateAxis.setUpperMargin(.02);
return dateAxis;
}
示例10: createChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
private JFreeChart createChart(XYDataset xydataset) {
JFreeChart jfreechart = ChartFactory.createXYLineChart("分数折线图", "时间", "分数", xydataset,
PlotOrientation.VERTICAL, true, true, false);
Font font = new Font("宋体", Font.PLAIN, 13);
jfreechart.getTitle().setFont(font);
jfreechart.getLegend().setItemFont(font);
jfreechart.getXYPlot().getDomainAxis().setTickLabelFont(font);
jfreechart.getXYPlot().getDomainAxis().setLabelFont(font);
jfreechart.getXYPlot().getRangeAxis().setTickLabelFont(font);
jfreechart.getXYPlot().getRangeAxis().setLabelFont(font);
XYPlot xyplot = (XYPlot) jfreechart.getPlot();
xyplot.setDomainPannable(true);
xyplot.setRangePannable(true);
XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
xylineandshaperenderer.setBaseShapesVisible(true);
xylineandshaperenderer.setBaseShapesFilled(true);
DateAxis dateaxis = new DateAxis("时间");
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd HH:mm");
dateaxis.setDateFormatOverride(sfd);
xyplot.setDomainAxis(dateaxis);
xyplot.setDomainAxis(dateaxis);
xyplot.setForegroundAlpha(0.5F);
return jfreechart;
}
示例11: configureDomainAxis
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/** Configures the domain axis. */
private void configureDomainAxis(DateAxis domainAxis) {
domainAxis.setDateFormatOverride(new SimpleDateFormat(resolution
.getDomainFormat()));
if (useLogDateAxis) {
domainAxis.setTimeline(new LogTimeLine());
domainAxis.setTickUnit(new FixedDateTickUnit());
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
}
}
示例12: createChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
protected void createChart(String domainAxisTitle, String rangeAxisTitle, String chartsTitle, boolean includeLegend) {
DateAxis domain = new DateAxis(domainAxisTitle);
NumberAxis range = new NumberAxis(rangeAxisTitle);
XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
renderer.setSeriesPaint(0, Color.red);
renderer.setSeriesPaint(1, Color.green);
renderer.setSeriesPaint(2, Color.blue);
renderer.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
XYPlot plot = new XYPlot(dataset, domain, range, renderer);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
domain.setAutoRange(true);
domain.setLowerMargin(0.0);
domain.setUpperMargin(0.0);
domain.setTickLabelsVisible(true);
range.setAutoRange(false);
range.setUpperBound(180);
range.setLowerBound(-180);
range.setAutoRangeIncludesZero(true);
range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
chart = new JFreeChart(plot);
chart.setBackgroundPaint(Color.white);
}
示例13: createChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
protected void createChart(String domainAxisTitle, String rangeAxisTitle, String chartsTitle, boolean includeLegend) {
DateAxis domain = new DateAxis(domainAxisTitle);
NumberAxis range = new NumberAxis(rangeAxisTitle);
XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
renderer.setSeriesPaint(0, Color.blue);
renderer.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
XYPlot plot = new XYPlot(dataset, domain, range, renderer);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
domain.setAutoRange(true);
domain.setLowerMargin(0.0);
domain.setUpperMargin(0.0);
domain.setTickLabelsVisible(true);
range.setAutoRange(true);
// range.setUpperBound(180);
// range.setLowerBound(0);
range.setAutoRangeIncludesZero(true);
range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
chart = new JFreeChart(plot);
chart.setBackgroundPaint(Color.white);
}
示例14: createChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected void createChart(String domainAxisTitle, String rangeAxisTitle, String chartsTitle, boolean includeLegend)
{
DateAxis domain = new DateAxis(domainAxisTitle);
NumberAxis range = new NumberAxis(rangeAxisTitle);
XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
renderer.setSeriesPaint(0, Color.red);
renderer.setSeriesPaint(1, Color.green);
renderer.setSeriesPaint(2, Color.blue);
renderer.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
XYPlot plot = new XYPlot(dataset, domain, range, renderer);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
domain.setAutoRange(true);
domain.setLowerMargin(0.0);
domain.setUpperMargin(0.0);
domain.setTickLabelsVisible(true);
range.setAutoRange(false);
range.setUpperBound(90);
range.setLowerBound(-90);
range.setAutoRangeIncludesZero(true);
range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
chart = new JFreeChart(plot);
chart.setBackgroundPaint(Color.white);
}
示例15: setDateXAxis
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public XYChartBuilder setDateXAxis(final boolean showAxisValues)
{
xAxis = new DateAxis();
((DateAxis) xAxis).setTickMarkPosition(DateTickMarkPosition.MIDDLE);
xAxis.setLowerMargin(0.0);
xAxis.setUpperMargin(0.0);
xAxis.setVisible(showAxisValues);
plot.setDomainAxis(xAxis);
return this;
}