jfreechart

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

寵の児 提交于 2019-11-26 16:49:20
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.Rectangle2D; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartMouseEvent; import org.jfree

Adding ChartPanel to JTabbedPane using JPanel

半腔热情 提交于 2019-11-26 15:31:40
I want to add JFreeChart to JPanel and then add JPanel to JTabbedPane . I managed to display JFreeChart on JFrame , but I want to add JFreeChart as a 4th tab of JTabbedPane . Code to display Chart: public class Chart extends javax.swing.JPanel { private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JPanel jPanel1 = new JPanel(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(60, "Marks", "Student 1"); dataset.setValue(40, "Marks", "Student 2"); dataset.setValue(90, "Marks", "Student 3"); dataset.setValue(50, "Marks", "Student 4"); dataset

JFreechart candlestick chart weird behaviour on drag

ε祈祈猫儿з 提交于 2019-11-26 15:30:32
This is a follow up question from this question . What happens is the following: When I launch the graph and I drag the graph around, something weird happens: at a certain interval, it seems every 7 periods, the candlesticks get smaller and smaller untill they are only a stripe. Then when I drag further, they become thicker again until they are normal size again. This seems to happen for every 7 periods. An example of this phenomenon is displayed on to the following 3 pictures: The following code will show exactly what I mean. Just compile and run it. Then press and hold CTRL and click and

Avoid item label overlap in time series 1D plots (JFreeChart)

 ̄綄美尐妖づ 提交于 2019-11-26 14:57:54
问题 I am trying to find the best strategy to produce a 1D time based plot with labels. It currently looks like this: The problem is there is spans of time where very little happens, and others with high density. What I would like to achieve is to distort the time axis so that in the dense areas the labels are spaced apart to avoid overlap. Alternatively, I could imagine to show the actual data points without axis distortion, but distribute the labels so that they do not overlap. EDIT : This is my

JfreeChart: Stacked Bar Chart and CategoryAxis showing dates

家住魔仙堡 提交于 2019-11-26 14:55:08
问题 I have created a stacked bar chart in which I show a count on the y axis and dates on the x axis. The problem is that when I have many dates on the x axis it gets very cluttered and impossible to read. I would like to show only some of the dates, e.g one date per week. Is that possible? I am using ChartFactory.createStackedBarChart() to create the chart, and I have the data in a DefaultCategoryDataSet . Any input is appreciated! 回答1: For a CategoryAxis, which is used the for the domain axis

JFreeChart change data in an existing bar chart

元气小坏坏 提交于 2019-11-26 14:53:56
问题 I want to change a bar chart data in a loop and I have no idea how to do that. My code: DefaultCategoryDataset barChartData = new DefaultCategoryDataset(); barChartData.setValue(0, "Values","1"); barChartData.setValue(0, "Values","2"); barChartData.setValue(0, "Values","3"); JFreeChart barChart = ChartFactory.createBarChart("Proxi", "Sensors", "Value", barChartData, PlotOrientation.VERTICAL, false, true, false); CategoryPlot barchrt = barChart.getCategoryPlot(); barchrt.setRangeGridlinePaint

How to use SwingWorker?

若如初见. 提交于 2019-11-26 14:53:53
问题 Friends, i am developing a java application. Thats for performance monitoring. on that i am getting values in one class and drawing a graph in another class. i want to use swingworker to perform those two class alternatively. ResultSet rs; Connection conn = null; conn = (Connection)getMySqlConnection(); Statement st = conn.createStatement(); rs = st.executeQuery("SHOW GLOBAL STATUS"); while(rs.next()) { Map_MySql.put(rs.getString(1), rs.getString(2)); } conn.close(); Above class for

JFreeChart: X Axis contains time stamps

我的未来我决定 提交于 2019-11-26 14:51:44
问题 I need to change this code in such a way that X Axis contains time stamps in the format "H:M", e.g. 10:00. private static XYDataset createCategoryDataset(Map<Integer,List<Task>> staffLevels) { String series1 = "Task demand"; DefaultXYDataset dataset = new DefaultXYDataset(); double[][] data = new double[2][staffLevels.size()]; int min_per_hour = 60; for (int i=0; i<staffLevels.size(); i++) { int seconds = i*Parameters.MIN_TIME_UNIT*60; int hours = (i*Parameters.MIN_TIME_UNIT) / min_per_hour;

JFreechart从入门到放弃

妖精的绣舞 提交于 2019-11-26 14:06:47
JFreechart从入门到放弃 觉得有用的话,欢迎一起讨论相互学习~ Follow Me 参考文献 http://www.jfree.org/jfreechart/ 引言 干嘛用的 使用java画图,有时候论文代码使用java实现,为了使用java也能够画出像样的图形,而不是单独调用python 或者matlab来画图。我使用Jfreechart 官网 ,其中也会有教程。 Github .开源软件包,免费使用。 安装常见问题 根据( https://bbs.csdn.net/topics/110051940)认为引入jcommon.jar,log4j.jar可以解决这个问题,事实证明,的确如此 ! JFreechart教程 Jfreechart绘制漂亮的图表 Jfreechart中文API和属性详解 下载Code PS:转载这为大神的连接~个人觉得非常不错 Note 在我的研究后期,我想随着算法的迭代自动画出点的 三维分布 ,但是很遗憾的是 包括JFreeChart 在内的java开发包 都没有能够画多维数据的 ,毕竟JAVA不是设计为数据分析的语言。 所以即使我算法使用java行编程,但是后期的分析流程还是使用python进行 来源: https://www.cnblogs.com/cloud-ken/p/11323288.html

JFreechart series tool tip above shape annotation

旧城冷巷雨未停 提交于 2019-11-26 13:51:05
I have an XYPlot on which are series and a couple of dynamically added shape annotations with no fill (hence each of the series points are visible). Is it possible to display the series tool tips(that show the coordinate of the series point over which the mouse pointer is currently pointing to) over the annotations? Or how can I re-arrange the elements in order to make the tooltip visible. I suspect you are adding the shape annotations to the plot, where they are drawn last. Instead, add them to the renderer in Layer.BACKGROUND . As shown below, the circle does not obscure the tool tip at (20,