當前位置: 首頁>>代碼示例>>Java>>正文


Java DateAxis.setTickLabelsVisible方法代碼示例

本文整理匯總了Java中org.jfree.chart.axis.DateAxis.setTickLabelsVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java DateAxis.setTickLabelsVisible方法的具體用法?Java DateAxis.setTickLabelsVisible怎麽用?Java DateAxis.setTickLabelsVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.axis.DateAxis的用法示例。


在下文中一共展示了DateAxis.setTickLabelsVisible方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
 
開發者ID:Sinton,項目名稱:DesignPatterns,代碼行數:33,代碼來源:TimeSeriesViewObserver.java

示例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);
  }
 
開發者ID:PERSISTLab,項目名稱:BatterylessSim,代碼行數:37,代碼來源:DataChart.java

示例3: 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);
}
 
開發者ID:YangMann,項目名稱:drone-slam,代碼行數:31,代碼來源:AttitudeChart.java

示例4: 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);
    }
 
開發者ID:YangMann,項目名稱:drone-slam,代碼行數:29,代碼來源:AltitudeChart.java

示例5: 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);
   }
 
開發者ID:Jupre,項目名稱:MarmaraDrone,代碼行數:33,代碼來源:AttitudeChart.java

示例6: NetworkDynamicLineChart

import org.jfree.chart.axis.DateAxis; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
	public NetworkDynamicLineChart(int maxAge,String titleName, String hostIP){
		super(titleName, hostIP);

		this.netBindWidth = new TimeSeries("當前已使用的帶寬");
		this.netBindWidth.setMaximumItemAge(maxAge);
		
		TimeSeriesCollection dataset = new TimeSeriesCollection();
		dataset.addSeries(netBindWidth);
		
		DateAxis domain = new DateAxis("時間");
		NumberAxis range = new NumberAxis("帶寬/Mbps");

		domain.setTickLabelFont(this.tickFont);
		range.setTickLabelFont(this.tickFont);
		domain.setLabelFont(this.labelFont);
		range.setLabelFont(this.labelFont);
		range.setRange(0.0, 65);
//		range.setTickUnit(new NumberTickUnit(5));//設置刻度線間隔
		
		XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
		renderer.setSeriesPaint(0, Color.red);
		renderer.setSeriesPaint(1, Color.blue);
		renderer.setStroke(new BasicStroke(1.5f, 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.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
//		Font titleFont = new Font("SansSerif", Font.BOLD, 14);
		JFreeChart chart = new JFreeChart(this.titleName, this.titleFont, plot, true);
		
		chart.getLegend().setItemFont(this.legendFont);	//設置圖例字體
		
		chart.setBackgroundPaint(Color.white);
		chartPanel = new ChartPanel(chart);
		chartPanel.setBorder(BorderFactory.createCompoundBorder(
				BorderFactory.createEmptyBorder(4, 4, 4, 4),
				BorderFactory.createLineBorder(Color.black)));
	}
 
開發者ID:uestc-lsu,項目名稱:LPCM,代碼行數:48,代碼來源:NetworkDynamicLineChart.java

示例7: CpuDynamicLineChart

import org.jfree.chart.axis.DateAxis; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
	public CpuDynamicLineChart(int maxAge, String titleName, String hostIP){
//		super.setLayout(null);//使用空布局
		super(titleName, hostIP);
//		super(titleName, hostIP, false);
//		super(titleName, hostIP, 0);
		
		this.cpuUsage = new TimeSeries("cpu使用率");
		this.cpuUsage.setMaximumItemAge(maxAge);
		
		TimeSeriesCollection dataset = new TimeSeriesCollection();
		dataset.addSeries(cpuUsage);
		
		DateAxis domain = new DateAxis("時間");
		NumberAxis range = new NumberAxis("CPU使用率/%");
		
		domain.setTickLabelFont(this.tickFont);
		range.setTickLabelFont(this.tickFont);
		domain.setLabelFont(this.labelFont);
		range.setLabelFont(this.labelFont);
		range.setRange(0.0, 100.0);
		range.setTickUnit(new NumberTickUnit(5));//設置刻度線間隔
		
		XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
		renderer.setSeriesPaint(0, Color.red);
		renderer.setSeriesPaint(1, Color.blue);
//		renderer.setSeriesShape(WIDTH, 20);
		renderer.setStroke(new BasicStroke(1.5f, 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.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
		JFreeChart chart = new JFreeChart(this.titleName, this.titleFont, plot, true);
		
		chart.getLegend().setItemFont(this.legendFont);	//設置圖例字體
		
		chart.setBackgroundPaint(Color.white);
		chartPanel = new ChartPanel(chart);
		chartPanel.setBorder(BorderFactory.createCompoundBorder(
				BorderFactory.createEmptyBorder(4, 4, 4, 4),
				BorderFactory.createLineBorder(Color.black)));
	}
 
開發者ID:uestc-lsu,項目名稱:LPCM,代碼行數:52,代碼來源:CpuDynamicLineChart.java

示例8: MemoryDynamicLineChart

import org.jfree.chart.axis.DateAxis; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public MemoryDynamicLineChart(int maxAge,String titleName, String hostIP){
	super(titleName, hostIP);
	
	this.totalMemory = new TimeSeries("總內存");
	this.totalMemory.setMaximumItemAge(maxAge);
	this.freeMemory = new TimeSeries("剩餘內存");
	this.freeMemory.setMaximumItemAge(maxAge);
	
	TimeSeriesCollection dataset = new TimeSeriesCollection();
	dataset.addSeries(totalMemory);
	dataset.addSeries(freeMemory);

	DateAxis domain = new DateAxis("時間");
	NumberAxis range = new NumberAxis("內存使用情況/GB");
	
	domain.setTickLabelFont(this.tickFont);
	range.setTickUnit(new NumberTickUnit(0.3f));//設置刻度
	
	range.setTickLabelFont(this.tickFont);
	domain.setLabelFont(this.labelFont);
	range.setLabelFont(this.labelFont);
	
	XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
	renderer.setSeriesPaint(0, Color.red);
	renderer.setSeriesPaint(1, Color.blue);
	renderer.setStroke(new BasicStroke(1.5f, 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.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
	chart = new JFreeChart(this.titleName, this.titleFont, plot, true);
	
	chart.getLegend().setItemFont(this.legendFont);	//設置圖例字體
	
	chart.setBackgroundPaint(Color.white);
	chartPanel = new ChartPanel(chart);
	chartPanel.setBorder(BorderFactory.createCompoundBorder(
			BorderFactory.createEmptyBorder(4, 4, 4, 4),
			BorderFactory.createLineBorder(Color.black)));
}
 
開發者ID:uestc-lsu,項目名稱:LPCM,代碼行數:51,代碼來源:MemoryDynamicLineChart.java

示例9: MemoryUsagePanel

import org.jfree.chart.axis.DateAxis; //導入方法依賴的package包/類
/**
 * Creates a new application.
 * 
 * @param historyCount
 *            the history count (in milliseconds).
 */
public MemoryUsagePanel(int historyCount, int interval)
{
	super(new BorderLayout());
	// create two series that automatically discard data more than 30
	// seconds old...
	this.total = new TimeSeries("Total Memory", Millisecond.class);
	this.total.setMaximumItemCount(historyCount);
	this.free = new TimeSeries("Free Memory", Millisecond.class);
	this.free.setMaximumItemCount(historyCount);
	this.used = new TimeSeries("Used Memory", Millisecond.class);
	this.used.setMaximumItemCount(historyCount);
	this.max = new TimeSeries("Used Memory", Millisecond.class);
	this.max.setMaximumItemCount(historyCount);
	TimeSeriesCollection dataset = new TimeSeriesCollection();
	dataset.addSeries(this.total);
	dataset.addSeries(this.free);
	dataset.addSeries(this.used);
	dataset.addSeries(this.max);

	DateAxis domain = new DateAxis("Time");
	NumberAxis range = new NumberAxis("Memory");

	domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
	range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
	domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));

	range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
	XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
	renderer.setSeriesPaint(0, Color.red);
	renderer.setSeriesPaint(1, Color.green);
	renderer.setSeriesPaint(2, Color.black);

	renderer.setStroke(new BasicStroke(1f, 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.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
	JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font(
			"SansSerif", Font.BOLD, 24), plot, true);
	chart.setBackgroundPaint(Color.white);
	ChartPanel chartPanel = new ChartPanel(chart);
	chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory
			.createEmptyBorder(4, 4, 4, 4), BorderFactory
			.createLineBorder(Color.black)));
	add(chartPanel);

	gen = new DataGenerator(interval);

}
 
開發者ID:TOMIGalway,項目名稱:cmoct-sourcecode,代碼行數:63,代碼來源:MemoryUsagePanel.java

示例10: createGraph

import org.jfree.chart.axis.DateAxis; //導入方法依賴的package包/類
/**
 * Ugly code creating the graph, layer and all that stuff
 */
private void createGraph() {
	//graphedValues = new TimeSeries(item.getUnit());
	//graphedValues = new TimeSeries(item.getUnit(), Second.class);
	//graphedValues.setMaximumItemAge(3000);
	//graphedValues.setMaximumItemCount(30); 

	dataset= new TimeSeriesCollection();
	
	//dataset.addSeries(this.graphedValues);
	dataset.addSeries(graphedValues);
	DateAxis domain = new DateAxis("Time");
	NumberAxis range = new NumberAxis(item.getUnit());
	//range.setRange(item.getMinValue(), item.getMaxValue());
	range.setAutoRange(true);
	
	domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
	range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
	domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
	range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
	
	XYItemRenderer renderer = new XYLineAndShapeRenderer(true,true);
	renderer.setSeriesPaint(0, Color.RED);
	//renderer.setSeriesPaint(1, Color.GREEN);
	renderer.setBaseStroke(new BasicStroke(3f, 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.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
	
	JFreeChart chart = new JFreeChart("(Id: " + item.getItemId() + ")",
									 new Font("SansSerif",Font.BOLD, 24),
									 plot,
									 true);
	
	//List<String> subtitles = new List<String>();
	//subtitles.add("(on " + device.getName() + ")");
	//chart.setSubtitles(subtitles);
	chart.setBackgroundPaint(Color.white);
	chartPanel = new ChartPanel(chart);
	chartPanel.setBorder(BorderFactory.createCompoundBorder(
										BorderFactory.createEmptyBorder(4, 4, 4, 4),
										BorderFactory.createLineBorder(Color.black)));
	chartPanel.setSize(new Dimension(400, 400));
	chartPanel.addChartMouseListener(new ChartMouseListener(){
	    public void chartMouseClicked(ChartMouseEvent e){
	    	try{
	    	XYItemEntity xyitem=(XYItemEntity) e.getEntity();
	        double x = dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem());
	        double y = dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem());
	        JOptionPane.showMessageDialog(new JFrame(), ""+y+"  ::  "+new Second(new Date((long)x)));
	    	}
	    	catch(Exception exception )
	    	{
	    	}
	    	
			    }

		public void chartMouseMoved(ChartMouseEvent arg0) {
		
		}
	});

	
}
 
開發者ID:EclipseETS,項目名稱:eclipse-telemetry,代碼行數:77,代碼來源:TelemetryGraph.java


注:本文中的org.jfree.chart.axis.DateAxis.setTickLabelsVisible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。