I am new to JFreeChart.
I'd like to change the code of Trashgod to monitor something in Java. So I need to:
1 - Keep all datas shown. His code keeps only the last 10 samples.
2 - Having a variable scale on X-axis :
Having an int input howManyDays (or something like an int input, something a little bit clever would be great ;-) ) : int howManyDays = 7;//in this case : 1 week of datas
Having a variable scale on X-axis a little bit complex : For example during the first seconds of execution it has for scale 1 minute. Then 10 minutes... When midnight has been passed, it should print the current day.
I know that this instruction
Timer timer = new Timer(100, new ActionListener()
means that every 100 ms it adds a new data and then it updates the chart. I'll change it to 10 000 -> 10 seconds. My Timer for testing JFreeChart :
Timer timer = new Timer(10000, new ActionListener() {
private int i,data;
@Override
public void actionPerformed(ActionEvent e) {
if ((i%10)==0) {
this.data += (int) Math.ceil(2*Math.random());
}
this.i++;
chart.update(this.data);
}
});
Of course I don't need the solution.
What do I really need :
- Maybe if someone could add comment on Trashgod's code ?
- Or if someone could give me some tricks for doing this kind of code ?
- Or maybe someone has already done something like that ?
Have a good day !