本文整理汇总了Java中org.jfree.chart.axis.DateTickMarkPosition类的典型用法代码示例。如果您正苦于以下问题:Java DateTickMarkPosition类的具体用法?Java DateTickMarkPosition怎么用?Java DateTickMarkPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateTickMarkPosition类属于org.jfree.chart.axis包,在下文中一共展示了DateTickMarkPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的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.DateTickMarkPosition; //导入依赖的package包/类
/**
* Test equals() method.
*/
public void testEquals() {
assertEquals(DateTickMarkPosition.START, DateTickMarkPosition.START);
assertEquals(DateTickMarkPosition.MIDDLE, DateTickMarkPosition.MIDDLE);
assertEquals(DateTickMarkPosition.END, DateTickMarkPosition.END);
assertFalse(DateTickMarkPosition.START.equals(null));
assertFalse(DateTickMarkPosition.START.equals(DateTickMarkPosition.END));
assertFalse(DateTickMarkPosition.MIDDLE.equals(DateTickMarkPosition.END));
}
示例3: testEquals
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的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));
}
示例4: testPreviousStandardDateYear
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的package包/类
/**
* A basic check for the testPreviousStandardDate() method when the
* tick unit is 1 year.
*/
public void testPreviousStandardDateYear() {
MyDateAxis axis = new MyDateAxis("Year");
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(2006, Calendar.AUGUST, 25, 12, 0);
Date d1 = calendar.getTime();
calendar.set(2007, Calendar.MAY, 20, 12, 0);
Date d2 = calendar.getTime();
axis.setRange(d1, d2);
DateTickUnit unit = new DateTickUnit(DateTickUnit.YEAR, 1);
axis.setTickUnit(unit);
axis.setTickMarkPosition(DateTickMarkPosition.START);
Date psd1 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd1);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.JANUARY, calendar.get(Calendar.MONTH));
assertEquals(1, calendar.get(Calendar.DATE));
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
Date psd2 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd2);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.JULY, calendar.get(Calendar.MONTH));
assertEquals(1, calendar.get(Calendar.DATE));
axis.setTickMarkPosition(DateTickMarkPosition.END);
Date psd3 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd3);
assertEquals(2005, calendar.get(Calendar.YEAR));
assertEquals(Calendar.DECEMBER, calendar.get(Calendar.MONTH));
assertEquals(31, calendar.get(Calendar.DATE));
}
示例5: testPreviousStandardDateMonth
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的package包/类
/**
* A basic check for the testPreviousStandardDate() method when the
* tick unit is 1 month.
*/
public void testPreviousStandardDateMonth() {
MyDateAxis axis = new MyDateAxis("Month");
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(2006, Calendar.AUGUST, 25, 12, 0);
Date d1 = calendar.getTime();
calendar.set(2007, Calendar.MAY, 20, 12, 0);
Date d2 = calendar.getTime();
axis.setRange(d1, d2);
DateTickUnit unit = new DateTickUnit(DateTickUnit.MONTH, 1);
axis.setTickUnit(unit);
axis.setTickMarkPosition(DateTickMarkPosition.START);
Date psd1 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd1);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(1, calendar.get(Calendar.DATE));
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
Date psd2 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd2);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(16, calendar.get(Calendar.DATE));
axis.setTickMarkPosition(DateTickMarkPosition.END);
Date psd3 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd3);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.JULY, calendar.get(Calendar.MONTH));
assertEquals(31, calendar.get(Calendar.DATE));
}
示例6: testPreviousStandardDateDay
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的package包/类
/**
* A basic check for the testPreviousStandardDate() method when the
* tick unit is 1 day.
*/
public void testPreviousStandardDateDay() {
MyDateAxis axis = new MyDateAxis("Day");
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(2006, Calendar.AUGUST, 25, 12, 0);
Date d1 = calendar.getTime();
calendar.set(2007, Calendar.MAY, 20, 12, 0);
Date d2 = calendar.getTime();
axis.setRange(d1, d2);
DateTickUnit unit = new DateTickUnit(DateTickUnit.DAY, 1);
axis.setTickUnit(unit);
axis.setTickMarkPosition(DateTickMarkPosition.START);
Date psd1 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd1);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
Date psd2 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd2);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
axis.setTickMarkPosition(DateTickMarkPosition.END);
Date psd3 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd3);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(24, calendar.get(Calendar.DATE));
}
示例7: testPreviousStandardDateHour
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的package包/类
/**
* A basic check for the testPreviousStandardDate() method when the
* tick unit is 1 hour.
*/
public void testPreviousStandardDateHour() {
MyDateAxis axis = new MyDateAxis("Hour");
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(2006, Calendar.AUGUST, 25, 12, 0);
Date d1 = calendar.getTime();
calendar.set(2007, Calendar.MAY, 20, 12, 0);
Date d2 = calendar.getTime();
axis.setRange(d1, d2);
DateTickUnit unit = new DateTickUnit(DateTickUnit.HOUR, 1);
axis.setTickUnit(unit);
axis.setTickMarkPosition(DateTickMarkPosition.START);
Date psd1 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd1);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
assertEquals(12, calendar.get(Calendar.HOUR_OF_DAY));
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
Date psd2 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd2);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
assertEquals(11, calendar.get(Calendar.HOUR_OF_DAY));
axis.setTickMarkPosition(DateTickMarkPosition.END);
Date psd3 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd3);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
assertEquals(11, calendar.get(Calendar.HOUR_OF_DAY));
}
示例8: testPreviousStandardDateMinute
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的package包/类
/**
* A basic check for the testPreviousStandardDate() method when the
* tick unit is 1 minute.
*/
public void testPreviousStandardDateMinute() {
MyDateAxis axis = new MyDateAxis("Minute");
GregorianCalendar calendar = new GregorianCalendar();
calendar.set(2006, Calendar.AUGUST, 25, 12, 0, 10);
Date d1 = calendar.getTime();
calendar.set(2007, Calendar.MAY, 20, 12, 0, 10);
Date d2 = calendar.getTime();
axis.setRange(d1, d2);
DateTickUnit unit = new DateTickUnit(DateTickUnit.MINUTE, 1);
axis.setTickUnit(unit);
axis.setTickMarkPosition(DateTickMarkPosition.START);
Date psd1 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd1);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
assertEquals(12, calendar.get(Calendar.HOUR_OF_DAY));
assertEquals(0, calendar.get(Calendar.MINUTE));
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
Date psd2 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd2);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
assertEquals(11, calendar.get(Calendar.HOUR_OF_DAY));
assertEquals(59, calendar.get(Calendar.MINUTE));
axis.setTickMarkPosition(DateTickMarkPosition.END);
Date psd3 = axis.previousStandardDate(d1, unit);
calendar.setTime(psd3);
assertEquals(2006, calendar.get(Calendar.YEAR));
assertEquals(Calendar.AUGUST, calendar.get(Calendar.MONTH));
assertEquals(25, calendar.get(Calendar.DATE));
assertEquals(11, calendar.get(Calendar.HOUR_OF_DAY));
assertEquals(59, calendar.get(Calendar.MINUTE));
}
示例9: testEquals
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的package包/类
/**
* Test equals() method.
*/
public void testEquals() {
assertEquals(DateTickMarkPosition.START, DateTickMarkPosition.START);
assertEquals(DateTickMarkPosition.MIDDLE, DateTickMarkPosition.MIDDLE);
assertEquals(DateTickMarkPosition.END, DateTickMarkPosition.END);
assertFalse(DateTickMarkPosition.START.equals(null));
assertFalse(
DateTickMarkPosition.START.equals(DateTickMarkPosition.END)
);
assertFalse(
DateTickMarkPosition.MIDDLE.equals(DateTickMarkPosition.END)
);
}
示例10: testHashCode
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashCode() {
DateTickMarkPosition a1 = DateTickMarkPosition.END;
DateTickMarkPosition a2 = DateTickMarkPosition.END;
assertTrue(a1.equals(a2));
int h1 = a1.hashCode();
int h2 = a2.hashCode();
assertEquals(h1, h2);
}
示例11: createAverageTeamDistanceGraph
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的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;
}
示例12: createPlayerHistogram
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的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;
}
示例13: createTeamGoldDifferenceGraph
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的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;
}
示例14: createTeamXpDifferenceGraph
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的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;
}
示例15: createChart
import org.jfree.chart.axis.DateTickMarkPosition; //导入依赖的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;
}