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


Java DateAxis.setTickLabelFont方法代码示例

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


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

示例1: TimeSeriesChart

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public TimeSeriesChart() {
    XYDataset xydataset = createDataset();
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General单位信托基金价格", "日期", "价格", xydataset, true, true, true);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    frame1 = new ChartPanel(jfreechart, true);
    dateaxis.setLabelFont(new Font("黑体", Font.BOLD, 14));         //水平底部标题
    dateaxis.setTickLabelFont(new Font("宋体", Font.BOLD, 12));  //垂直标题
    ValueAxis rangeAxis = xyplot.getRangeAxis();//获取柱状
    rangeAxis.setLabelFont(new Font("黑体", Font.BOLD, 15));
    jfreechart.getLegend().setItemFont(new Font("黑体", Font.BOLD, 15));
    jfreechart.getTitle().setFont(new Font("宋体", Font.BOLD, 20));//设置标题字体

}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:16,代码来源:TimeSeriesChart.java

示例2: getChartPanel

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public ChartPanel getChartPanel(List<String> industrys) {
    XYDataset xydataset = createDataset(industrys);
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("行业资金流入流出", "日期(日/单位)", "价格(亿/单位)", xydataset, true, true, true);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd"));
    dateaxis.setLabelFont(new Font("黑体", Font.BOLD, 14));         //水平底部标题
    dateaxis.setTickLabelFont(new Font("宋体", Font.BOLD, 12));  //垂直标题
    ValueAxis rangeAxis = xyplot.getRangeAxis();//获取柱状
    rangeAxis.setLabelFont(new Font("黑体", Font.BOLD, 15));
    jfreechart.getLegend().setItemFont(new Font("黑体", Font.BOLD, 15));
    jfreechart.getTitle().setFont(new Font("宋体", Font.BOLD, 20));//设置标题字体
    ChartPanel frame1 = new ChartPanel(jfreechart, true);
    return frame1;
}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:16,代码来源:IndustryTimeSeriesChart.java

示例3: getChartPanel

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public ChartPanel getChartPanel(List<String> industrys) {
    XYDataset xydataset = createDataset(industrys);
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("行业涨跌", "日期(日/单位)", "价格(%/单位)", xydataset, true, true, true);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd"));
    dateaxis.setLabelFont(new Font("黑体", Font.BOLD, 14));         //水平底部标题
    dateaxis.setTickLabelFont(new Font("宋体", Font.BOLD, 12));  //垂直标题
    ValueAxis rangeAxis = xyplot.getRangeAxis();//获取柱状
    rangeAxis.setLabelFont(new Font("黑体", Font.BOLD, 15));
    jfreechart.getLegend().setItemFont(new Font("黑体", Font.BOLD, 15));
    jfreechart.getTitle().setFont(new Font("宋体", Font.BOLD, 20));//设置标题字体
    ChartPanel frame1 = new ChartPanel(jfreechart, true);
    return frame1;
}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:16,代码来源:IndustryRiseChart.java

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

示例5: createChart

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public JFreeChart createChart(Collection<Data> datas) {
    TimeSeries t1 = new TimeSeries("S1");
    Iterator<Data> iter = datas.iterator() ; 
    Data data ;
    while (iter.hasNext()) {
        data = iter.next();
        t1.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class, new Date((Long)data.getP2()), TimeZone.getDefault()), data.getValue());
    }
    XYDataset dataset = new TimeSeriesCollection(t1);
    JFreeChart chart = ChartFactory.createTimeSeriesChart(
            null,
            null, 
            null, 
            dataset, 
            false,
            false, 
            false
    );
    chart.setAntiAlias(true);
    chart.setTextAntiAlias(true);
    chart.setBackgroundPaint(Color.WHITE);
    //
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setNoDataMessage("No Data to Display");
    plot.setDomainGridlinesVisible(true);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setInsets(new RectangleInsets(5,14,0,5));
    //
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(ssdf);
    axis.setTickLabelFont(TICK_FONT);
    ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setTickLabelFont(TICK_FONT);
    //
    return chart;
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:37,代码来源:GsnChartJfreechart.java

示例6: updatePlotter

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
@Override
protected void updatePlotter() {
	int categoryCount = prepareData();
	String maxClassesProperty = ParameterService
			.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
	int maxClasses = 20;
	try {
		if (maxClassesProperty != null) {
			maxClasses = Integer.parseInt(maxClassesProperty);
		}
	} catch (NumberFormatException e) {
		// LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.",
		// LogService.WARNING);
		LogService.getRoot().log(Level.WARNING,
				"com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
	}
	boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;

	JFreeChart chart = createChart(this.dataset, createLegend);

	// set the background color for the chart...
	chart.setBackgroundPaint(Color.white);

	// domain axis
	if (axis[INDEX] >= 0) {
		if (!dataTable.isNominal(axis[INDEX])) {
			if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
				DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
				domainAxis.setTimeZone(Tools.getPreferredTimeZone());
				chart.getXYPlot().setDomainAxis(domainAxis);
				if (getRangeForDimension(axis[INDEX]) != null) {
					domainAxis.setRange(getRangeForDimension(axis[INDEX]));
				}
				domainAxis.setLabelFont(LABEL_FONT_BOLD);
				domainAxis.setTickLabelFont(LABEL_FONT);
				domainAxis.setVerticalTickLabels(isLabelRotating());
			}
		} else {
			LinkedHashSet<String> values = new LinkedHashSet<String>();
			for (DataTableRow row : dataTable) {
				String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
				if (stringValue.length() > 40) {
					stringValue = stringValue.substring(0, 40);
				}
				values.add(stringValue);
			}
			ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]),
					values.toArray(new String[values.size()]));
			categoryAxis.setLabelFont(LABEL_FONT_BOLD);
			categoryAxis.setTickLabelFont(LABEL_FONT);
			categoryAxis.setVerticalTickLabels(isLabelRotating());
			chart.getXYPlot().setDomainAxis(categoryAxis);
		}
	}

	// legend settings
	LegendTitle legend = chart.getLegend();
	if (legend != null) {
		legend.setPosition(RectangleEdge.TOP);
		legend.setFrame(BlockBorder.NONE);
		legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
		legend.setItemFont(LABEL_FONT);
	}

	AbstractChartPanel panel = getPlotterPanel();
	if (panel == null) {
		panel = createPanel(chart);
	} else {
		panel.setChart(chart);
	}

	// ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
	panel.getChartRenderingInfo().setEntityCollection(null);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:75,代码来源:SeriesChartPlotter.java

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

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

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

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

示例11: create

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
 * Create one empty chart panel with default settings. No
 * associated datasets.
 */
static SyncedChartPanel create(int id, boolean shapesInCharts) {
    if (logdog.DEBUG) {
        Logger.log("SyncedChartPanel.createChartPanel() entering");
    }

    JFreeChart chart = createTimeSeriesChart();
    chart.setBackgroundPaint(new Color(248, 248, 248));

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    Color gridColor = new Color(200, 200, 200);
    plot.setDomainGridlinePaint(gridColor);
    plot.setRangeGridlinePaint(gridColor);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    // Set up X-axis using ms-time format.
    DateAxis domainAxis = (DateAxis) plot.getDomainAxis();
    domainAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss.SSS"));
    domainAxis.setTickLabelFont(sFontPlain);

    return new SyncedChartPanel(id, chart, shapesInCharts);

    //return new SyncedChartPanel(id, chart, shapesInCharts);

    // // The content pane uses BorderLayout by default.
            // Container contentPane = getContentPane();

            // // This adds a horizontal scrollbar but also rescales the entire
            // // component inluding fonts which make it look weird. The legend is also
            // // scrolled which isn't desirable. The height parameter has no meaning
            // // since this is the CENTER panel and it fills the entrie area allocated
            // // to it.
            // // mChartPanel.setPreferredSize(new Dimension(3000, 100));
            // // JScrollPane scrollPane = new JScrollPane(mChartPanel);
            // // contentPane.add(scrollPane, BorderLayout.CENTER);
            // /////

            // // JPanel centerPanel = new JPanel();
            // // BoxLayout centerLayout = new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS);
            // // centerPanel.setLayout(centerLayout);
            // // centerPanel.add(mChartPanel);
            // // centerPanel.add(new ChartScrollBar(JScrollBar.HORIZONTAL, mChart));
            // // contentPane.add(centerPanel, BorderLayout.CENTER);

            // contentPane.add(mChartPanel, BorderLayout.CENTER);

            // pack();
}
 
开发者ID:sonyxperiadev,项目名称:logdog,代码行数:54,代码来源:SyncedChartPanel.java

示例12: updatePlotter

import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
@Override
protected void updatePlotter() {
    int categoryCount = prepareData();
    String maxClassesProperty = ParameterService.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
    int maxClasses = 20;
    try {
        if (maxClassesProperty != null)
            maxClasses = Integer.parseInt(maxClassesProperty);
    } catch (NumberFormatException e) {
        //LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.", LogService.WARNING);
        LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
    }
    boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;

    JFreeChart chart = createChart(this.dataset, createLegend);

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // domain axis
    if (axis[INDEX] >= 0) {
        if (!dataTable.isNominal(axis[INDEX])) {
            if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
                DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
                domainAxis.setTimeZone(Tools.getPreferredTimeZone());
                chart.getXYPlot().setDomainAxis(domainAxis);
                if (getRangeForDimension(axis[INDEX]) != null)
                    domainAxis.setRange(getRangeForDimension(axis[INDEX]));
                domainAxis.setLabelFont(LABEL_FONT_BOLD);
                domainAxis.setTickLabelFont(LABEL_FONT);
                domainAxis.setVerticalTickLabels(isLabelRotating());
            }
        } else {
            LinkedHashSet<String> values = new LinkedHashSet<String>();
            for (DataTableRow row : dataTable) {
                String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
                if (stringValue.length() > 40)
                    stringValue = stringValue.substring(0, 40);
                values.add(stringValue);
            }
            ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]), values.toArray(new String[values.size()]));
            categoryAxis.setLabelFont(LABEL_FONT_BOLD);
            categoryAxis.setTickLabelFont(LABEL_FONT);
            categoryAxis.setVerticalTickLabels(isLabelRotating());
            chart.getXYPlot().setDomainAxis(categoryAxis);
        }
    }

    // legend settings
    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setPosition(RectangleEdge.TOP);
        legend.setFrame(BlockBorder.NONE);
        legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
        legend.setItemFont(LABEL_FONT);
    }

    AbstractChartPanel panel = getPlotterPanel();
    if (panel == null) {
        panel = createPanel(chart);
    } else {
        panel.setChart(chart);
    }

    // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
    panel.getChartRenderingInfo().setEntityCollection(null);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:68,代码来源:SeriesChartPlotter.java

示例13: 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.setTickLabelFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。