jfreechart

JFreeChart XYSplineRenderer Demo

时光毁灭记忆、已成空白 提交于 2019-12-02 05:17:21
问题 Would someone please point me to a working example JFreeChart's XYSplineRenderer? 回答1: Although I've never seen the example, XYSplineRendererDemo1.java is one that may be found among the demos. All the demos are included with the developer guide † , which I recommend highly. If you want to assay an example of your own, note that XYSplineRenderer is an XYLineAndShapeRenderer , so start with a matching ChartFactory. It looks like they all take an XYDataset . † Disclaimer: Not affiliated with

JFreeChart CategoryDataset - Axis refresh/repaint problems

浪尽此生 提交于 2019-12-02 05:16:25
I'm having issues with refreshing/repainting a BarChart after setting a zero value of a CategoryDataset to a very large number. private class Test extends ApplicationFrame { private DefaultCategoryDataset set; public Test( String newTitle) { super(newTitle); set = new DefaultCategoryDataset(); set.addValue(0, "Test", "1"); JFreeChart barChart = ChartFactory.createBarChart( "Test", "Category", "Score", set, PlotOrientation.VERTICAL, true, true, false); JPanel mainPanel = new JPanel(new GridLayout()); ChartPanel chartPanel = new ChartPanel(barChart); chartPanel.setPreferredSize(new java.awt

Pan chart using mouse - Jfreechart

走远了吗. 提交于 2019-12-02 04:30:22
问题 Can we implement the pan functionality as a mouse drag event in JfreeChart? Right now I press CTRL and drag my mouse to pan a chart. I want to implement the pan functionality just by dragging the mouse. Is that possible ? 回答1: It is apparently impossible to change the modifier key with the current JFreeChart API, as discussed here (but it is in the pipeline). However, everything is there to pan a chart programmatically, so you could try the following: Add a MouseMotionListener to your

How would I create a JFreeChart scatterplot best fit line

被刻印的时光 ゝ 提交于 2019-12-02 04:11:35
I have an arraylist of points I want to include in a JFreeChart scatterplot. That works fine, but I now want a best fit line on it. After some searching, JFreeChart doesn't support such calculations directly, so what I want to do is calculate it myself and then stick a line into the chart manually. How do I get a line in a scatterplot? XYSeries series = new XYSeries("Data"); for (Point p : points) { series.add(p.getX(), p.getY()); } XYSeriesCollection dataset = new XYSeriesCollection(series); JFreeChart chart = ChartFactory.createScatterPlot(chartName, "Mass", parameter, dataset,

How to set Jfree GanttChart Subtasks Color and labels

我怕爱的太早我们不能终老 提交于 2019-12-02 04:11:23
I am using the Jfree Charts to display Gantt Chart.I have to display differnt colors to the subtasks that are present under one series. For Example if I have 5 tasks in series One: each task should have different color Also,I need to print label for each task . I tried many ways but not successful and could only set the series color alone. Please can any one help. Thank you. trashgod One approach is to override getItemPaint() in your subclass of GanttRenderer . Just return a different color for each column . Addendum: I would need to paint the subtask depending on the task completed or not

JFreechart Polar Chart shape annotation

偶尔善良 提交于 2019-12-02 04:07:56
I am trying to color different region of a polar chart with different colors. e.g coloring the region between the angle 20 and 60 and between the radii 2 and 4. How can I do this? I was thinking of using a shape annotation and from there drawing an arc, but it seems there is no shape annotation for polar plots. Any ideas? Thank you import java.awt.Color; import java.awt.Dimension; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis

How to set the JFreeChart X axis data titles?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 04:03:32
Attached my code snippet here, I am using XYStepChart from chart factory. The x-axis scale at output for the code is being displayed in scale of eg: 05:30:00:00 , 05:30:00:01 , 05:30:00:00 . But I need in values like 1,2,3,4. package org.jfree.chart.demo; import java.awt.BasicStroke; import java.awt.Color; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFrame; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy

Open new frame or chart when a bar or a bar chart is clicked

亡梦爱人 提交于 2019-12-02 03:50:34
I have a bar chart which gets the dataset from the mysql database, and I am stuck on using the chartMouseClicked . Currently the code prints when clicked on x or y axis bars, as I learned in a previous question , but how do I set that when I click a particular bar on x or y axis and open a new frame or chart. Also an information box would be fine. private void lineChart() { // *************** ADDING BAR CHART FROM DATABASE ***************************** try { String sql = "select Region, Male, Female from ObeseLondon limit 14"; JDBCCategoryDataset dataset = new JDBCCategoryDataset(MySQL

Plotting a locus in XY space using JFreeChart

空扰寡人 提交于 2019-12-02 03:43:55
I would like to plot the locus of a particle in two dimensional space. My data is a sequence of X,Y coordinates and I would like to plot these. Would appreciate any pointers to examples that show how to do this. An example of a locus plot can be seen below: Note: I'd like to show the path as a continuous line with arrows showing the direction of motion. Thanks. trashgod ChartFactory.createScatterPlot() , illustrated here , might be a good starting point. FastScatterPlot , cited here and illustrated here , may be required for larger datasets. Addendum: Looking at your revised question, I've not

Limit JFreeChart TimeSeries to Business Hours

佐手、 提交于 2019-12-02 03:39:07
Rendering a chart over several days, with a dataset that has 24 hour data, but it's only useful during M-F, 7AM to 5PM. If I setup a time series with the code below, I get a chart that contains all 24 hours, 7 days a week. Makes sense, but not for my use case. Is there a way to define what interval the time series displays? Or do I need to use a different chart type and attempt to fit my data into regular periods? I hope not the latter, while the data I receive is usually in 30 second intervals, there can easily be gaps. It's pretty impossible to post an SSCE of a working UI with a chart