jfreechart

Java - how to receive point coordinates after mouse button release (JFreeChart)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 03:46:06
问题 I wrote a simple parabola plot using JFreeChart. I get graphic point coordinates, when mouse button pressed and i also want to get graphic point coordinates, when mouse button released. But chartMouseMoved don't work while mouse button pressing. How can I solve my problem and get graphic coordinates after mouse button releasing? This is my code: package parabolademo; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.geom.Point2D; import java.awt.geom

How to display legend for Pie Chart in columns?

末鹿安然 提交于 2019-12-17 02:33:12
问题 I have a PieChart with many sections, legend for this PieChart renders as one row. How to render legend as two columns? 回答1: The method getLegendItem() , seen here, provides all the information needed to render a legend item in any Container you choose. GridLayout(0, 2) will arrange them in two columns for any number of rows. To suppress the existing legend, set legend to false when you call your chart factory; the items will still be available, as suggested here. Addendum: Based on

JFreeChart MouseListener doesn't resolve chart elements

。_饼干妹妹 提交于 2019-12-17 02:32:12
问题 I've got stacked bar chart where I want to be able to select individual bars in the stack. But ChartMouseListener doesn't resolve ChartMouseEvent into corresponding ChartEntity. Here's the listener snippet : public void chartMouseClicked(ChartMouseEvent event){ ChartEntity entity = event.getEntity(); if(entity != null && (entity instanceof XYItemEntity) ){ XYItemEntity item = (XYItemEntity)entity; renderer.select(item.getSeriesIndex(), item.getItem()); return; } // deselect renderer.select(-1

How do I change a JFreeChart's size

眉间皱痕 提交于 2019-12-16 19:59:06
问题 I've added a JFreeChart to a JPanel (using a BorderLayout ), and it's huge . Is there something I can do to make it smaller? public void generateChart() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); //set the values of the chart for(int i=0; i<8; i++) { dataset.setValue(income_array[i], "Income", Double.toString(percent_array[i])); } JFreeChart chart = ChartFactory.createBarChart( "Required Annual Income for a Variety of Interest Rates", "Percent", "Income", dataset,

How do I change a JFreeChart's size

拟墨画扇 提交于 2019-12-16 19:56:03
问题 I've added a JFreeChart to a JPanel (using a BorderLayout ), and it's huge . Is there something I can do to make it smaller? public void generateChart() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); //set the values of the chart for(int i=0; i<8; i++) { dataset.setValue(income_array[i], "Income", Double.toString(percent_array[i])); } JFreeChart chart = ChartFactory.createBarChart( "Required Annual Income for a Variety of Interest Rates", "Percent", "Income", dataset,

Using JFreeChart to display recent changes in a time series

限于喜欢 提交于 2019-12-16 18:49:09
问题 How can I use JFreeChart to display just the most recent data in a continually updated time series? Addenda: A complete, working example that incorporates the accepted answer is shown here. See also this variation having two series. See also this Q&A regarding setTimeBase() . 回答1: You can also eliminate the zero by first advanceTime() , then appendData . (swap the way they are doing it in the example). 回答2: The JFreeChart class DynamicTimeSeriesCollection is a good choice. Addendum: As noted

JFreeChart Maximum Zoom Out

点点圈 提交于 2019-12-14 03:55:45
问题 I am working with JFreeChart to create a line graph via an XYPlot which is embedded into an application. The graph is contained within a ChartPanel and added to the background panel of my GUI. My issue is that the XYPlot appears so zoomed in that I am unable to see any of the lines; simply the whitespace background each side of them! Is there a way to view the component at its "maximum zoomed out" state so that the graph is understandable? Many thanks :) 回答1: The setZoomInFactor() method

JFreeChart XY-chart that refreshes with new set of data? Example?

核能气质少年 提交于 2019-12-14 03:42:47
问题 I want to learn how to learn how to create some charts with jfreechart and googlefor some examples. but I couldn't find what I need. This here is good http://www.java2s.com/Code/Java/Chart/CatalogChart.htm but doesn't have a refreshing graph with new displayed values. I would like to redraw a chart every nth seconds because I update an external dile witha set of values I want to display here. So how do I tell jfreechart to refresh the drawn graph and display it onthe canvas? Thanks in advance

Use different datasets on the Same Jfreechart Piedataset

醉酒当歌 提交于 2019-12-14 03:10:00
问题 Hi Friends I have a DefaultPieDataset that am Creating this way: package business.intelligence.system; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JInternalFrame; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import javax.swing.*; import java.sql.Connection; import java.sql

Jfree chart xy line implementation

谁说胖子不能爱 提交于 2019-12-14 03:02:04
问题 I want to plot 4 lines in one dataset but I cannot. Could any1 tell me what libs in need in jfree and how I can implement them in 1 chart public void visualise(){ //visualise data XYSeries series = new XYSeries("Membrane mVolt"); XYSeries series2 = new XYSeries("potassium_channel_n_gate_n"); XYSeries series3 = new XYSeries("sodium_channel_h_gate_h"); XYSeries series4 = new XYSeries("sodium_channel_m_gate_m"); //add data to charts for(int l=0;l<301;l++){ series.add(tData[l], YData[0][l]);