jfreechart

JfreeChart Error in Linux/Unix environment

风流意气都作罢 提交于 2019-11-28 14:08:28
I am getting this error in the Linux environment while displaying 3D pie charts on the web browser. It works perfectly fine in the windows environment. java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart at org.jfree.chart.ChartFactory.createPieChart3D(ChartFactory.java:763) I have set the system property System.setProperty("java.awt.headless", "true"); in my java code. On checking the property, it has been set to true successfully. But still i am getting the same error. I suspect your Linux server is running headless. See Using Headless Mode in the Java SE

Hide some category labels in JFreeChart to avoid overlapping

岁酱吖の 提交于 2019-11-28 14:05:38
I'm generating a StackedBarChart using JFreeChart. Depending on the input data I can have a lot of categories (usually between 20 and 40), leading to overlapping of the labels. In the following screenshot you can see the chart with categories from 1 to 38: I'd like to show some of the category labels as reference, but not all. It would be perfect to show the first and last, and every fifth inbetween. Is this possible? I can't change the width of the chart, and making the labels smaller does only work if they are so small that you can't read them anymore... Last resort would be to hide the

Subscript in Axis description

我与影子孤独终老i 提交于 2019-11-28 13:50:55
I wanted to know if it is possible to use subscript in axis description. I have the following code XYItemRenderer lineYY = new StandardXYItemRenderer(); lineYY.setSeriesPaint(0, Color.BLUE); lineYY.setSeriesVisibleInLegend(0,false); final NumberAxis yaxY = new NumberAxis("ax [m/s²]"); yaxY.setRange(-11, 11); yaxY.setAutoRangeIncludesZero(false); XYPlot plotYY = new XYPlot(datasetY,null,yaxY, lineYY); plotYY.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); Is there a way to subscript the x in the String "a x [m/s²]"? An subscript would be e.g. X₉ Using the approach shown here , you can specify

How can i display pie chart in jsp page?

回眸只為那壹抹淺笑 提交于 2019-11-28 13:11:13
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page import="java.awt.*"%> <%@ page import="java.io.*"%> <%@ page import="org.jfree.chart.*"%> <%@ page import="org.jfree.chart.entity.*"%> <%@ page import="org.jfree.data.general.*"%> <% DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("JavaWorld", new Integer(75)); pieDataset.setValue("Other", new Integer(25)); JFreeChart chart = ChartFactory.createPieChart("Sample Pie Chart",pieDataset,true,true,false); %

how to import and plot CSV in Java with timestamp

守給你的承諾、 提交于 2019-11-28 12:44:41
Hi Currently I am trying to import the CSV file into the Java to plot the data, basically, I can import successfully but it does not work in my CSV because it has the time format as: HH:mm:ss MM-dd-yy The data is as follow: 2016-05-15 00:00:00 0 2016-05-15 00:00:00 0 2016-05-15 00:00:00 5.44852 2016-05-15 00:00:01 0 2016-05-15 00:00:01 0 2016-05-15 00:00:01 5.26064 the code is as follow: import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.text.SimpleDateFormat; import org.jfree.chart.axis.DateAxis; import org.jfree.data.time.Minute; import

How to display filtered data in JFreeChart

霸气de小男生 提交于 2019-11-28 12:26:56
问题 My problem is that I cannot display data which is filtered by date from database in JFreeChart. Filtering from database works fine, and it is showed on the console. But how to insert that data into series in dataset. I am still trying to solve this problem. I hope you guys can help. 回答1: You might look at JDBCXYDataset, which can detect a time series based on metadata. Click on the class name to see the corresponding source, for example. 来源: https://stackoverflow.com/questions/15997251/how-to

adding graph chart to a buffer

假装没事ソ 提交于 2019-11-28 12:06:27
问题 I have created web project in struts2.in that i have plotted a graph using jfreechart which i have implemented in my Action class. http://www.java2s.com/Code/Java/Chart/JFreeChartTimeSeriesDemo10withperminutedata.htm which displays the graph in separate applet kind of window i googled and find a way to save this chart as image so that in my jsp file i can include this image. But at the end when i was deploying i had to convert my project into a WAR file but if i convert project to a WAR i

Adding ChartPanel to CardLayout

我们两清 提交于 2019-11-28 11:36:41
问题 I have a pretty basic GUI organized with a GridBagLayout . The most complex portion is the bottom where West is populated with ScrollPane and the right is a panel with a CardLayout that has multiple ChartPanels so I can switch between a few graphs. My issue comes when I start the program. The resizing issue goes away after I resize the frame in any direction. I have confirmed the chartpanel is the issue because not adding this to the CardLayout panel fixes it. I create a blank ChartPanel and

how can I implement a XYLine jfreechart in java

走远了吗. 提交于 2019-11-28 11:24:01
问题 I am new to jfreechart.I want to display a chart based on values from my data base table Table is dns_time with fileds dns_lookup_time,update_time. I want update_time on x-axis and dns_lookup_time on y-axis.And the curve should be displayed according to the values from the database.I am using hibernate and postgresql.Can any one help me how to achieve this.Thank you. 回答1: You might look at JDBCXYDataset, which can detect a time series based on metadata. As noted in the API, "The first column

Change the unit of x axis in JFreeChart Gantt chart

让人想犯罪 __ 提交于 2019-11-28 11:23:30
问题 I'm a beginner in JFreeChart . I want to change the x axis values of this chart to milliseconds, with 5 ms intervals. I've tried axis.setTickUnit(new DateTickUnit(DateTickUnitType.MILLISECOND, 5)); but I keep having a compilation error. I found somme suggestions in the net, but nothing worked for me. Also, is there any way to set a maximum value for the x axis, like 300 ms. import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import