JFreeChart: Time Series Chart

Posted on 2011-09-27
Last Modified: 2012-05-12
For a TImeSeriesChart, is it possible to generate a chart and then extract only a part of the chart.

For example, the first chart in the attached image is the original chart. The second chart is the extracted portion from the original between t=12:00PM and t = 4:00AM.

If possible, please provide some sample code. Thanks!
Question by:dshrenik
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3

Author Comment

ID: 36714502

Author Comment

ID: 36714508
I think this can be possible if there is a way to auto zoom onto a portion of the chart.
LVL 47

Expert Comment

ID: 36714510
You can generate another chart with shorter interval - ?
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI


Author Comment

ID: 36714514
I'm keeping that for the last option, because in my chart, things can get a little complicated.
LVL 47

Expert Comment

ID: 36714520
I don't think you can zoom, but it is equivalent to geenrating the chart on a smaller range

Author Comment

ID: 36714524
After creating the chart, if I fix the domain range, will that automatically display only the required portion?

Author Comment

ID: 36714534
Can you tell me how I can set the range for the domain axis (which is a DateAxis)?

final DateAxis domainAxis = (DateAxis) plot.getDomainAxis();

not sure how I must pass arguments to:
(I want to pass the 2 Date arguments)
LVL 47

Accepted Solution

for_yan earned 500 total points
ID: 36714585
Somthing like that should work:

 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");

        java.util.Date dd0 = sdf.parse("00:00", new ParsePosition(0));

              java.util.Date dd01 = sdf.parse("04:00", new ParsePosition(0));

     domainAxis.setRange(dd0, dd01);

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question