本文整理汇总了Java中org.jfree.chart.axis.DateAxis.setTickMarkPosition方法的典型用法代码示例。如果您正苦于以下问题:Java DateAxis.setTickMarkPosition方法的具体用法?Java DateAxis.setTickMarkPosition怎么用?Java DateAxis.setTickMarkPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.axis.DateAxis
的用法示例。
在下文中一共展示了DateAxis.setTickMarkPosition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
DateAxis a1 = new DateAxis("Test");
DateAxis a2 = new DateAxis("Test");
assertTrue(a1.equals(a2));
// tickUnit
a1.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7));
assertFalse(a1.equals(a2));
a2.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7));
assertTrue(a1.equals(a2));
// dateFormatOverride
a1.setDateFormatOverride(new SimpleDateFormat("yyyy"));
assertFalse(a1.equals(a2));
a2.setDateFormatOverride(new SimpleDateFormat("yyyy"));
assertTrue(a1.equals(a2));
// tickMarkPosition
a1.setTickMarkPosition(DateTickMarkPosition.END);
assertFalse(a1.equals(a2));
a2.setTickMarkPosition(DateTickMarkPosition.END);
assertTrue(a1.equals(a2));
// timeline
a1.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
assertFalse(a1.equals(a2));
a2.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
assertTrue(a1.equals(a2));
}
示例2: testEquals
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
DateAxis a1 = new DateAxis("Test");
DateAxis a2 = new DateAxis("Test");
assertTrue(a1.equals(a2));
assertFalse(a1.equals(null));
assertFalse(a1.equals("Some non-DateAxis object"));
// tickUnit
a1.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7));
assertFalse(a1.equals(a2));
a2.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7));
assertTrue(a1.equals(a2));
// dateFormatOverride
a1.setDateFormatOverride(new SimpleDateFormat("yyyy"));
assertFalse(a1.equals(a2));
a2.setDateFormatOverride(new SimpleDateFormat("yyyy"));
assertTrue(a1.equals(a2));
// tickMarkPosition
a1.setTickMarkPosition(DateTickMarkPosition.END);
assertFalse(a1.equals(a2));
a2.setTickMarkPosition(DateTickMarkPosition.END);
assertTrue(a1.equals(a2));
// timeline
a1.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
assertFalse(a1.equals(a2));
a2.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
assertTrue(a1.equals(a2));
}
示例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: testEquals
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
DateAxis a1 = new DateAxis("Test");
DateAxis a2 = new DateAxis("Test");
assertTrue(a1.equals(a2));
assertFalse(a1.equals(null));
assertFalse(a1.equals("Some non-DateAxis object"));
// tickUnit
a1.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 7));
assertFalse(a1.equals(a2));
a2.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 7));
assertTrue(a1.equals(a2));
// dateFormatOverride
a1.setDateFormatOverride(new SimpleDateFormat("yyyy"));
assertFalse(a1.equals(a2));
a2.setDateFormatOverride(new SimpleDateFormat("yyyy"));
assertTrue(a1.equals(a2));
// tickMarkPosition
a1.setTickMarkPosition(DateTickMarkPosition.END);
assertFalse(a1.equals(a2));
a2.setTickMarkPosition(DateTickMarkPosition.END);
assertTrue(a1.equals(a2));
// timeline
a1.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
assertFalse(a1.equals(a2));
a2.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
assertTrue(a1.equals(a2));
}
示例10: createWeeklyLoginChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
private byte[] createWeeklyLoginChart (int width, int height)
{
IntervalXYDataset dataset1 = getWeeklyLoginsDataSet ();
IntervalXYDataset dataset2 = getWeeklySiteUserDataSet ();
if ((dataset1 == null) || (dataset2 == null)) {
return generateNoDataChart(width, height);
}
// create plot ...
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
renderer1.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
renderer1.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
renderer1.setSeriesPaint(0, Color.RED);
renderer1.setSeriesPaint(0, Color.BLUE);
DateAxis domainAxis = new DateAxis("");
domainAxis.setTickUnit (new DateTickUnit (DateTickUnit.DAY, 7, new SimpleDateFormat ("yyyy-MM-dd")));
domainAxis.setTickMarkPosition (DateTickMarkPosition.START);
domainAxis.setVerticalTickLabels (true);
domainAxis.setLowerMargin (0.01);
domainAxis.setUpperMargin (0.01);
NumberAxis rangeAxis = new NumberAxis("count");
rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ());
XYPlot plot1 = new XYPlot(dataset1, null, rangeAxis, renderer1);
plot1.setBackgroundPaint(Color.lightGray);
plot1.setDomainGridlinePaint(Color.white);
plot1.setRangeGridlinePaint(Color.white);
// add a second dataset and renderer...
XYItemRenderer renderer2 = new XYLineAndShapeRenderer(true, false);
renderer2.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
renderer2.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
renderer2.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
renderer2.setSeriesPaint(0, Color.GREEN);
renderer2.setSeriesPaint(1, Color.BLACK);
renderer2.setSeriesPaint(2, Color.CYAN);
rangeAxis = new NumberAxis("count");
rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ());
XYPlot plot2 = new XYPlot(dataset2, null, rangeAxis, renderer2);
plot2.setBackgroundPaint(Color.lightGray);
plot2.setDomainGridlinePaint(Color.white);
plot2.setRangeGridlinePaint(Color.white);
CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis);
cplot.add(plot1, 3);
cplot.add(plot2, 2);
cplot.setGap(8.0);
cplot.setDomainGridlinePaint(Color.white);
cplot.setDomainGridlinesVisible(true);
// return a new chart containing the overlaid plot...
JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
LegendTitle legend = new LegendTitle(cplot);
chart.addSubtitle(legend);
// set background
chart.setBackgroundPaint (parseColor (statsManager.getChartBackgroundColor ()));
// set chart border
chart.setPadding (new RectangleInsets (10, 5, 5, 5));
chart.setBorderVisible (true);
chart.setBorderPaint (parseColor ("#cccccc"));
// set anti alias
chart.setAntiAlias (true);
BufferedImage img = chart.createBufferedImage (width, height);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
try{
ImageIO.write(img, "png", out);
}catch(IOException e){
log.warn("Error occurred while generating SiteStats chart image data", e);
}
return out.toByteArray();
}