JMC-5359: Ugly values on Y axis when no events

Marcus Hirt marcus.hirt at oracle.com
Mon Oct 1 13:57:47 UTC 2018


Hi Ken,

Looks good!

Kind regards,
Marcus

On 2018-10-01, 15:50, "jmc-dev on behalf of Ken Dobson" <jmc-dev-bounces at openjdk.java.net on behalf of kdobson at redhat.com> wrote:

    Hi all,
    
    just checking to see if someone could take a quick look at the patch above
    when they have a chance.
    
    Thanks,
    
    Ken
    
    On Tue, Sep 18, 2018 at 5:17 PM, Ken Dobson <kdobson at redhat.com> wrote:
    
    > Hi all,
    >
    > This is another simple UI fix for JMC-5359, which also appears to be a
    > duplicate of JMC-5045 as well. If someone could have a look at it that'd be
    > great.
    > Jira: https://bugs.openjdk.java.net/projects/JMC/issues/JMC-5359
    > https://bugs.openjdk.java.net/projects/JMC/issues/JMC-5045
    >
    > diff -r 9ebfa2888b8f application/org.openjdk.jmc.
    > ui/src/main/java/org/openjdk/jmc/ui/charts/XYDataRenderer.java
    > --- a/application/org.openjdk.jmc.ui/src/main/java/org/openjdk/
    > jmc/ui/charts/XYDataRenderer.java    Fri Sep 14 01:21:16 2018 +0200
    > +++ b/application/org.openjdk.jmc.ui/src/main/java/org/openjdk/
    > jmc/ui/charts/XYDataRenderer.java    Tue Sep 18 17:11:03 2018 -0400
    > @@ -44,6 +44,7 @@
    >
    >  import org.openjdk.jmc.common.IDisplayable;
    >  import org.openjdk.jmc.common.unit.IQuantity;
    > +import org.openjdk.jmc.common.unit.UnitLookup;
    >  import org.openjdk.jmc.common.util.ColorToolkit;
    >  import org.openjdk.jmc.ui.charts.AWTChartToolkit.IColorProvider;
    >  import org.openjdk.jmc.ui.charts.IChartInfoVisitor.IBucket;
    > @@ -200,9 +201,11 @@
    >
    >          if (yAxisMin != null && yAxisMax != null) {
    >              FontMetrics fm = context.getFontMetrics();
    > -            // If min=max, expand range to be [min, min+1]
    > +            /* If min=max, expand range to be [min, min+1], or [min,
    > min+1024] in the case of
    > +            a graph measured in bytes*/
    >              if (yAxisMin.compareTo(yAxisMax) == 0) {
    > -                yAxisMax = yAxisMin.getUnit().quantity(yAxisMin.doubleValue()
    > + 1);
    > +                int offset = yAxisMin.getUnit() == UnitLookup.BYTE ? 1024
    > : 1;
    > +                yAxisMax = yAxisMin.getUnit().quantity(yAxisMin.doubleValue()
    > + offset);
    >              } else {
    >                  // Add sufficient padding to ensure that labels for ticks
    > <= yAxisMax fit,
    >                  // and constant value graphs are discernible.
    >
    > Thanks,
    >
    > Ken
    >
    
    




More information about the jmc-dev mailing list