File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Jfreechart TimeSeriesDemo10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Jfreechart TimeSeriesDemo10" Watch "Jfreechart TimeSeriesDemo10" New topic

Jfreechart TimeSeriesDemo10

Pedro Neves
Ranch Hand

Joined: Mar 07, 2012
Posts: 64
Hello, does anybody knows if, and how can i use Jfreechart TimeSeriesDemo10 but replacing minutes by seconds?

This is the code (per minute)

import java.awt.Color;
import java.util.Date;

import javax.swing.JPanel;
import javax.swing.border.LineBorder;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;

* A demo showing a time series with per minute data.
public class TimeSeriesDemo10 extends ApplicationFrame {

private JPanel jp;

public TimeSeriesDemo10(final String title,JPanel j) {


jp = new JPanel();

final TimeSeries series = new TimeSeries("Per Minute Data", Minute.class);
final Hour hour = new Hour();

Date date =new Date();

int min = date.getMinutes();

series.add(new Minute(min, hour), 10.2);
series.add(new Minute(min + 1, hour), 17.3);
series.add(new Minute(min + 2, hour), 14.6);
series.add(new Minute(min + 3, hour), 11.9);
series.add(new Minute(min + 4, hour), 13.5);
series.add(new Minute(min + 5, hour), 10.9);
final TimeSeriesCollection dataset = new TimeSeriesCollection(series);
final JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series Demo 10", "Time", "Value", dataset,true, true, false );

final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(250, 200));

j.setBorder(new LineBorder(Color.GRAY));


public JPanel GetPanel(){return jp;}


thanks in advance
Tim Moores

Joined: Sep 21, 2011
Posts: 2413
Assuming that a class "" exists, have you tried a search-and-replace of "Minute" with "Second"?
Darryl Burke

Joined: May 03, 2008
Posts: 5115

Moved from Swing / AWT / SWT / JFace

luck, db
There are no new questions, but there may be new answers.
Pedro Neves
Ranch Hand

Joined: Mar 07, 2012
Posts: 64
Tim Moores wrote:Assuming that a class "" exists, have you tried a search-and-replace of "Minute" with "Second"?

I tried but i havent succeed.. well.. I realise i need another graphic.. a windowing graphic, like the preformance tab in windws task manager.. :-/ well i got to search for a while.. thanks a lot.
I agree. Here's the link:
subject: Jfreechart TimeSeriesDemo10
jQuery in Action, 3rd edition