jfreechart

JFreeChart: Dynamic point selection in ChartPanel using ChartMouseListener and mouse move

独自空忆成欢 提交于 2019-12-11 20:59:28
问题 I have a chart using JFreeChart where after click it put the markers on a related position (see figure below). What I need is to change the position not after click but on mouse move. I know that using a module ChartMouseListener I can extend its functionlity. ChartMouseListener l = new ChartMouseListener() { @Override public void chartMouseMoved(ChartMouseEvent e) { int newX = e.getTrigger().getX(); int newY = e.getTrigger().getY(); System.out.println("chartMouseMoved to " + newX + " " +

Reading in a CSV file, and plotting the values in a graph using MVC

五迷三道 提交于 2019-12-11 18:35:18
问题 I am trying to plot values from a csv file into a graph, using Java, JFreeChart and using the MVC concept. At the minute, I have created a button, and when this button is clicked it adds a new plot to the graph, however instead of doing this, I would like it to read in the values from the csv file, which is read in by a csv file adapter and stored in the model. I wondering if anyone could help me with this. I would appreciate any help that could be given. Thank you //Main Class public class

Get currently displaying tooltip

旧城冷巷雨未停 提交于 2019-12-11 18:32:53
问题 Is there some way to copy the currently displayed tooltip to the clipboard as a string without complex XY-coord calculation that maps to the tooltip text area? This is especially challenging on a chart with tooltip displayed at an angle, also to only capture if being displayed. For example to get ctl-c to copy the displaying tooltip to clipboard: PlotThisDaysData extends JFrame implements ... KeyListener{ @Override public void keyTyped( KeyEvent e ) { char typed = e.getKeyChar(); if ( typed =

BarChart text truncation problems

十年热恋 提交于 2019-12-11 18:22:34
问题 I have two problem, which can be illustrated by these screenshots: So, how to avoid text's truncation in these case ? Of course, the width is enough.Moreover, truncation differs for differen strings. 回答1: I suspect a layout or preferred size problem. You can override getPreferredSize() in ChartPanel to get a nice initial display, as shown here, and specify a layout like BorderLayout.CENTER or GridLayout to let the panel adopt the size of the enclosing Container . Failing this, please edit

Animate plot on JFreeChart line graph

那年仲夏 提交于 2019-12-11 18:08:33
问题 I'm currently working on a project that plots real time data as a line graph using the JFreeChart library. It's working great, but I want to give it a little more elegance by plotting the data in a smooth animated manner, rather than plotting in discrete steps. A good example of the effect I'm looking for can be found here: http://www.highcharts.com/demo/line-basic Notice how the lines are animated between plot points. I'm currently using the inbuilt XYLineChart for my graphs. Is there a

In jfreechart TimeSeriesCollection how to show dates which has only values?

老子叫甜甜 提交于 2019-12-11 18:07:36
问题 public class Example { public static void main(String args[]){ /*creating timeSeriesCollection*/ TimeSeriesCollection dataset = new TimeSeriesCollection(); TimeSeries timeSeries1 = new TimeSeries("Sample 1"); timeSeries1.add(new Day(8,4, 2012), 7.0); timeSeries1.add(new Day(19,4, 2012), 5.0); dataset.addSeries(timeSeries1); /*Creating the chart*/ JFreeChart chart = ChartFactory.createTimeSeriesChart("Population","Date","Population",dataset,true,true,false); /*Altering the graph */ XYPlot plot

How to create Line Chart that starts from zero and 1 axis must be string-based?

只谈情不闲聊 提交于 2019-12-11 18:05:07
问题 My question is a combination of these old questions. how to start draw line from X - Y axis at o in JFreeChart ChartFactory.createLineChart How to draw line chart using jfreechart from top to bottom? I'm working in a project and need to implement a feature to create a line chart using JFreechart. Each line chart must satisfy all 2 conditions. Each line must start from (0,0) coordinate (or at least look like that) X-axis must be string-based. For example: "30-Oct-2017", "04-Dec-2017", etc.

How to get selected elements of panels in JList (overlay selected elements)

笑着哭i 提交于 2019-12-11 16:59:12
问题 I have a JList of ChartPanel s. When I'm trying to select elements I can't visually see what elements of the list actually are selected. On a program level listeners are working properly. How to get visually selected my chart panels of the list? Or how to overlay these elements with opacity color? Desired result: Here is the code based on this example: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; import

Displaying data on table into jfreechart

无人久伴 提交于 2019-12-11 16:26:04
问题 I am building an application to check the similiairity between two java codes or more. Now, I have a data that I am store into a table. The code to build this table like this public final class ASTParseUnit { String IDLexer; public ASTParseUnit(final IParserSelector parserSelector) { this.parserSelector = parserSelector; } public String getIDLexer() { return IDLexer; } public void setIDLexer(String iDLexer) { IDLexer = iDLexer; } public ASTManager parse(final JCCDFile[] files) { final

Get mouse coordinates when mouse dragged (JFreeChart)

爷,独闯天下 提交于 2019-12-11 15:32:27
问题 How to get mouse coordinates in plot when mouse dragged? package parabolademo; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartMouseEvent; import org.jfree.chart.ChartMouseListener; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.entity.ChartEntity; import