jfreechart

Why can't I copy a value from one XYSeriesCollection to other?

橙三吉。 提交于 2019-12-11 04:31:03
问题 I'm using JFreeChart to create an image histogram in java swing. In order to create it I iterate over all pixels to get all the colors. Depending on the size and bit depth it takes some time. Once I have all the data I put it into a XYSeriesCollection variable. To be able to show and hide some series latter I save a copy of that variable. My problem is that if I do it like this: final XYSeriesCollection data = createHistogram(); final XYSeriesCollection dataCopy = createHistogram(); It works

JFreeChart PolarPlot remove radius labels?

妖精的绣舞 提交于 2019-12-11 04:13:24
问题 Any ideas? There is no setRadiusLabelsVisible(...) or setLabelGenerator(null) method which exists for at least some of the other charts. :) 回答1: It looks like a PolarPlot has a radial Axis , so PolarPlot plot = (PolarPlot) chart.getPlot(); ValueAxis axis = plot.getAxis(); axis.setTickLabelsVisible(false); 来源: https://stackoverflow.com/questions/2429089/jfreechart-polarplot-remove-radius-labels

Want to update jfreechat xylinechart continuously

倖福魔咒の 提交于 2019-12-11 03:58:41
问题 I have xyline chart created using jfreechart inside netbeans swing. I have two files one is for getting values for x and y coordinates continuously and other is for display of them now I am creating the chart from constructor of the display file and it displays the chart using hard coded values but when I pass my incoming the chart is not updating accordingly. Please find below code for display file : public Display_Unit_Mod() { JPanel jPanel1 = createChartPanel(); } public JPanel

Jfree chart Mouse Drag to Zoom

邮差的信 提交于 2019-12-11 03:57:31
问题 How to modify mouseDragged event of ChartPanel such that I want to do some processing before/after the zooming is done? I have the following chartPanel, JFreeChart chart = new JFreeChart( "Demo", JFreeChart.DEFAULT_TITLE_FONT,plot, true); ChartPanel chartPanel = new ChartPanel(chart); Whenever the mouse is dragged, I want to call my function before/ after the mouseDragged() is called. How to do this ? chartPanel.addMouseMotionListener(new MouseMotionListener() { @Override public void

Zoom In and Zoom out functionality on a button click on JfreeChart line graph?

笑着哭i 提交于 2019-12-11 03:50:08
问题 Basically i want the line graph to be zoomed in and Zoomed out(total 4 buttons,2 for X-axis(Zoom in and Zoom out) and other two for Y-axis) on a button click along any axis like if the graph drawn on negative x-axis and negative Y-axis area ,depending on data points then on button click the graph should be Zoomed in and Zoomed out along that negative x-axis or negative Y-axis based on button click. How can i achieve this ?Any sample code with detail Explanation is much helpful!! private

JFreeChart dial in NetBeans JButton

浪尽此生 提交于 2019-12-11 03:32:25
问题 I'm trying to make a dial from JFreeChart work while I press a JButton made in NetBeans. The problem is that although the code seems ok while outside the JButton , it gives me errors in the program when I put it inside. private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here } public class DemoChartProblem { private final DefaultValueDataset dataset = new DefaultValueDataset(50); private final JFrame frame = new JFrame(); public void main

JFreechart X and Y axis scaling

萝らか妹 提交于 2019-12-11 03:32:02
问题 It's possible to set the axis scale values in jfreechart? For example, I'd want X-axis scale 10 and Y-Axis scale 1. 回答1: You set the TickUnit , if you are using an XYPlot try this XYPlot plot = chart.getXYPlot(); NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setTickUnit(new NumberTickUnit(10)); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setTickUnit(new NumberTickUnit(1)); 来源: https://stackoverflow.com/questions/11306688/jfreechart-x-and-y-axis-scaling

JFreeChart : How to make a series invisible?

十年热恋 提交于 2019-12-11 03:28:59
问题 I am trying to make a chart of ohlc bars invisible so that I can leave the window with only the moving average. Here is the code with the two series (ohlc bars and moving average) : private static JFreeChart createChart(OHLCDataset dataset) { JFreeChart chart = ChartFactory.createHighLowChart( "HighLowChartDemo2", "Time", "Value", dataset, true); XYPlot plot = (XYPlot)chart.getPlot(); DateAxis axis = (DateAxis)plot.getDomainAxis(); axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

Error - java.sql.Timestamp cannot be cast to java.sql.Date in JFreeChart

谁都会走 提交于 2019-12-11 02:49:00
问题 While i'm retrieving data from my database to add to a chart using JFreeChart I get the error: java.sql.Timestamp cannot be cast to java.sql.Date I have four columns the first three are retrieved properly using a case but while going through the final column it goes to the correct case: case Types.TIMESTAMP: { But then the error occurs on this part: Date date = (Date) resultSet.getObject(column); The data within the database is formatted like this (HH,MM,SS). Edit - Also would like to add

JFreeChart last X-axis label cut off

自古美人都是妖i 提交于 2019-12-11 02:39:31
问题 I've got a nice, pretty JFreeChart-generated Line chart, with one exception - the last value on my X axis is getting truncated, like so: | | |_________|________|__________|_________|_________| 100 Hz 1 kHz 10 kHz 100 kHz 1 MHz 10 MH (Note the z in MHz is cut off). I've looked into the solution here: JFreeChart tick label cut off but because I'm manually specifying the range in a LogAxis it appears from the JavaDoc that setting the margin has no effect. JavaDoc This is the code I'm using to