jfreechart

JFreeChart

浪子不回头ぞ 提交于 2019-12-17 14:36:47
JFreeChart核心类库介绍: 研究jfreechart源码发现源码的主要由两个大的包组成:org.jfree.chart,org.jfree.data。其中前者主要与图形 本身有关,后者与图形显示的数据有关。具体研究如果大家有兴趣的话可以自己研究,以后有时间我会告诉大家怎么去 研究源码。 核心类主要有: org.jfree.chart.JFreeChart:图表对象,任何类型的图表的最终表现形式都是在该对象进行一些属性的定制。JFreeChart引擎本身提供了一个工厂类用于创建不同类型的图表对象 org.jfree.data.category.XXXDataSet:数据集对象,用于提供显示图表所用的数据。根据不同类型的图表对应着很多类型的数据集对象类 org.jfree.chart.plot.XXXPlot:图表区域对象,基本上这个对象决定着什么样式的图表,创建该对象的时候需要Axis、Renderer以及数据集对象的支持 org.jfree.chart.axis.XXXAxis:用于处理图表的两个轴:纵轴和横轴 org.jfree.chart.render.XXXRender:负责如何显示一个图表对象 org.jfree.chart.urls.XXXURLGenerator:用于生成Web图表中每个项目的鼠标点击链接 XXXXXToolTipGenerator

JFreeChart中柱状图的详细设置

巧了我就是萌 提交于 2019-12-17 14:36:33
转载自: http://www.java-cn.com/technology/tech/4519.html 在本例中我们对柱状图的基本设置进行了进一步设置 在我们编程时如果要把结果显示成图表形式,就离不开JFreeChart,在本实例中我使用的JFreeChart是1.0.5,下载地址 http://sourceforge.net/projects/jfreechart/ 作者:lingbrother 时间:2007-05-22 07:28 QQ:694300165 email:lingbrother2000@yahoo.com.cn 格言:穿在身上才叫衣服,吃到肚里才叫馍饭,记在心里才叫知识。 //以上材料请转载时保留,谢谢! 本文的规范 1、斜体:文件名、程序名、网址和新定义的变量; 2、粗体:Java2的API; 主要实现的功能: 1、设定纵横坐标的位置 2、设定柱子的颜色 3、将报表保存为图片 4、将报表在窗口上预览 柱状图 : bar charts (regular and stacked, with an optional 3D effect),用到的主要类如下: org.jfree.chart.JFreeChart:图表对象,任何类型的图表的最终表现形式都是在该对象进行一些属性的定制。JFreeChart引擎本身提供了一个工厂类用于创建不同类型的图表对象 org

JFreeChart 之饼图

蹲街弑〆低调 提交于 2019-12-17 14:36:12
JFreeChart 之饼图 一、JFreeChart 简介   JFreeChart是JAVA平台上的一个开放的图表绘制类库。它完全使用JAVA语言编写,是为applications, applets, servlets 以及JSP等使用所设计。JFreeChart可生成饼图(pie charts)、柱状图(bar charts)、散点图(scatter plots)、时序图(time series)、甘特图(Gantt charts)等等多种图表,并且可以产生PNG和JPEG格式的输出,还可以与PDF和EXCEL关联。 二、JFreeChart 的使用   官方网站:http://www.jfree.org/   下载地址:https://sourceforge.net/projects/jfreechart/files/1.%20JFreeChart/ 1、拷贝相关的 Jar (jcommon-1.0.23.jar和jfreechart-1.0.19.jar)到 Java 项目中 2、饼图示例( PieChart3D.java ) 1 package cn.com.zfc.jfreechart; 2 3 import java.awt.Font; 4 import java.io.File; 5 import java.io.IOException; 6 7 import

JFreeChart: DynamicTimeSeries with period of n milliseconds

白昼怎懂夜的黑 提交于 2019-12-17 14:18:14
问题 I'm trying do define an interface in which I want to plot some values received by an external device. These values are received with a frequency that can be set through the interface. Of course the period of the plot should change according to the period defined by the user. So I started to define the followint Chart: int periodMs = 200; MilliDTSC dataset = new MilliDTSC(1,100, new MultipleOfMillisecond(periodMs)); dataset.setTimeBase(new MultipleOfMillisecond(periodMs)) dataset.addSeries

JFreeChart: DynamicTimeSeries with period of n milliseconds

僤鯓⒐⒋嵵緔 提交于 2019-12-17 14:16:37
问题 I'm trying do define an interface in which I want to plot some values received by an external device. These values are received with a frequency that can be set through the interface. Of course the period of the plot should change according to the period defined by the user. So I started to define the followint Chart: int periodMs = 200; MilliDTSC dataset = new MilliDTSC(1,100, new MultipleOfMillisecond(periodMs)); dataset.setTimeBase(new MultipleOfMillisecond(periodMs)) dataset.addSeries

JPanel added but not displayed “in time”

浪子不回头ぞ 提交于 2019-12-17 10:03:04
问题 I have a JFrame that displays JPanels depending on the MenuItem you click. It works, but now I need to call a method once a JPanel is added to the frame and it is being shown (because I'm using JFreeChart inside that panel and I have to call chartPanel.repaint() when the JPanel is visible): this.getContentPane().add( myjpanel, BorderLayout.CENTER ); //this = JFrame this.validate(); myjpanel.methodCalledOnceDisplayed(); Does it seem ok? Is myjpanel being shown really? It seems it is not:

Add values to a specified series in a DynamicTimeSeriesCollection

喜夏-厌秋 提交于 2019-12-17 10:02:58
问题 The program will receive data every second and draw them on time Series chart. However, once I create two series, I cannot add new value to it. It displays a straight line only. How do I append data to a specified series? I.e. YYY . Based on this example, here's what I'm doing: ... // Data set. final DynamicTimeSeriesCollection dataset = new DynamicTimeSeriesCollection( 2, COUNT, new Second() ); dataset.setTimeBase( new Second( 0, 0, 0, 1, 1, 2011 ) ); dataset.addSeries( gaussianData(), 0,

Multiple graphs in multiple figures using jFreeChart

ぐ巨炮叔叔 提交于 2019-12-17 09:59:47
问题 I am trying to use jFreechart to generate two figures each of which with 12 graphs (being referred as series in jFreeChart ). However some of the graphs get simply skipped! I know I have synchronization issue here and tried to used the method the user @trashgod provided me here however I failed. I know the way I use swingworker is wrong ! I dont know how to fix it Each figure should contain 10 graphs which are parallel horizontal straight lines. As you see in the attached image some of the

Multiple axes on the same data

╄→尐↘猪︶ㄣ 提交于 2019-12-17 07:56:28
问题 I'm trying to have two axes on the same data. The data is a couple of DefaultTableXYDatasets . The plot is a XYPlot , and I have two XYLineAndShapeRenderers and one StackedXYAreaRenderer2 . All data is in meters for the y-values, and I want to have one axis displaying it in meters and one axis displaying it in feet. Now this feels like a common thing to do, but I can't decide on the most obvious way to do it. One way that works would be to duplicate the data and have the y-values in feet,

Setting label and value of the chart

落爺英雄遲暮 提交于 2019-12-17 07:55:10
问题 I am creating pie charts using JFreeChart , and I want to set the value and the label seperately like in iReport . In other words, I want the chart to show different results on the pie than in the legend. Is there any way that I can achieve this? 回答1: The MessageFormat ArgumentIndex values correspond to the series name , domain and range . You can set a different generator for each series or for all series in the base. PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new