This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Jfreechart TimeSeriesDemo10" Watch "Jfreechart TimeSeriesDemo10" New topic
Author

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.data.time.Hour;
import org.jfree.data.time.Minute;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
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) {

super(title);

jp = new JPanel();
jp.setBounds(j.getBounds());

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.add(chartPanel);
j.setBorder(new LineBorder(Color.GRAY));

}

public JPanel GetPanel(){return jp;}



}


thanks in advance
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Assuming that a class "org.jfree.data.time.Second" exists, have you tried a search-and-replace of "Minute" with "Second"?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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 "org.jfree.data.time.Second" 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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jfreechart TimeSeriesDemo10
 
Similar Threads
Dollar Symbol at Vertical Bar in StackedBarChar in JFreeChart
problem in displaying text in item label in JFreeChart
how do i get plot x Axis every 5 minute (JFreechart)
Autoupdating Pie Chart with jFreeChart
Customizing Y Axis in JFreechart