当前位置: 首页>>代码示例>>Java>>正文


Java DateAxis.setAutoRange方法代码示例

本文整理汇总了Java中org.jfree.chart.axis.DateAxis.setAutoRange方法的典型用法代码示例。如果您正苦于以下问题:Java DateAxis.setAutoRange方法的具体用法?Java DateAxis.setAutoRange怎么用?Java DateAxis.setAutoRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.axis.DateAxis的用法示例。


在下文中一共展示了DateAxis.setAutoRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupChart

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
private void setupChart() {
    this.data = new TimeSeries("Counts");

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(this.data);

    DateAxis domain = new DateAxis("Time");
    domain.setAutoRange(true);
    NumberAxis range = new NumberAxis("Count");

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setBaseShapesVisible(false);
    renderer.setBaseSeriesVisibleInLegend(false);

    XYPlot plot = new XYPlot(dataset, domain, range, renderer);

    this.chart = new JFreeChart("Mongo Counts", plot);
    ChartUtilities.applyCurrentTheme(this.chart);
}
 
开发者ID:etissieres,项目名称:JMongoCounter,代码行数:20,代码来源:Window.java

示例2: 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

示例3: 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

示例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.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

示例5: 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

示例6: createChart

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
private static JFreeChart createChart(TimeSeriesCollection dataset) {
	//		 create the chart...
	JFreeChart chart = ChartFactory.createTimeSeriesChart(null, // chart
																// title
			"Time (sec)", // domain axis label
			"Throughput bytes/sec", // range axis label
			dataset, // data
			false, // include legend
			false, // tooltips?
			false // URLs?
			);
	//		 NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
	//		 set the background color for the chart...

	chart.setBackgroundPaint( VisualFirewall.BG_COLOR );
	chart.setBorderPaint( VisualFirewall.FG_COLOR );
	//		 OPTIONAL CUSTOMISATION COMPLETED.
	XYPlot plot = chart.getXYPlot();
	plot.setBackgroundPaint( VisualFirewall.BG_COLOR );
	
	
	plot.getRangeAxis().setLabelPaint( VisualFirewall.FG_COLOR );
	plot.getRangeAxis().setTickLabelPaint( VisualFirewall.FG_COLOR );
	DateAxis axis = (DateAxis) plot.getDomainAxis();
	axis.setLabelPaint( VisualFirewall.FG_COLOR );
	axis.setDateFormatOverride(new SimpleDateFormat("hh:mm:ss"));
	axis.setAutoRange(true);
	axis.setFixedAutoRange(3600000);
	axis.setTickLabelPaint( VisualFirewall.FG_COLOR );
	return chart;
}
 
开发者ID:chrislee35,项目名称:visualfirewall,代码行数:32,代码来源:StatisticsView.java

示例7: 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

示例8: PannableTimeChartPanel

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public PannableTimeChartPanel(long startTime, long endTime, TimeSeriesCollection dataset) {

        double interval = ((endTime - startTime) / (30000.));

        JFreeChart chart = ChartFactory.createXYLineChart(
                "Memory Telemtry View", "Time",
                "Memory (Mb)", dataset, PlotOrientation.VERTICAL,
                true, true, false
        );

        plot = (XYPlot) chart.getPlot();

        DateAxis domainAxis = new DateAxis();
        plot.setDomainAxis(domainAxis);
        domainAxis.setLabelAngle(Math.PI / 2);
        domainAxis.setAutoRange(true);
        domainAxis.setMinimumDate(new Date(startTime));
        domainAxis.setMaximumDate(new Date(startTime + 30L * 1000L));

        plot.setDomainPannable(true);

        setLayout(new BorderLayout());

        add(new ChartPanel(chart), BorderLayout.CENTER);
        JScrollBar panScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);

        rangeModel = new DefaultBoundedRangeModel();
        rangeModel.setMinimum(0);
        rangeModel.setMaximum((int)((interval - 1) * 100));
        rangeModel.addChangeListener(this);

        panScrollBar.setModel(rangeModel);

        add(panScrollBar, BorderLayout.SOUTH);

    }
 
开发者ID:bedrin,项目名称:jsonde,代码行数:37,代码来源:PannableTimeChartPanel.java

示例9: createChartPanel

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
private void createChartPanel(String title, long time) {
	YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
	chart = ChartFactory.createTimeSeriesChart(title, X_AXIS_TITLE, "",
			dataset, true, true, true);
	XYPlot plot = (XYPlot) chart.getPlot();

	DeviationRenderer errorRenderer = new DeviationRenderer();
	errorRenderer.setShapesVisible(false);
	errorRenderer.setLinesVisible(true);
	errorRenderer.setAlpha(0.0f);
	// errorRenderer.setDrawYError(false);
	// errorRenderer.setDrawXError(false);
	plot.setRenderer(errorRenderer);

	plot.setBackgroundPaint(Color.WHITE);
	plot.setRangeGridlinePaint(Color.DARK_GRAY);
	plot.setDomainGridlinePaint(Color.DARK_GRAY);
	upperDomainBound = (time / 1000) + ((interval - 1) * step / 1000);
	DateAxis domain = (DateAxis) plot.getDomainAxis();
	domain.setAutoRange(false);
	domain.setRange((time / 1000), upperDomainBound);
	RelativeDateFormat rdf = new RelativeDateFormat();
	rdf.setHourSuffix(":");
	rdf.setMinuteSuffix(":");
	rdf.setSecondSuffix("");
	rdf.setSecondFormatter(new DecimalFormat("0"));
	domain.setDateFormatOverride(rdf);
	plot.setDomainAxis(domain);
	plotPanel = new ChartPanel(chart, true);
	setSizeOfComponent(plotPanel, new Dimension(plotWidth, plotHeight));
	container.add(plotPanel, BorderLayout.CENTER);
	container.add(createRadioBoxes(visType == VisualizationType.Metric),
			BorderLayout.SOUTH);
	setSizeOfComponent(container, new Dimension(plotWidth, plotHeight
			+ boxOffset));
}
 
开发者ID:flyroom,项目名称:PeerfactSimKOM_Clone,代码行数:37,代码来源:MetricsPlot.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: initChart

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public JFreeChart initChart(final StripedCloseFunction stripedCloseFunction) {

        Runnable runnable = new Runnable() {

            @Override
            public void run() {

                Date arbitraryStartDate = stripedCloseFunction.getArbitraryStartDateForChart();
                Date arbitraryEndDate = stripedCloseFunction.getArbitraryEndDate();

                xAxis = new DateAxis();
                xAxis.setAutoRange(true);
                xAxis.setTimeline(tradingTimeLine());
                xAxis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, domainTicksMultiple(arbitraryStartDate, arbitraryEndDate)));
                xAxis.setMinorTickMarksVisible(true);
                if (jFreeTimePeriod.equals(JFreeChartTimePeriod.DAY)) xAxis.setDateFormatOverride(new SimpleDateFormat("dd MMM yy"));

                ///	Y axis
                //Line Y axis
                mainYAxis = new NumberAxis();	 
                mainYAxis.setAutoRange(true);
                mainYAxis.setAutoRangeIncludesZero(false);
                mainYAxis.setTickLabelFont(mainYAxis.getTickLabelFont().deriveFont(7f));
                mainYAxis.setLabelFont(mainYAxis.getLabelFont().deriveFont(10f));

                //Indicator Y axis (indicator is not showing at init)
                //indicYAxis = initYAxis();

                /// Plots
                //Lines
                XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(true, false);
                lineRenderer.setBaseItemLabelsVisible(true);	
                TimeSeriesCollection lineDataset = new TimeSeriesCollection();
                mainPlot = new XYPlot(lineDataset, null, null, lineRenderer);
                mainPlot.addRangeMarker(new ValueMarker(0));
                mainPlot.setRangeAxis(0, mainYAxis);
                mainPlot.setDomainMinorGridlinesVisible(true);

                //Bars
                TimeSeriesCollection barDataset = new TimeSeriesCollection();
                XYBarRenderer barRenderer = new XYBarRenderer();
                mainPlot.setRenderer(1, barRenderer);
                barChartDisplayStrategy.setBarYAxis();
                mainPlot.setDataset(1, barDataset);

                //Indicator plot
                //This is not created from start

                //Combine
                CombinedDomainXYPlot combinedDomainXYPlot = new CombinedDomainXYPlot(xAxis);
                combinedDomainXYPlot.add(mainPlot, CHARTS_TOTAL_WEIGHT);

                //Create
                ChartMain.this.jFreeChart = new JFreeChart(combinedDomainXYPlot);
                ChartMain.this.jFreeChart.removeLegend();

            }
        };

        try {
            EventQueue.invokeAndWait(runnable);
        } catch (Exception e) {
            LOGGER.error(e,e);
        }

        return this.jFreeChart;
    }
 
开发者ID:premiummarkets,项目名称:pm,代码行数:68,代码来源:ChartMain.java

示例15: plotPrint

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
protected void plotPrint() {
		
		/*************** recentJob_CE Line chart ***************/
		this.readPrintPlotDataset();
		
		/*************** CE for all Line charts ***************/
		this.perScenarioTimeseriesCollection[0].addSeries(perScenarioTimeseries[6]);  // ce
		
		// Set plot
		this.perScenarioTimeseriesCollection[1].addSeries(perScenarioTimeseries[0]);  // arrived_job
		this.perScenarioTimeseriesCollection[1].addSeries(perScenarioTimeseries[1]);  // scheduling_job
		this.perScenarioTimeseriesCollection[1].addSeries(perScenarioTimeseries[2]);  // processing_job
		this.perScenarioTimeseriesCollection[1].addSeries(perScenarioTimeseries[3]);  // executed_job
		this.perScenarioTimeseriesCollection[1].addSeries(perScenarioTimeseries[4]);  // suspended_job
		
		this.printChart = ChartFactory.createTimeSeriesChart(
			"Community Status Tracing Overview", // chart title
            "Date/Time",
            "Num. of jobs",
            this.perScenarioTimeseriesCollection[1],                     
            true,                       // include legend
            true,
            false
        );
		
//		this.printChart.addSubtitle(new TextTitle(MaGateParam.numberOfTotalNode + 
//				" nodes and " + MaGateParam.totalNumberOfJob + " jobs in total"));
		this.printChart.addSubtitle(new TextTitle(MaGateParam.currentIterationId));
        
        XYPlot recentJobPlot = (XYPlot) this.printChart.getPlot();
        this.printChart.setBackgroundPaint(Color.white);
        recentJobPlot.setBackgroundPaint(Color.lightGray);
        recentJobPlot.setDomainGridlinePaint(Color.white);
        recentJobPlot.setRangeGridlinePaint(Color.white);
        
        // change the auto tick unit selection to integer units only...
        NumberAxis recentJobPlotRangeAxis = (NumberAxis) recentJobPlot.getRangeAxis();
        recentJobPlotRangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        
        XYLineAndShapeRenderer recentJobPlotlineRenderer = (XYLineAndShapeRenderer) recentJobPlot.getRenderer();
        recentJobPlotlineRenderer.setBaseShapesVisible(true);
        recentJobPlotlineRenderer.setBaseShapesFilled(true);
        
        DateAxis recentJobPlotlineDomainaxis = (DateAxis) recentJobPlot.getDomainAxis();
        recentJobPlotlineDomainaxis.setAutoRange(true);
//        recentJobPlotlineDomainaxis.setFixedAutoRange(1000.0 * 3600 * 24 * 1);  // 1 second * 3600 * 24 * 1 = 1 day
        recentJobPlotlineDomainaxis.setDateFormatOverride(new SimpleDateFormat("H,dd-MMM"));

        recentJobPlot.setDataset(1, this.perScenarioTimeseriesCollection[0]);
        NumberAxis recentJobPlotline_rangeAxis2 = new NumberAxis("Percentage");
        recentJobPlotline_rangeAxis2.setAutoRangeIncludesZero(false);
        recentJobPlot.setRenderer(1, new DefaultXYItemRenderer());
        recentJobPlot.setRangeAxis(1, recentJobPlotline_rangeAxis2);
        recentJobPlot.mapDatasetToRangeAxis(1, 1);
        
        recentJobPlot.getRenderer().setSeriesPaint(0, Color.BLACK); // arrival job
        recentJobPlot.getRenderer().setSeriesPaint(1, Color.BLUE); // scheduling job
        recentJobPlot.getRenderer().setSeriesPaint(2, Color.ORANGE); // processing job
        recentJobPlot.getRenderer().setSeriesPaint(3, Color.GREEN); // executed job
        recentJobPlot.getRenderer().setSeriesPaint(4, Color.GRAY); // suspended job
        recentJobPlot.getRenderer().setSeriesPaint(5, Color.RED); // CE
        
	}
 
开发者ID:huangye177,项目名称:magate,代码行数:64,代码来源:DynamicCommunityPlotter.java


注:本文中的org.jfree.chart.axis.DateAxis.setAutoRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。