---
title: "Java Gantt Control: The magnifying glass trick"
description: A magnifying glass focus on selected time spans or project phases. Read how to develop a magnifying glass with the Java Gantt Control VARCHART JGantt.
---

[Production Scheduling Tips & Tricks for Microsoft Dynamics 365 Business Central ](https://blog.netronic.com)

# [Java Gantt Control: The magnifying glass trick](https://blog.netronic.com/java-gantt-control-the-magnifying-glass-trick)

 Written by [Bernd-Rainer Lauber](https://blog.netronic.com/author/bernd-rainer-lauber) | Jul 21, 2014 2:02:00 PM

Controlling long-term projects is a callenge for planners. On the one hand, they want to see the big picture and on the other hand they need to understand all details of the short-term schedule to better manage and steer the operations. In such a scenario, Gantt chart users benefit from a visualization that combines the three time spans past-present-future in one overview. In some cases it can be even more helpful to visualize a time span around the current date in more details than future or past ones. Read in this post blog how to develop such a kind of magnifying glass with a Java Gantt Control.  

The key to the magnifying glass is the time scale. In our Java Gantt control [VARCHART JGantt](https://www.netronic.com/products/varchart-jgantt/overview.html) the function time scale is very powerful and it allows you to partition the time scale into several sections. There are only two steps to be done:

- Define three sections with two resolutions: a section representing the time span around time-now with a higher resolution and the other two sections with lower time resolution.
- Visually highlight the "time now zone" by adding an optical veil over the past and the future.

 

 

The below **code fragment** sketches one possible approach. Further information including the complete code can be found in the sample *EnhancedTimeScale* of the sample collection which you get when you download a [VARCHART JGantt trial version](https://info.netronic.com/free-download-java-gantt-control).

```
else if (noOfSections==3)  {  ...     myJGTimeScale.getSection(0).setAreaStyle(EnhancedTimeScale.hazedfirstRibbon);  myJGTimeScale.getSection(0).setAreaStyleForHigherRibbons (EnhancedTimeScale.hazedhigherRibbons);  double absRelFactor = 1.;  if (stepRule.equals("10Y"))      absRelFactor = 70.;  else if (stepRule.equals("5Y"))      absRelFactor = 40.;  else if (stepRule.equals("Y"))      absRelFactor = 40.;  else if (stepRule.equals("6M"))      absRelFactor = 30.;  else if (stepRule.equals("3M"))      absRelFactor = 30.;  else if (stepRule.equals("M"))      absRelFactor = 6.;  else if (stepRule.equals("W"))      absRelFactor = 6.;  else if (stepRule.equals("D") || stepRule.equals("12H") || stepRule.equals("6H")            || stepRule.equals("3H"))      absRelFactor = 9.;  else    {    stepRule = myJGTimeScale.getDefaultSection().getVisibleRibbonStripe().               getRibbon(1).getTickRules(1).getStepRule();     absRelFactor = 9.;     }  long firstSectionStart = JGTimeScaleHelper.roundTime(System.currentTimeMillis(),                            stepRule, true);  long secondSectionStart = JGTimeScaleHelper.roundTime(System.currentTimeMillis(),                            stepRule, false);  JGTimeScaleSection newSection1 = new JGTimeScaleSection                                    (myJGTimeScale.getSection(0));  newSection1.setAreaStyle(EnhancedTimeScale.firstRibbon);  newSection1.setAreaStyleForHigherRibbons(EnhancedTimeScale.higherRibbons);  myJGTimeScale.addSection(firstSectionStart, newSection1);  myJGTimeScale.getSection(1).setAbsoluteResolution(absRelFactor*myJGTimeScale.  getSection(0).getAbsoluteResolution());  JGTimeScaleSection newSection2 = new JGTimeScaleSection                                    (myJGTimeScale.getSection(0));  myJGTimeScale.addSection(secondSectionStart, newSection2);  myJGTimeScale.getSection(2).setAbsoluteResolution(myJGTimeScale.getSection(0).  getAbsoluteResolution());  myEnhancedTimeScale.myTabbedPaneHandler.mySections = myJGTimeScale.getSections();  ...   }
```

 

Interested in learning more about important Java Gantt control features for complex scheduling applications? You are very welcome to download our free Gantt best practice Ebook.

 

 

[View full post](https://blog.netronic.com/java-gantt-control-the-magnifying-glass-trick)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Bernd-Rainer Lauber"
  },
  "dateModified" : "2021-09-16T19:30:54.991Z",
  "datePublished" : "2014-07-21T14:02:00Z",
  "headline" : "Java Gantt Control: The magnifying glass trick",
  "image" : {
    "@type" : "ImageObject",
    "height" : 200,
    "url" : "http://cdn2.hubspot.net/hub/315990/file-1280346780-png/blog/Lupe.png",
    "width" : 603
  },
  "mainEntityOfPage" : "https://blog.netronic.com/java-gantt-control-the-magnifying-glass-trick",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "SMB Production Scheduling Software Blog"
  }
}
```