jfreechart

How to plot a Line Graph in Java using dataset from a text file?

萝らか妹 提交于 2019-11-26 23:34:05
问题 I have written a Java GUI program which opens a text file and reads the data in the left panel. Now I want to display a graph of the data read from the same file on the right panel. I have used JFileChooser to open files and read the data and display them on a text area. I want the data read from the file to be displayed using a two dimensional X-Y graph. The axis of the graph should be labeled using the label information specified in the data file. The values on the X-axis should begin from

Using JFreeChart Scatter Plots is there a Way to Subdivide Styles for Data Sets?

痞子三分冷 提交于 2019-11-26 23:19:56
I am using JFreeChart to render a scatter plot with a couple thousand data points. I control the appearance/style of each ScatterPlotDataset by attaching a suitable XYLineAndShapeRendererper to each data set; eg. points in data set 1 appear as circles and points in data set 2 appear as squares. I would like the user to be able to dynamically assign a sub-style per point in each data set; eg. if the data set were books then the user might wish to color fiction blue and nonfiction red. Is there a way to do this without defining a new data set for each sub style? Incidentally I am carting with

JFreeChart PolarPlot: mathematical orientation

假装没事ソ 提交于 2019-11-26 23:02:34
I'd like to create a polar plot where the data is plotted in mathematical orientation (thus, the series starts and the east and continues counter-clockwise). The default behavior of JFreeChart's PolarPlot is to start north and continue the series clockwise. Is there any support for this built in the PolarPlot class? I know how to transform the data to reach the goal, but this approach is rather cumbersome, since I'd need to adapt the angle labeling too. As an aside, org.jfree.chart.plot.PolarPlot appears to have been designed for navigational and geodetic applications. Using the transformation

How do I rotate tick mark labels on the domain of a number axis in JFreeChart?

▼魔方 西西 提交于 2019-11-26 23:02:01
Just like is being done in the following example, I want the tick mark labels on the domain of chart to be rotated 45 degrees as the are in this chart: http://left.subtree.org/2007/08/14/rotate-labels-jfreechart/ The difference is, I want to do this on a scatter plot with a numeric axis. I can't find an equivalent to setCategoryLabelPositions() in the class NumberAxis. trashgod The method setVerticalTickLabels() may be an alternative. If not, I don't see any choice but to override refreshTicksHorizontal() . See also this example . import java.awt.Color; import java.awt.Dimension; import java

scatter plot in jfreechart from database

假如想象 提交于 2019-11-26 22:26:31
问题 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{

JFreeChart - How to show real-time on the X-Axis of a TimeSeries chart

ぐ巨炮叔叔 提交于 2019-11-26 22:25:10
问题 I want to show live data on a TimeSeries chart with real time shown on the x-axis (or at least have the speed of the time the same as real-time). Here is a SSCCE of the problem with random numbers as the live input. The time shown on the x-axis is much faster than real-time (assuming it is shown in hh:mm:ss format): public class DynamicTimeSeriesChart extends JPanel { private DynamicTimeSeriesCollection dataset; private JFreeChart chart = null; public DynamicTimeSeriesChart(final String title

Setting histogram breaks in JFreeChart

旧时模样 提交于 2019-11-26 22:06:55
问题 I am using JFreeChart to draw histograms by filling a HistogramDataset object with my data and using the ChartFactory.createHistogram(). However, So far I have not been able to find anything in the documentation on how to set the breaks of the histogram. Am I missing anything, or does JFreeChart nog offer this functionality? To illustrate what I mean with breaks, see the following two histograms generated from the same data with identical number of bins, but with different breaks. Note how

JFreeChart DynamicTimeSeriesCollection with a period of n milliseconds

随声附和 提交于 2019-11-26 21:58:33
问题 I'm trying to define an applet with a chart that have to be updated every n milliseconds. For example every 500 milliseconds. This is a part of the code: dataSet = new DynamicTimeSeriesCollection(1, 200, new Millisecond()); dataSet.setTimeBase(new Millisecond()); When I launch the application it returns me a NullPointerException raised by the second line. If I replace Milliseconds with Seconds it works. The question is: how can I set a period of n milliseconds without having exceptions?

JFreeChart : how do you put multiple charts into a composite chart

泄露秘密 提交于 2019-11-26 21:53:30
问题 In JFreeChart is there a notion of a composite Chart. I need to layout several charts in a grid like arrangement. Each chart in the grid needs to have its own separate title. I would like to be able to save this composite chart into a png file I would get a code snippet that explains how to do this. 回答1: As shown here, ChartPanel can be placed in any desired Swing layout. The example cited uses GridLayout . ChartUtilities has methods for rendering a chart as a .png . I see several approaches

JFreechart draw arc on chart

左心房为你撑大大i 提交于 2019-11-26 21:07:39
I have 2 questions 1)I am trying to draw an arc on an XYplot using the shape annotation. I used the XYLine annotation to draw a line and I want the arc to start where the line ends. I am having some issues with the parameters.I want the arc to have a height of 17, width 44, and start at the point(3.0, 17) of the plot(this is where the line ends). But the code below does not work. Can someone please tell me what is wrong with the code? Arc2D.Double arc = new Arc2D.Double(3.0, 16.9, 44.0, 17.04, 180.0, 180.0, Arc2D.OPEN ); plot.addAnnotation(new XYShapeAnnotation(arc, new BasicStroke(2.0f),