jfreechart

JFreechart: Displaying X axis with values after specific units

醉酒当歌 提交于 2019-11-27 22:50:22
问题 I am using jfreechart for displaying line graph.Now, on X axis it shows value for every (x,y) pair on chart.As a result the X axis has huge amount of values getting overlapped.I want to display few values eg after every 5 units or something like that.How is this possible using Jfreechart. 回答1: Before the NumberAxis of the chart's plot is drawn, its tick marks are refreshed. The result is a List that includes a NumberTick object for each tick mark of the axis. By overriding the function

Add BufferedImage to PDFBox document

蹲街弑〆低调 提交于 2019-11-27 21:01:51
问题 In my current project, I try to add a BufferedImage to a PDFBox document. More specificly, I use an image from a JFreeChart . My code looks like this: public void exportToPDF(JFreeChart chart, String filePath){ PDDocument doc = null; PDPage page = null; PDXObjectImage ximage = null; try { doc = new PDDocument(); page = new PDPage(); doc.addPage(page); PDPageContentStream content = new PDPageContentStream(doc, page); BufferedImage image = chart.createBufferedImage(300, 300); ximage = new

Jfreechart柱形图详细设置!

丶灬走出姿态 提交于 2019-11-27 20:46:58
[b]一. 下载与环境配置[/b] 此最新版本为 1.0.13 解压jfreechart-1.0.13.zip 将lib目录下的jfreechart-1.0.13.jar 、jcommon-1.0.16.jar 复制到工程 WEB-INF\lib 文件夹中 [b]二. 配置[/b] 我是用Struts1.2开发的。 在工程的web.xml 文件中添加 <servlet> <servlet-name>DisplayChart</servlet-name> <servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class> </servlet> <servlet-mapping> <servlet-name>DisplayChart</servlet-name> <url-pattern>/DisplayChart</url-pattern> </servlet-mapping> [b]三. 生成柱形图[/b] 新建个Action 最好是继承DispatchAction public ActionForward toBarPic(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response

Invalid or corrupt JAR File built by Maven shade plugin

安稳与你 提交于 2019-11-27 19:18:52
After adding the Maven jFree dependency to my existing application, I'm not able to execute the created jar. The only error message I get is the following: java -jar target/com.company.product-1.0.0-SNAPSHOT.jar Error: Invalid or corrupt jarfile target/com. company.product-1.0.0-SNAPSHOT.jar The complete pom.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0<

Jfreechart - Refresh a chart according to changing data

↘锁芯ラ 提交于 2019-11-27 18:04:31
问题 I would like to know how to refresh a chart if we want to change "in live" some piece of data. I mean for instance, I have a chart with a TaskSeries which appears on 3 years and I would like to change 3 years by 5 years. I want the chart to change immediately. Is there some kind of update chart or something like that ? I know that you could say "get your TaskSeries, do your changes and it will be refreshed automatically" but my TaskSeries are generated and I cannot easily change these ones.

How can I fix this code so I can add this JFreeChart to a panel

╄→гoц情女王★ 提交于 2019-11-27 16:28:07
I am trying to make a chart that is embedded specifically in a panel on a JInternalFrame ; it is a pie chart from the library JFreeChart . I want to embed the chart on a panel which goes by the variable name jpPaneles , but it has proven to be impossible. This is really crucial for my project, so if anyone has the time to help me out, I would greatly appreciate it. I am working in NetBeans GUI editor. Here is the code and you can see I try to add frame1 to a panel. import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFrame; import org.jfree.chart.JFreeChart; import org.jfree.chart

Plotting multiple regression lines through different Y-Intercepts and X-values

怎甘沉沦 提交于 2019-11-27 16:27:41
I am trying to through a linear regression line through individual separate clusters of data that share the same slope. However, though I have successfully plotted differing colors for the points themselves and graphed those successfully, my attempt at the line is not working. Earlier I tried a hashset that ran through calling out the clusters by colors but that caused issues with the order in which the lines came in. In this attempt, I tried to link the clusters through a number attachment and then call the lines based on that. The first part of the code isn't really relevant as I didn't

Real time graph plotting starting time

梦想与她 提交于 2019-11-27 16:25:05
Here is code based on @trashgod's example about real time plotting: import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.DateAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.data.time.DynamicTimeSeriesCollection; import org.jfree.data.time.Second; /** * @see https://stackoverflow.com/a

Need help to open a subchart from a main chart?

本秂侑毒 提交于 2019-11-27 16:23:30
I have the following chart: Now my problem is I want to open a new chart containing the information for Linux OS when a user clicks on Linux portion of chart, shown in red. I have tried this: //check if Linux OS is clicked on chart... if("Linux".equals(chartMouseEvent.getEntity().getToolTipText())) { //open new chart having the information for Linux } But I think there may be some better alternate to do the same job. So please help if you know how to achieve this. ChartEntity is a good choice, but getToolTipText() is not the only resource available. The getURLText() method is also handy, using

scatter plot in jfreechart from database

拜拜、爱过 提交于 2019-11-27 16:22:11
How can i draw scatter plot of datas in mysql database table using jfreechart in java. I have used swing library. Any link would be helpful. I searched google but couldnot find a understanding solution. If you have got code just provide me. Actually i did do barchart and plot it using jfreechart. The code i used for my barchart is here. Here display3 function displays the barchart. How can i modify it to display scatter plot? public void display3() throws SQLException, ClassNotFoundException{ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String JDBC_DRIVER="com.mysql.jdbc