BarChart.java
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:84k
源码类别:

OA系统

开发平台:

Java

  1. // Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov  Date: 2002-12-03 18:39:45
  2. // Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
  3. // Decompiler options: packimports(3) 
  4. // Source File Name:   BarChart.java
  5. package cn.com.fcsoft.chart;
  6. import java.awt.*;
  7. import java.awt.event.MouseEvent;
  8. import java.util.*;
  9. // Referenced classes of package com.objectplanet.chart:
  10. //            Chart, ChartSample, LineChart, PieChart
  11. public class BarChart extends Chart
  12. {
  13.     private void paintBar(Graphics g, int i, int j)
  14.     {
  15.         ChartSample chartsample = getSample(i, j);
  16.         int k = getSeriesCount();
  17.         if(chartsample == null || chartsample.value == null || chartsample.value.isNaN() || chartsample.getFloatValue() == 0.0D && barType == 1 && k > 1)
  18.             return;
  19.         int l = getSeriesRange(i);
  20.         double d = chartsample.getFloatValue();
  21.         if(barType != 1 && (d < super.currentLowerRange[l] && super.currentLowerRange[l] > 0.0D || d > super.currentUpperRange[l] && super.currentUpperRange[l] < 0.0D))
  22.             return;
  23.         if(multiColorOn)
  24.         {
  25.             if(getSeriesCount() > 1 || barType == 1 || super.multiSeriesOn)
  26.                 g.setColor(getSampleColor(i));
  27.             else
  28.                 g.setColor(getSampleColor(j));
  29.         } else
  30.         {
  31.             g.setColor(getSampleColor(0));
  32.         }
  33.         boolean flag = chartsample != null && chartsample.isSelected();
  34.         Rectangle rectangle = barBounds[i][j];
  35.         Color color = getChartForeground();
  36.         if(barOutlineOn)
  37.         {
  38.             g.fillRect(rectangle.x, rectangle.y, rectangle.width + 1, rectangle.height);
  39.             Color color1 = g.getColor();
  40.             if(barOutlineColor != null)
  41.                 g.setColor(barOutlineColor);
  42.             else
  43.                 g.setColor(color);
  44.             g.drawRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
  45.             if(flag)
  46.                 g.drawRect(rectangle.x + 1, rectangle.y + 1, rectangle.width - 2, rectangle.height != 2 ? rectangle.height - 2 : 1);
  47.             g.setColor(color1);
  48.         } else
  49.         {
  50.             if(super.gridAlignment == 1)
  51.                 g.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
  52.             else
  53.                 g.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
  54.             if(flag)
  55.             {
  56.                 Color color2 = g.getColor();
  57.                 if(barOutlineColor != null)
  58.                     g.setColor(barOutlineColor);
  59.                 else
  60.                     g.setColor(color);
  61.                 if(super.gridAlignment == 1)
  62.                     g.drawRect(rectangle.x, rectangle.y, rectangle.width - 1, rectangle.height);
  63.                 else
  64.                     g.drawRect(rectangle.x, rectangle.y, rectangle.width - 1, rectangle.height - 1);
  65.                 g.setColor(color2);
  66.             }
  67.         }
  68.         if(is3DModeOn())
  69.             paint3DBar(g, rectangle, flag, d);
  70.     }
  71.     public void setBarLabelsOn(boolean flag)
  72.     {
  73.         super.sampleLabelsOn = flag;
  74.         super.hasChanged = true;
  75.         autoRepaint();
  76.     }
  77.     public void setAutoLabelSpacingOn(boolean flag)
  78.     {
  79.         autoLabelSpacingOn = flag;
  80.         super.hasChanged = true;
  81.         autoRepaint();
  82.     }
  83.     protected void processEvent(AWTEvent awtevent)
  84.     {
  85.         switch(awtevent.getID())
  86.         {
  87.         case 504: 
  88.         default:
  89.             break;
  90.         case 505: 
  91.             selectedSample = -1;
  92.             selectedSeries = -1;
  93.             repaint();
  94.             break;
  95.         case 503: 
  96.         case 506: 
  97.             MouseEvent mouseevent = (MouseEvent)awtevent;
  98.             boolean flag = isValueLabelsOn() && valueLabelStyle == 2;
  99.             flag = flag || super.sampleLabelsOn && (super.barLabelStyle == 1 || super.barLabelStyle == 2);
  100.             if(!flag)
  101.                 break;
  102.             mousePosition.x = mouseevent.getX();
  103.             mousePosition.y = mouseevent.getY();
  104.             ChartSample chartsample = super.checkSelection(mousePosition);
  105.             if(chartsample != null)
  106.             {
  107.                 mousePosition.x = -1;
  108.                 mousePosition.y = -1;
  109.             } else
  110.             {
  111.                 chartsample = checkSelection(mousePosition);
  112.             }
  113.             if(chartsample != null)
  114.             {
  115.                 if(chartsample.getIndex() != selectedSample || chartsample.getSeries() != selectedSeries)
  116.                 {
  117.                     selectedSample = chartsample.getIndex();
  118.                     selectedSeries = chartsample.getSeries();
  119.                     repaint();
  120.                 }
  121.                 break;
  122.             }
  123.             boolean flag1 = selectedSample != -1 || selectedSeries != -1;
  124.             selectedSample = -1;
  125.             selectedSeries = -1;
  126.             if(flag1)
  127.                 repaint();
  128.             break;
  129.         }
  130.         super.processEvent(awtevent);
  131.     }
  132.     public void setBarLabels(String as[])
  133.     {
  134.         super.barLabels = as;
  135.         super.hasChanged = true;
  136.         autoRepaint();
  137.     }
  138.     public String[] getBarLabels()
  139.     {
  140.         if(super.barLabels != null)
  141.             return super.barLabels;
  142.         else
  143.             return getSampleLabels();
  144.     }
  145.     public String[] getLegendLabels()
  146.     {
  147.         if(super.legendLabels != null)
  148.             return super.legendLabels;
  149.         if(getSeriesCount() > 1 || barType == 1 || super.multiSeriesOn)
  150.             return getSeriesLabels();
  151.         else
  152.             return getSampleLabels();
  153.     }
  154.     public void setBarType(int i)
  155.     {
  156.         if(i == 0 || i == 1)
  157.         {
  158.             barType = i;
  159.             super.hasChanged = true;
  160.             autoRepaint();
  161.         } else
  162.         {
  163.             throw new IllegalArgumentException("Invalid bar type: " + i);
  164.         }
  165.     }
  166.     public int getBarType()
  167.     {
  168.         return barType;
  169.     }
  170.     double getHighestValue(int i)
  171.     {
  172.         if(barType == 0)
  173.             return super.getHighestValue(i);
  174.         double d = 0.0D;
  175.         int j = getSampleCount();
  176.         int k = getSeriesCount();
  177.         for(int l = 0; l < j; l++)
  178.         {
  179.             double d1 = 0.0D;
  180.             for(int i1 = 0; i1 < k; i1++)
  181.             {
  182.                 ChartSample chartsample = getSample(i1, l);
  183.                 if(chartsample != null && chartsample.value != null && !chartsample.value.isNaN() && chartsample.value.doubleValue() > 0.0D)
  184.                     d1 += chartsample.value.doubleValue();
  185.             }
  186.             d = Math.max(d, d1);
  187.         }
  188.         return d;
  189.     }
  190.     double getLowestValue(int i)
  191.     {
  192.         if(barType == 0)
  193.             return super.getLowestValue(i);
  194.         double d = 0.0D;
  195.         int j = getSampleCount();
  196.         int k = getSeriesCount();
  197.         for(int l = 0; l < j; l++)
  198.         {
  199.             double d1 = 0.0D;
  200.             for(int i1 = 0; i1 < k; i1++)
  201.             {
  202.                 ChartSample chartsample = getSample(i1, l);
  203.                 if(chartsample != null && chartsample.value != null && !chartsample.value.isNaN() && chartsample.value.doubleValue() < 0.0D)
  204.                     d1 += chartsample.value.doubleValue();
  205.             }
  206.             d = Math.min(d, d1);
  207.         }
  208.         return d;
  209.     }
  210.     public void setBarAlignment(int i)
  211.     {
  212.         if(i == 0 || i == 1)
  213.         {
  214.             super.gridAlignment = i;
  215.             super.hasChanged = true;
  216.             autoRepaint();
  217.         } else
  218.         {
  219.             throw new IllegalArgumentException("Alignment must be HORIZONTAL or VERTICAL");
  220.         }
  221.     }
  222.     public int getgridAlignment()
  223.     {
  224.         return super.gridAlignment;
  225.     }
  226.     protected void calculateChartData(Rectangle rectangle, Rectangle rectangle1)
  227.     {
  228.         calculateZeroLines(rectangle);
  229.         int i = getSampleCount();
  230.         int j = getSeriesCount();
  231.         if(is3DModeOn() && i > 0 && j > 0)
  232.             if(super.depth3d >= 0)
  233.             {
  234.                 super.depth3dPoint.x = super.depth3d;
  235.                 super.depth3dPoint.y = -super.depth3d;
  236.             } else
  237.             if(super.gridAlignment == 1)
  238.             {
  239.                 double d = (double)rectangle.width / (double)i;
  240.                 double d3 = d * barWidthFraction;
  241.                 if(barType == 0)
  242.                     d3 /= j;
  243.                 super.depth3dPoint.x = (int)Math.round(d3 * 1.25D);
  244.                 super.depth3dPoint.y = (int)Math.round(-d3 / 1.25D);
  245.             } else
  246.             {
  247.                 double d1 = (double)rectangle.height / (double)i;
  248.                 double d4 = d1 * barWidthFraction;
  249.                 if(barType == 0)
  250.                     d4 /= j;
  251.                 super.depth3dPoint.x = (int)Math.round(d4 * 1.25D * 0.75D);
  252.                 super.depth3dPoint.y = (int)Math.round(-((d4 / 1.25D) * 0.75D));
  253.             }
  254.         if(barBounds == null || barBounds.length != j || barBounds[0].length != i)
  255.         {
  256.             Rectangle arectangle[][] = new Rectangle[j][i];
  257.             for(int l = 0; l < j; l++)
  258.             {
  259.                 for(int j1 = 0; j1 < i; j1++)
  260.                     if(barBounds != null && l < barBounds.length && j1 < barBounds[0].length && barBounds[l][j1] != null)
  261.                         arectangle[l][j1] = barBounds[l][j1];
  262.             }
  263.             barBounds = arectangle;
  264.         }
  265.         for(int k = 0; k < i; k++)
  266.         {
  267.             for(int i1 = 0; i1 < j; i1++)
  268.                 if(barBounds[i1][k] == null)
  269.                     barBounds[i1][k] = new Rectangle();
  270.         }
  271.         double d2 = 0.0D;
  272.         double d5 = rectangle1.width;
  273.         if(i > 0 && j > 0)
  274.         {
  275.             if(super.gridAlignment == 1)
  276.                 d2 = (double)rectangle1.width / (double)i;
  277.             else
  278.                 d2 = (double)rectangle1.height / (double)i;
  279.             d5 = d2 * barWidthFraction;
  280.             if(barType == 0)
  281.                 d5 /= j;
  282.         }
  283.         double d6 = d2 * (1.0D - barWidthFraction);
  284.         double d7 = 0.0D;
  285.         boolean flag = is3DModeOn();
  286.         if(super.gridAlignment == 1)
  287.         {
  288.             d7 = (double)rectangle1.x + d6 / 2D;
  289.             if(flag)
  290.                 d7 -= super.depth3dPoint.x;
  291.         } else
  292.         {
  293.             d7 = (double)rectangle1.y + d6 / 2D;
  294.             if(flag)
  295.                 d7 -= super.depth3dPoint.y;
  296.         }
  297.         if(super.gridAlignment == 1)
  298.         {
  299.             for(int k1 = 0; k1 < i; k1++)
  300.             {
  301.                 for(int i2 = 0; i2 < j; i2++)
  302.                 {
  303.                     Rectangle rectangle2 = barBounds[i2][k1];
  304.                     rectangle2.x = (int)Math.round(d7);
  305.                     rectangle2.width = (int)Math.round(d7 + d5) - rectangle2.x;
  306.                     boolean flag1 = barType == 1;
  307.                     int k2 = flag1 ? 0 : getSeriesRange(i2);
  308.                     double d8 = getSampleValue(i2, k1);
  309.                     if(d8 >= 0.0D)
  310.                     {
  311.                         double d10 = 0.0D;
  312.                         if(super.currentUpperRange[k2] != 0.0D)
  313.                             d10 = (d8 / super.currentUpperRange[k2]) * (double)(super.zeroLine[k2] - rectangle1.y);
  314.                         rectangle2.height = (int)Math.round(d10);
  315.                         rectangle2.y = super.zeroLine[k2] - rectangle2.height;
  316.                         rectangle2.height = Math.max(0, rectangle2.height);
  317.                         if(flag1 && i2 > 0)
  318.                         {
  319.                             double d14 = 0.0D;
  320.                             for(int i4 = 0; i4 < i2; i4++)
  321.                                 if(getSampleValue(i4, k1) >= 0.0D)
  322.                                     d14 += getSampleValue(i4, k1);
  323.                             double d18 = 0.0D;
  324.                             if(super.currentUpperRange[k2] != 0.0D)
  325.                                 d18 = (d14 / super.currentUpperRange[k2]) * (double)(super.zeroLine[k2] - rectangle1.y);
  326.                             double d22 = (double)super.zeroLine[k2] - d18 - d10;
  327.                             rectangle2.y = (int)Math.round(d22);
  328.                             rectangle2.height = (int)Math.round((d10 + d22) - (double)Math.round(d22));
  329.                         }
  330.                         int i3 = rectangle2.y + rectangle2.height;
  331.                         int k3 = rectangle1.y + rectangle1.height;
  332.                         if(i3 > k3)
  333.                             rectangle2.height -= i3 - k3;
  334.                     } else
  335.                     {
  336.                         double d11 = 0.0D;
  337.                         if(super.currentLowerRange[k2] != 0.0D)
  338.                             d11 = (d8 / super.currentLowerRange[k2]) * (double)((rectangle1.y + rectangle1.height) - super.zeroLine[k2]);
  339.                         rectangle2.height = (int)Math.round(d11);
  340.                         rectangle2.y = super.zeroLine[k2];
  341.                         if(flag1 && i2 > 0)
  342.                         {
  343.                             double d15 = 0.0D;
  344.                             for(int j4 = 0; j4 < i2; j4++)
  345.                                 if(getSampleValue(j4, k1) < 0.0D)
  346.                                     d15 += getSampleValue(j4, k1);
  347.                             double d19 = 0.0D;
  348.                             if(super.currentLowerRange[k2] != 0.0D)
  349.                                 d19 = (d15 / super.currentLowerRange[k2]) * (double)((rectangle1.y + rectangle1.height) - super.zeroLine[k2]);
  350.                             double d23 = (double)super.zeroLine[k2] + d19;
  351.                             rectangle2.y = (int)Math.round(d23);
  352.                             rectangle2.height = (int)Math.round((d11 + d23) - (double)Math.round(d23));
  353.                         }
  354.                         if(rectangle2.y < rectangle1.y)
  355.                         {
  356.                             rectangle2.height -= rectangle1.y - rectangle2.y;
  357.                             rectangle2.y = rectangle1.y;
  358.                         }
  359.                     }
  360.                     if(flag)
  361.                         rectangle2.y -= super.depth3dPoint.y;
  362.                     if(barType == 0 || i2 == j - 1)
  363.                         d7 += d5;
  364.                 }
  365.                 d7 += d6;
  366.             }
  367.         } else
  368.         {
  369.             for(int l1 = 0; l1 < i; l1++)
  370.             {
  371.                 for(int j2 = 0; j2 < j; j2++)
  372.                 {
  373.                     Rectangle rectangle3 = barBounds[j2][l1];
  374.                     rectangle3.y = (int)Math.round(d7);
  375.                     rectangle3.height = (int)Math.round(d7 + d5) - rectangle3.y;
  376.                     boolean flag2 = barType == 1;
  377.                     int l2 = flag2 ? 0 : getSeriesRange(j2);
  378.                     double d9 = getSampleValue(j2, l1);
  379.                     if(d9 >= 0.0D)
  380.                     {
  381.                         double d12 = 0.0D;
  382.                         if(super.currentUpperRange[l2] != 0.0D)
  383.                             d12 = (d9 / super.currentUpperRange[l2]) * (double)((rectangle1.x + rectangle1.width) - super.zeroLine[l2]);
  384.                         rectangle3.width = (int)Math.round(d12);
  385.                         rectangle3.x = super.zeroLine[l2];
  386.                         if(barType == 1 && j2 > 0)
  387.                         {
  388.                             double d16 = 0.0D;
  389.                             for(int k4 = 0; k4 < j2; k4++)
  390.                                 if(getSampleValue(k4, l1) >= 0.0D)
  391.                                     d16 += getSampleValue(k4, l1);
  392.                             double d20 = 0.0D;
  393.                             if(super.currentUpperRange[l2] != 0.0D)
  394.                                 d20 = (d16 / super.currentUpperRange[l2]) * (double)((rectangle1.x + rectangle1.width) - super.zeroLine[l2]);
  395.                             double d24 = (double)super.zeroLine[l2] + d20;
  396.                             rectangle3.x = (int)Math.round(d24);
  397.                             rectangle3.width = (int)Math.round((d12 + d24) - (double)Math.round(d24));
  398.                         }
  399.                         if(rectangle3.x < rectangle1.x)
  400.                         {
  401.                             rectangle3.width -= rectangle1.x - rectangle3.x;
  402.                             rectangle3.x = rectangle1.x;
  403.                         }
  404.                     } else
  405.                     {
  406.                         double d13 = 0.0D;
  407.                         if(super.currentLowerRange[l2] != 0.0D)
  408.                             d13 = (d9 / super.currentLowerRange[l2]) * (double)(super.zeroLine[l2] - rectangle1.x);
  409.                         rectangle3.width = (int)Math.round(d13);
  410.                         rectangle3.x = super.zeroLine[l2] - rectangle3.width;
  411.                         if(barType == 1 && j2 > 0)
  412.                         {
  413.                             double d17 = 0.0D;
  414.                             for(int l4 = 0; l4 < j2; l4++)
  415.                                 if(getSampleValue(l4, l1) < 0.0D)
  416.                                     d17 += getSampleValue(l4, l1);
  417.                             double d21 = 0.0D;
  418.                             if(super.currentLowerRange[l2] != 0.0D)
  419.                                 d21 = (d17 / super.currentLowerRange[l2]) * (double)(super.zeroLine[l2] - rectangle1.x);
  420.                             double d25 = (double)super.zeroLine[l2] - d21 - d13;
  421.                             rectangle3.x = (int)Math.round(d25);
  422.                             rectangle3.width = (int)Math.round((d13 + d25) - (double)Math.round(d25));
  423.                         }
  424.                         int j3 = rectangle3.x + rectangle3.width;
  425.                         int l3 = rectangle1.x + rectangle1.width;
  426.                         if(j3 > l3)
  427.                             rectangle3.width -= j3 - l3;
  428.                     }
  429.                     if(flag)
  430.                         rectangle3.x -= super.depth3dPoint.x;
  431.                     if(barType == 0 || j2 == j - 1)
  432.                         d7 += d5;
  433.                 }
  434.                 d7 += d6;
  435.             }
  436.         }
  437.     }
  438.     private void paintBarLabels(Graphics g, Rectangle rectangle)
  439.     {
  440.         if(!super.sampleLabelsOn || super.barLabelStyle == 1)
  441.             return;
  442.         String as[] = getBarLabels();
  443.         if(as == null)
  444.             return;
  445.         Font font = getFont("barLabelFont");
  446.         g.setFont(font);
  447.         FontMetrics fontmetrics = g.getFontMetrics();
  448.         if(super.gridAlignment == 1)
  449.         {
  450.             int i = getLabelAngle("barLabelAngle");
  451.             int k = 0;
  452.             int i1 = Math.min(as.length, getSampleCount());
  453.             for(int k1 = 0; k1 < i1; k1++)
  454.                 if(as[k1] != null)
  455.                 {
  456.                     Color color1 = getSampleLabelColor(k1);
  457.                     if(color1 != null)
  458.                         g.setColor(color1);
  459.                     else
  460.                         g.setColor(getForeground());
  461.                     Dimension dimension1 = getLabelSize(as[k1], font);
  462.                     Dimension dimension3 = getAngledLabelSize(dimension1, i);
  463.                     int i2 = barBounds[0][k1].x;
  464.                     int k2 = (barBounds[barBounds.length - 1][k1].x + barBounds[barBounds.length - 1][k1].width) - i2;
  465.                     int i3 = i2 + k2 / 2;
  466.                     if(i % 90 == 0)
  467.                         i2 = i3 - dimension3.width / 2;
  468.                     else
  469.                     if(i % 180 > 90)
  470.                         i2 = (i3 + k2 / 2) - dimension3.width;
  471.                     else
  472.                         i2 = i3 - k2 / 2;
  473.                     int k3 = rectangle.x - 2 - (is3DModeOn() ? super.depth3dPoint.x : 0);
  474.                     if(i3 >= k3 && i3 <= rectangle.x + rectangle.width + 2)
  475.                     {
  476.                         int i4 = rectangle.y + rectangle.height + 6;
  477.                         if(i % 180 == 0)
  478.                             i4 += fontmetrics.getMaxAscent() - 4;
  479.                         if(is3DModeOn())
  480.                             i4 -= super.depth3dPoint.y;
  481.                         if(super.sampleScrollerOn)
  482.                             i4 += 10;
  483.                         if(isValueLabelsOn() && valueLabelStyle == 0 && super.lowerRange[0] < 0.0D)
  484.                         {
  485.                             int k4 = rectangle.y;
  486.                             int l4 = super.zeroLine[0] - (is3DModeOn() ? super.depth3dPoint.y : 0);
  487.                             for(int i5 = 0; i5 < barBounds.length; i5++)
  488.                             {
  489.                                 int k5 = barBounds[i5][k1].y + barBounds[i5][k1].height;
  490.                                 if(k5 > k4 && k5 > l4)
  491.                                     k4 = k5;
  492.                             }
  493.                             i4 = Math.max(i4, k4 + fontmetrics.getMaxAscent() + 10);
  494.                             k4 = (rectangle.y + rectangle.height) - (is3DModeOn() ? super.depth3dPoint.y : 0);
  495.                             i4 = Math.min(i4, k4 + fontmetrics.getMaxAscent() + 10);
  496.                         }
  497.                         if(autoLabelSpacingOn)
  498.                         {
  499.                             if(as[k1] != null && as[k1].trim().length() > 0 && (i2 > k || k1 == 0))
  500.                             {
  501.                                 paintLabel(g, as[k1], i2, i4, dimension1, 0, i);
  502.                                 k = i2 + dimension3.width;
  503.                             }
  504.                         } else
  505.                         {
  506.                             paintLabel(g, as[k1], i2, i4, dimension1, 0, i);
  507.                         }
  508.                     }
  509.                 }
  510.         } else
  511.         {
  512.             int j = getLabelAngle("barLabelAngle");
  513.             int l = Math.min(as.length, getSampleCount());
  514.             for(int j1 = 0; j1 < l; j1++)
  515.                 if(as[j1] != null)
  516.                 {
  517.                     Color color = getSampleLabelColor(j1);
  518.                     if(color != null)
  519.                         g.setColor(color);
  520.                     else
  521.                         g.setColor(getForeground());
  522.                     Dimension dimension = getLabelSize(as[j1], font);
  523.                     Dimension dimension2 = getAngledLabelSize(dimension, j);
  524.                     int l1 = (barBounds[barBounds.length - 1][j1].y + barBounds[barBounds.length - 1][j1].height) - barBounds[0][j1].y;
  525.                     int j2 = barBounds[0][j1].y + l1 / 2;
  526.                     int l2 = j2 - dimension2.height / 2;
  527.                     if(j % 180 == 0)
  528.                         l2 += fontmetrics.getAscent() - 1;
  529.                     else
  530.                     if(j % 180 > 90)
  531.                         l2 = j2 - l1 / 2;
  532.                     else
  533.                         l2 = (j2 + l1 / 2) - dimension2.height;
  534.                     if(j % 180 != 0 || l2 >= rectangle.y - 2 && l2 <= (rectangle.y + rectangle.height) - (is3DModeOn() ? super.depth3dPoint.y : 0))
  535.                     {
  536.                         int j3 = rectangle.x - dimension2.width - 3;
  537.                         if(is3DModeOn())
  538.                             j3 -= super.depth3dPoint.x;
  539.                         if(super.sampleScrollerOn)
  540.                             j3 -= 10;
  541.                         if(isValueLabelsOn() && valueLabelStyle == 0 && super.lowerRange[0] < 0.0D)
  542.                         {
  543.                             int l3 = rectangle.x + rectangle.width;
  544.                             int j4 = 0;
  545.                             double d = 0.0D;
  546.                             for(int j5 = 0; j5 < barBounds.length; j5++)
  547.                                 if(getSampleValue(j5, j1) < 0.0D)
  548.                                 {
  549.                                     if(barType == 1)
  550.                                         d += getSampleValue(j5, j1);
  551.                                     else
  552.                                         d = getSampleValue(j5, j1);
  553.                                     if(barBounds[j5][j1].x < l3)
  554.                                     {
  555.                                         String s = getLabel("valueLabelPrefix");
  556.                                         String s1 = getLabel("valueLabelPostfix");
  557.                                         l3 = barBounds[j5][j1].x;
  558.                                         String s2 = formatNumber(d, getSampleDecimalCount(0));
  559.                                         s2 = s == null ? s2 : s + s2;
  560.                                         s2 = s1 == null ? s2 : s2 + s1;
  561.                                         j4 = fontmetrics.stringWidth(s2);
  562.                                     }
  563.                                 }
  564.                             j3 = Math.min(j3, l3 - j4 - dimension2.width - 3);
  565.                             l3 = rectangle.x - (is3DModeOn() ? super.depth3dPoint.x : 0);
  566.                             j3 = Math.max(j3, l3 - j4 - dimension2.width - 3);
  567.                             l3 -= super.sampleScrollerOn ? 10 : 0;
  568.                             j3 = Math.min(j3, l3 - dimension2.width - 3);
  569.                         }
  570.                         paintLabel(g, as[j1], j3, l2, dimension, 1, j);
  571.                     }
  572.                 }
  573.         }
  574.     }
  575.     private void paintFloatingLabels(Graphics g, Rectangle rectangle)
  576.     {
  577.         boolean flag = valueLabelStyle == 2 || super.barLabelStyle == 1 || super.barLabelStyle == 2;
  578.         if(flag && selectedSeries >= 0 && selectedSample >= -1)
  579.         {
  580.             Font font = getFont("floatingLabelFont");
  581.             g.setFont(font);
  582.             FontMetrics fontmetrics = g.getFontMetrics();
  583.             if(selectedSample >= 0)
  584.             {
  585.                 String s = constructFloatingLabel(selectedSeries, selectedSample, true);
  586.                 paintFloatingLabel(g, rectangle, selectedSeries, selectedSample, s, font, fontmetrics);
  587.             } else
  588.             if(isFloatingOnLegendOn())
  589.             {
  590.                 int i = getSampleCount();
  591.                 for(int j = 0; j < i; j++)
  592.                 {
  593.                     String s1 = constructFloatingLabel(selectedSeries, j, false);
  594.                     paintFloatingLabel(g, rectangle, selectedSeries, j, s1, font, fontmetrics);
  595.                 }
  596.             }
  597.         }
  598.     }
  599.     public void setMultiColorOn(boolean flag)
  600.     {
  601.         multiColorOn = flag;
  602.         super.hasChanged = true;
  603.         autoRepaint();
  604.     }
  605.     private void paintBars(Graphics g, Rectangle rectangle)
  606.     {
  607.         int i = getSeriesCount();
  608.         int j = getSampleCount();
  609.         if(rectangle.width < 0 || rectangle.height < 0)
  610.             return;
  611.         boolean flag = is3DModeOn();
  612.         if(flag)
  613.             g.setClip((rectangle.x - super.depth3dPoint.x) + 1, rectangle.y + 1, (rectangle.width + super.depth3dPoint.x) - 1, rectangle.height - super.depth3dPoint.y - 1);
  614.         else
  615.         if(super.parentChart != null && super.parentChart.is3DModeOn())
  616.             g.setClip((rectangle.x + 1) - super.parentChart.depth3dPoint.x, (rectangle.y + 1) - super.parentChart.depth3dPoint.y, rectangle.width - 1, rectangle.height - 1);
  617.         else
  618.             g.setClip(rectangle.x + 1, rectangle.y + 1, rectangle.width - 1, rectangle.height - 1);
  619.         if(super.gridAlignment == 1)
  620.         {
  621.             if(barType == 0)
  622.             {
  623.                 for(int k = 0; k < j; k++)
  624.                 {
  625.                     for(int i2 = 0; i2 < i; i2++)
  626.                         paintBar(g, i2, k);
  627.                 }
  628.             } else
  629.             {
  630.                 for(int l = 0; l < j; l++)
  631.                 {
  632.                     for(int j2 = i - 1; j2 >= 0; j2--)
  633.                         if(getSampleValue(j2, l) < 0.0D)
  634.                             paintBar(g, j2, l);
  635.                 }
  636.                 for(int i1 = 0; i1 < j; i1++)
  637.                 {
  638.                     for(int k2 = 0; k2 < i; k2++)
  639.                         if(getSampleValue(k2, i1) >= 0.0D)
  640.                             paintBar(g, k2, i1);
  641.                 }
  642.             }
  643.         } else
  644.         if(barType == 0)
  645.         {
  646.             for(int j1 = j - 1; j1 >= 0; j1--)
  647.             {
  648.                 for(int l2 = i - 1; l2 >= 0; l2--)
  649.                     paintBar(g, l2, j1);
  650.             }
  651.         } else
  652.         {
  653.             for(int k1 = j - 1; k1 >= 0; k1--)
  654.             {
  655.                 for(int i3 = i - 1; i3 >= 0; i3--)
  656.                     if(getSampleValue(i3, k1) < 0.0D)
  657.                         paintBar(g, i3, k1);
  658.             }
  659.             for(int l1 = j - 1; l1 >= 0; l1--)
  660.             {
  661.                 for(int j3 = 0; j3 < i; j3++)
  662.                     if(getSampleValue(j3, l1) >= 0.0D)
  663.                         paintBar(g, j3, l1);
  664.             }
  665.         }
  666.         if(flag)
  667.         {
  668.             g.setColor(getBackground());
  669.             Polygon polygon = new Polygon();
  670.             polygon.addPoint(rectangle.x + rectangle.width, rectangle.y + rectangle.height);
  671.             polygon.addPoint(rectangle.x + rectangle.width, ((rectangle.y + rectangle.height) - super.depth3dPoint.y) + 1);
  672.             polygon.addPoint((rectangle.x + rectangle.width) - super.depth3dPoint.x - 1, ((rectangle.y + rectangle.height) - super.depth3dPoint.y) + 1);
  673.             g.fillPolygon(polygon);
  674.             g.setColor(getChartForeground());
  675.             g.drawLine(rectangle.x + rectangle.width, rectangle.y + rectangle.height, (rectangle.x + rectangle.width) - super.depth3dPoint.x, (rectangle.y + rectangle.height) - super.depth3dPoint.y);
  676.             polygon.xpoints[0] = rectangle.x;
  677.             polygon.ypoints[0] = rectangle.y;
  678.             polygon.xpoints[1] = rectangle.x - super.depth3dPoint.x;
  679.             polygon.ypoints[1] = rectangle.y;
  680.             polygon.xpoints[2] = rectangle.x - super.depth3dPoint.x;
  681.             polygon.ypoints[2] = rectangle.y - super.depth3dPoint.y;
  682.             g.setColor(getBackground());
  683.             g.fillPolygon(polygon);
  684.             g.setColor(getChartForeground());
  685.             g.drawLine(rectangle.x, rectangle.y, rectangle.x - super.depth3dPoint.x, rectangle.y - super.depth3dPoint.y);
  686.         }
  687.     }
  688.     public void setValueLabelStyle(int i)
  689.     {
  690.         switch(i)
  691.         {
  692.         case 0: // ''
  693.         case 1: // '01'
  694.         case 2: // '02'
  695.             valueLabelStyle = i;
  696.             super.hasChanged = true;
  697.             autoRepaint();
  698.             break;
  699.         default:
  700.             throw new IllegalArgumentException("Invalid valueLabelStyle: " + i);
  701.         }
  702.     }
  703.     public int getValueLabelStyle()
  704.     {
  705.         return valueLabelStyle;
  706.     }
  707.     public boolean isMultiColorOn()
  708.     {
  709.         return multiColorOn;
  710.     }
  711.     public boolean isBarOutlineOn()
  712.     {
  713.         return barOutlineOn;
  714.     }
  715.     public ChartSample checkSelection(Point point)
  716.     {
  717.         ChartSample chartsample = null;
  718.         int i = getSeriesCount();
  719.         if(isLegendOn() && super.legendBounds != null)
  720.         {
  721.             for(int j = 0; j < super.legendBounds.length; j++)
  722.             {
  723.                 if(super.legendBounds[j] == null || !super.legendBounds[j].contains(point))
  724.                     continue;
  725.                 if(i > 1 || barType == 1 || super.multiSeriesOn)
  726.                 {
  727.                     chartsample = new ChartSample(-1);
  728.                     chartsample.setSeries(j);
  729.                 } else
  730.                 {
  731.                     chartsample = getSample(0, j);
  732.                 }
  733.                 break;
  734.             }
  735.         }
  736.         if(chartsample == null && barBounds != null)
  737.         {
  738.             for(int k = getSampleCount(); k != 0;)
  739.             {
  740.                 int l = super.gridAlignment != 0 ? k - 1 : getSampleCount() - k;
  741.                 k--;
  742.                 for(int i1 = getSeriesCount(); i1 != 0;)
  743.                 {
  744.                     int j1 = super.gridAlignment != 0 ? i1 - 1 : getSeriesCount() - i1;
  745.                     j1 = barType != 1 ? j1 : i1 - 1;
  746.                     i1--;
  747.                     Rectangle rectangle = barBounds[j1][l];
  748.                     if(rectangle != null && rectangle != null)
  749.                     {
  750.                         Rectangle rectangle1 = rectangle;
  751.                         if(barType != 1 || getSeriesCount() <= 1)
  752.                             if(super.gridAlignment == 1 && rectangle1.height < 3)
  753.                             {
  754.                                 rectangle1.y -= 3 - rectangle1.height;
  755.                                 rectangle1.height = 6;
  756.                             } else
  757.                             if(super.gridAlignment == 0 && rectangle1.width < 3)
  758.                             {
  759.                                 rectangle1.x -= 3 - rectangle1.width;
  760.                                 rectangle1.width = 6;
  761.                             }
  762.                         if(rectangle1.contains(point))
  763.                             return getSample(j1, l);
  764.                         if(is3DModeOn())
  765.                         {
  766.                             if(super.gridAlignment != 1 || barType != 1 || getSampleValues(j1)[l] > 0.0D || j1 == 0)
  767.                             {
  768.                                 Polygon polygon = new Polygon();
  769.                                 polygon.addPoint(rectangle.x, rectangle.y);
  770.                                 polygon.addPoint(polygon.xpoints[0] + super.depth3dPoint.x, polygon.ypoints[0] + super.depth3dPoint.y);
  771.                                 polygon.addPoint(polygon.xpoints[1] + rectangle.width, polygon.ypoints[1]);
  772.                                 polygon.addPoint(rectangle.x + rectangle.width, rectangle.y);
  773.                                 if(polygon.contains(point))
  774.                                     return getSample(j1, l);
  775.                             }
  776.                             if(super.gridAlignment != 0 || barType != 1 || getSampleValues(j1)[l] > 0.0D || j1 == 0)
  777.                             {
  778.                                 Polygon polygon1 = new Polygon();
  779.                                 polygon1.addPoint((rectangle.x + rectangle.width) - 1, rectangle.y);
  780.                                 polygon1.addPoint(rectangle.x + super.depth3dPoint.x + rectangle.width, rectangle.y + super.depth3dPoint.y);
  781.                                 polygon1.addPoint(rectangle.x + super.depth3dPoint.x + rectangle.width, rectangle.y + super.depth3dPoint.y + rectangle.height);
  782.                                 polygon1.addPoint((rectangle.x + rectangle.width) - 1, rectangle.y + rectangle.height);
  783.                                 if(polygon1.contains(point))
  784.                                     return getSample(j1, l);
  785.                             }
  786.                         }
  787.                     }
  788.                 }
  789.             }
  790.         }
  791.         return chartsample;
  792.     }
  793.     protected void renderData(Graphics g, Rectangle rectangle, Rectangle rectangle1)
  794.     {
  795.         paintBars(g, rectangle);
  796.         if(is3DModeOn())
  797.         {
  798.             for(int i = super.rangeOn.length - 1; i >= 0; i--)
  799.                 paint3DZeroDivider(g, rectangle, i);
  800.             if(isRangeOn(1))
  801.                 paint3DEdges(super.og, rectangle);
  802.         }
  803.         paintValueLabels(g, rectangle);
  804.     }
  805.     public void reset()
  806.     {
  807.         super.reset();
  808.         multiColorOn = false;
  809.         super.barLabelStyle = 0;
  810.         valueLabelStyle = 0;
  811.         barOutlineOn = true;
  812.         autoLabelSpacingOn = false;
  813.         barWidthFraction = 0.40000000000000002D;
  814.         barType = 0;
  815.         super.multiSeriesOn = false;
  816.         barWidthFraction = 0.40000000000000002D;
  817.         selectedSeries = -1;
  818.         selectedSample = -1;
  819.         barOutlineColor = null;
  820.     }
  821.     public BarChart()
  822.     {
  823.         this(1);
  824.     }
  825.     public BarChart(int i)
  826.     {
  827.         this(i, 100D);
  828.     }
  829.     public BarChart(int i, double d)
  830.     {
  831.         this(i, d, 0.0D);
  832.     }
  833.     public BarChart(int i, double d, double d1)
  834.     {
  835.         this(1, i, d, d1);
  836.     }
  837.     public BarChart(int i, int j, double d, double d1)
  838.     {
  839.         super(j);
  840.         super.chartType = "bar";
  841.         setAutomaticRepaintOn(false);
  842.         setSeriesCount(i);
  843.         super.upperRange[0] = super.currentUpperRange[0] = d;
  844.         super.lowerRange[0] = super.currentLowerRange[0] = d1;
  845.         mousePosition = new Point();
  846.         setAutomaticRepaintOn(true);
  847.     }
  848.     public boolean isBarLabelsOn()
  849.     {
  850.         return super.sampleLabelsOn;
  851.     }
  852.     public boolean isAutoLabelSpacingOn()
  853.     {
  854.         return autoLabelSpacingOn;
  855.     }
  856.     public void setMultiSeriesOn(boolean flag)
  857.     {
  858.         super.multiSeriesOn = flag;
  859.         super.hasChanged = true;
  860.         autoRepaint();
  861.     }
  862.     private String constructFloatingLabel(int i, int j, boolean flag)
  863.     {
  864.         if(i < 0 || i >= getSeriesCount() || j < 0 || j >= getSampleCount())
  865.             return "";
  866.         String s = "";
  867.         if(super.sampleLabelsOn && (super.barLabelStyle == 1 || super.barLabelStyle == 2))
  868.             if(getSeriesCount() == 1)
  869.             {
  870.                 if(getSampleLabel(j) != null)
  871.                     s += getSampleLabel(j);
  872.             } else
  873.             {
  874.                 String s1 = getSeriesLabel(i);
  875.                 if(flag && s1 != null)
  876.                     if(s1.endsWith("n"))
  877.                         s += s1;
  878.                     else
  879.                         s += s1 + " : ";
  880.                 if(getSampleLabel(j) != null)
  881.                     s += getSampleLabel(j);
  882.             }
  883.         if(isValueLabelsOn() && valueLabelStyle == 2)
  884.         {
  885.             String s2 = getLabel("valueLabelPrefix_" + i);
  886.             if(s2 == null)
  887.                 s2 = getLabel("valueLabelPrefix");
  888.             String s3 = getLabel("valueLabelPostfix_" + i);
  889.             if(s3 == null)
  890.                 s3 = getLabel("valueLabelPostfix");
  891.             if(s.length() > 0)
  892.             {
  893.                 String s4 = formatNumber(getSampleValue(i, j), getSampleDecimalCount(i));
  894.                 s4 = s2 == null ? s4 : s2 + s4;
  895.                 s4 = s3 == null ? s4 : s4 + s3;
  896.                 if(s.endsWith("n"))
  897.                     s += s4;
  898.                 else
  899.                     s = s + " : " + s4;
  900.             } else
  901.             {
  902.                 s = formatNumber(getSampleValue(i, j), getSampleDecimalCount(i));
  903.                 s = s2 == null ? s : s2 + s;
  904.                 s = s3 == null ? s : s + s3;
  905.             }
  906.         }
  907.         return s;
  908.     }
  909.     private void paintValueLabels(Graphics g, Rectangle rectangle)
  910.     {
  911.         g.setClip(0, 0, 32767, 32767);
  912.         int i = getSampleCount();
  913.         int j = getSeriesCount();
  914.         if(i == 0 || j == 0 || valueLabelStyle == 2)
  915.             return;
  916.         Font font = getFont("valueLabelFont");
  917.         getSize();
  918.         g.setFont(font);
  919.         FontMetrics fontmetrics = g.getFontMetrics();
  920.         boolean flag = is3DModeOn();
  921.         int k = rectangle.y;
  922.         int l = (k + rectangle.height) - (flag ? super.depth3dPoint.y : 0);
  923.         int i1 = rectangle.x - (flag ? super.depth3dPoint.x : 0);
  924.         int j1 = rectangle.x + rectangle.width;
  925.         getChartBackground();
  926.         int k1 = getLabelAngle("valueLabelAngle");
  927.         int l1 = fontmetrics.getHeight();
  928.         int i2 = fontmetrics.getDescent();
  929.         int j2 = fontmetrics.getAscent();
  930.         if(valueLabelStyle == 0 && j > 1 && barType == 1)
  931.         {
  932.             if(!isValueLabelsOn(0))
  933.                 return;
  934.             int k2 = getSampleDecimalCount(0);
  935.             String s = getLabel("valueLabelPrefix");
  936.             String s1 = getLabel("valueLabelPostfix");
  937.             for(int j3 = 0; j3 < i; j3++)
  938.             {
  939.                 double d = 0.0D;
  940.                 double d2 = 0.0D;
  941.                 boolean flag1 = false;
  942.                 for(int l3 = 0; l3 < j; l3++)
  943.                 {
  944.                     ChartSample chartsample1 = getSample(l3, j3);
  945.                     if(chartsample1 != null && chartsample1.value != null)
  946.                     {
  947.                         flag1 = true;
  948.                         double d3 = chartsample1.getFloatValue();
  949.                         if(d3 >= 0.0D)
  950.                             d += d3;
  951.                         else
  952.                             d2 += d3;
  953.                     }
  954.                 }
  955.                 if(flag1)
  956.                 {
  957.                     String s5 = formatNumber(d, k2);
  958.                     s5 = s == null ? s5 : s + s5;
  959.                     s5 = s1 == null ? s5 : s5 + s1;
  960.                     Dimension dimension1 = getLabelSize(s5, font);
  961.                     Dimension dimension3 = getAngledLabelSize(dimension1, k1);
  962.                     int i4 = fontmetrics.stringWidth(s5);
  963.                     String s6 = formatNumber(d2, k2);
  964.                     s6 = s == null ? s6 : s + s6;
  965.                     s6 = s1 == null ? s6 : s6 + s1;
  966.                     Dimension dimension4 = getLabelSize(s6, font);
  967.                     Dimension dimension5 = getAngledLabelSize(dimension4, k1);
  968.                     int l4 = fontmetrics.stringWidth(s6);
  969.                     Rectangle rectangle2 = barBounds[0][j3];
  970.                     Rectangle rectangle3 = barBounds[0][j3];
  971.                     for(int i5 = 0; i5 < barBounds.length; i5++)
  972.                     {
  973.                         Rectangle rectangle4 = barBounds[i5][j3];
  974.                         if(rectangle4 != null)
  975.                             if(super.gridAlignment == 1)
  976.                             {
  977.                                 if(rectangle4.y < rectangle2.y)
  978.                                     rectangle2 = rectangle4;
  979.                                 if(rectangle4.y + rectangle4.height > rectangle3.y + rectangle3.height)
  980.                                     rectangle3 = rectangle4;
  981.                             } else
  982.                             {
  983.                                 if(rectangle4.x + rectangle4.width > rectangle2.x + rectangle2.width)
  984.                                     rectangle2 = rectangle4;
  985.                                 if(rectangle4.x < rectangle3.x)
  986.                                     rectangle3 = rectangle4;
  987.                             }
  988.                     }
  989.                     int j5 = (rectangle2.x + rectangle2.width / 2) - dimension3.width / 2;
  990.                     int k5 = rectangle2.y - 2;
  991.                     if(k1 % 180 != 0)
  992.                         k5 -= dimension3.height;
  993.                     int l5 = (rectangle3.x + rectangle3.width / 2) - dimension5.width / 2;
  994.                     int i6 = (rectangle3.y + rectangle3.height + l1) - i2;
  995.                     if(k1 % 180 != 0)
  996.                         i6 = rectangle3.y + rectangle3.height + 2;
  997.                     if(super.gridAlignment == 0)
  998.                     {
  999.                         j5 = rectangle2.x + rectangle2.width + 2;
  1000.                         k5 = ((rectangle2.y + rectangle2.height / 2 + l1 / 2) - i2) + 1;
  1001.                         l5 = rectangle3.x - l4 - 1;
  1002.                         i6 = k5;
  1003.                     }
  1004.                     if(flag)
  1005.                         if(super.gridAlignment == 1)
  1006.                         {
  1007.                             j5 += super.depth3dPoint.x;
  1008.                             k5 += super.depth3dPoint.y;
  1009.                         } else
  1010.                         {
  1011.                             j5 += super.depth3dPoint.x;
  1012.                             k5 += super.depth3dPoint.y;
  1013.                         }
  1014.                     if(super.gridAlignment == 1)
  1015.                     {
  1016.                         if(k1 % 180 == 0)
  1017.                         {
  1018.                             k5 = Math.max(k5, rectangle.y - 2);
  1019.                             k5 = Math.min((rectangle.y + rectangle.height) - 2, k5);
  1020.                             i6 = Math.max((rectangle.y + j2) - (flag ? super.depth3dPoint.y : 0), i6);
  1021.                             i6 = Math.min((rectangle.y + rectangle.height + j2) - (flag ? super.depth3dPoint.y : 0), i6);
  1022.                         } else
  1023.                         {
  1024.                             k5 = Math.max(k5, rectangle.y - dimension3.height - 2);
  1025.                             k5 = Math.min(k5, (rectangle.y + rectangle.height) - dimension3.height - 2);
  1026.                             i6 = Math.min(i6, (rectangle.y + rectangle.height + 2) - (flag ? super.depth3dPoint.y : 0));
  1027.                             i6 = Math.max(i6, (rectangle.y + 2) - (flag ? super.depth3dPoint.y : 0));
  1028.                         }
  1029.                     } else
  1030.                     {
  1031.                         j5 = Math.min(rectangle.x + rectangle.width + 2, j5);
  1032.                         j5 = Math.max(rectangle.x + 2, j5);
  1033.                         l5 = Math.max(rectangle.x - l4 - 1 - (flag ? super.depth3dPoint.x : 0), l5);
  1034.                         l5 = Math.min((rectangle.x + rectangle.width) - l4 - 1 - (flag ? super.depth3dPoint.x : 0), l5);
  1035.                     }
  1036.                     boolean flag3 = true;
  1037.                     boolean flag4 = true;
  1038.                     if(super.gridAlignment == 1)
  1039.                     {
  1040.                         if(j5 + i4 / 2 < i1 - 3 || j5 + i4 / 2 > j1 + 3)
  1041.                             flag3 = false;
  1042.                         if(l5 + l4 / 2 < i1 - 3 || l5 + l4 / 2 > j1 + 3)
  1043.                             flag4 = false;
  1044.                     } else
  1045.                     {
  1046.                         if(k5 - l1 / 2 < k - 3 || k5 - l1 / 2 > l)
  1047.                             flag3 = false;
  1048.                         if(i6 - l1 / 2 < k - 3 || i6 - l1 / 2 > l)
  1049.                             flag4 = false;
  1050.                     }
  1051.                     g.setColor(getForeground());
  1052.                     if(d >= 0.0D && super.upperRange[0] > 0.0D && flag3 && (d != 0.0D || d2 >= 0.0D))
  1053.                         paintLabel(g, s5, j5, k5, dimension1, 0, super.gridAlignment != 1 ? 0 : k1);
  1054.                     if(d2 < 0.0D && super.lowerRange[0] < 0.0D && flag4)
  1055.                         paintLabel(g, s6, l5, i6, dimension4, 0, super.gridAlignment != 1 ? 0 : k1);
  1056.                 }
  1057.             }
  1058.         } else
  1059.         if(valueLabelStyle == 0 || valueLabelStyle == 1)
  1060.         {
  1061.             for(int l2 = 0; l2 < i; l2++)
  1062.             {
  1063.                 for(int i3 = 0; i3 < j; i3++)
  1064.                 {
  1065.                     ChartSample chartsample = getSample(i3, l2);
  1066.                     if(chartsample != null && chartsample.value != null && !chartsample.value.isNaN() && isValueLabelsOn(i3))
  1067.                     {
  1068.                         String s2 = getLabel("valueLabelPrefix_" + i3);
  1069.                         if(s2 == null)
  1070.                             s2 = getLabel("valueLabelPrefix");
  1071.                         String s3 = getLabel("valueLabelPostfix_" + i3);
  1072.                         if(s3 == null)
  1073.                             s3 = getLabel("valueLabelPostfix");
  1074.                         double d1 = chartsample.getFloatValue();
  1075.                         int k3 = getSampleDecimalCount(i3);
  1076.                         String s4 = formatNumber(d1, k3);
  1077.                         s4 = s2 == null ? s4 : s2 + s4;
  1078.                         s4 = s3 == null ? s4 : s4 + s3;
  1079.                         Dimension dimension = getLabelSize(s4, font);
  1080.                         Dimension dimension2 = getAngledLabelSize(dimension, k1);
  1081.                         Rectangle rectangle1 = barBounds[i3][l2];
  1082.                         int j4 = 0;
  1083.                         int k4 = 0;
  1084.                         boolean flag2 = true;
  1085.                         if(valueLabelStyle == 0)
  1086.                         {
  1087.                             if(super.gridAlignment == 1)
  1088.                             {
  1089.                                 j4 = (rectangle1.x + rectangle1.width / 2) - dimension2.width / 2;
  1090.                                 if(d1 >= 0.0D)
  1091.                                 {
  1092.                                     if(k1 % 180 == 0)
  1093.                                     {
  1094.                                         k4 = rectangle1.y - 2;
  1095.                                         k4 = Math.max(k - 2, k4);
  1096.                                         k4 = Math.min(l - 1, k4);
  1097.                                     } else
  1098.                                     {
  1099.                                         k4 = rectangle1.y - 2 - dimension2.height;
  1100.                                         k4 = Math.max(k4, k - dimension2.height - 2);
  1101.                                         k4 = Math.min(k4, l - dimension2.height - 2);
  1102.                                     }
  1103.                                     if(k1 % 180 > 0 && k1 % 180 < 90)
  1104.                                         j4 = ((rectangle1.x + rectangle1.width) - dimension2.width) + 1;
  1105.                                     else
  1106.                                     if(k1 % 180 > 90)
  1107.                                         j4 = rectangle1.x - 1;
  1108.                                     if(flag && j == 1)
  1109.                                     {
  1110.                                         k4 += super.depth3dPoint.y;
  1111.                                         j4 += super.depth3dPoint.x;
  1112.                                         if(k1 % 180 == 0)
  1113.                                             k4 = Math.max(k - 2, k4);
  1114.                                         else
  1115.                                             k4 = Math.max(k - dimension2.height - 2, k4);
  1116.                                     }
  1117.                                 } else
  1118.                                 {
  1119.                                     if(k1 % 180 == 0)
  1120.                                     {
  1121.                                         k4 = rectangle1.y + rectangle1.height + j2;
  1122.                                         k4 = Math.min(l + j2, k4);
  1123.                                         if(flag)
  1124.                                             k4 = Math.max((k - super.depth3dPoint.y) + j2, k4);
  1125.                                         else
  1126.                                             k4 = Math.max(k + j2, k4);
  1127.                                     } else
  1128.                                     {
  1129.                                         k4 = rectangle1.y + rectangle1.height + 3;
  1130.                                         k4 = Math.min(l + 3, k4);
  1131.                                         if(flag)
  1132.                                             k4 = Math.max((k - super.depth3dPoint.y) + 2, k4);
  1133.                                         else
  1134.                                             k4 = Math.max(k + 2, k4);
  1135.                                     }
  1136.                                     if(k1 % 180 > 0 && k1 % 180 < 90)
  1137.                                         j4 = rectangle1.x - 1;
  1138.                                     else
  1139.                                     if(k1 % 180 > 90)
  1140.                                         j4 = ((rectangle1.x + rectangle1.width) - dimension2.width) + 1;
  1141.                                 }
  1142.                             } else
  1143.                             {
  1144.                                 if(d1 >= 0.0D)
  1145.                                 {
  1146.                                     j4 = rectangle1.x + rectangle1.width + 3;
  1147.                                     j4 = Math.min(rectangle.x + rectangle.width + 3, j4);
  1148.                                     j4 = Math.max(i1 + 3, j4);
  1149.                                 } else
  1150.                                 {
  1151.                                     j4 = rectangle1.x - dimension.width - 3;
  1152.                                     j4 = Math.max(i1 - dimension.width - 3, j4);
  1153.                                     j4 = Math.min((i1 + rectangle.width) - dimension.width - 3, j4);
  1154.                                 }
  1155.                                 k4 = ((rectangle1.y + rectangle1.height / 2 + l1 / 2) - i2) + 1;
  1156.                                 if(flag && j == 1 && d1 >= 0.0D)
  1157.                                 {
  1158.                                     k4 += super.depth3dPoint.y;
  1159.                                     j4 += super.depth3dPoint.x;
  1160.                                     j4 = Math.min(rectangle.x + rectangle.width + 3, j4);
  1161.                                 }
  1162.                             }
  1163.                         } else
  1164.                         if(super.gridAlignment == 1)
  1165.                         {
  1166.                             j4 = ((rectangle1.x + rectangle1.width / 2) - dimension2.width / 2) + 1;
  1167.                             if(d1 >= 0.0D)
  1168.                             {
  1169.                                 if(k1 % 180 == 0)
  1170.                                 {
  1171.                                     k4 = rectangle1.y + fontmetrics.getAscent();
  1172.                                     k4 = Math.max(k4, (rectangle.y + dimension2.height) - 1);
  1173.                                     k4 = Math.min(k4, (rectangle.y + rectangle.height) - 2);
  1174.                                 } else
  1175.                                 {
  1176.                                     k4 = rectangle1.y + 3;
  1177.                                     k4 = Math.min(k4, (rectangle1.y + rectangle1.height) - dimension2.height - 2);
  1178.                                     k4 = Math.max(k4, rectangle.y + 3);
  1179.                                 }
  1180.                             } else
  1181.                             if(k1 % 180 == 0)
  1182.                             {
  1183.                                 k4 = (rectangle1.y + rectangle1.height) - 2;
  1184.                                 k4 = Math.min(k4, (rectangle.y + rectangle.height) - 2 - (flag ? super.depth3dPoint.y : 0));
  1185.                                 k4 = Math.max(k4, (rectangle.y + dimension2.height) - 1);
  1186.                             } else
  1187.                             {
  1188.                                 k4 = (rectangle1.y + rectangle1.height) - dimension2.height - 2;
  1189.                                 k4 = Math.min(k4, (rectangle.y + rectangle.height) - dimension2.height - 2 - (flag ? super.depth3dPoint.y : 0));
  1190.                                 k4 = Math.max(k4, (rectangle.y + 3) - (flag ? super.depth3dPoint.y : 0));
  1191.                             }
  1192.                             if(barType == 1 && j > 1)
  1193.                                 flag2 = dimension2.height < rectangle1.height;
  1194.                         } else
  1195.                         {
  1196.                             k4 = ((rectangle1.y + rectangle1.height / 2 + l1 / 2) - i2) + 1;
  1197.                             if(d1 >= 0.0D)
  1198.                             {
  1199.                                 j4 = (rectangle1.x + rectangle1.width) - dimension.width - 1;
  1200.                                 j4 = Math.max(j4, rectangle1.x + 2);
  1201.                                 j4 = Math.min(j4, (rectangle.x + rectangle.width) - dimension.width - 1);
  1202.                             } else
  1203.                             {
  1204.                                 j4 = rectangle1.x + 2;
  1205.                                 j4 = Math.max(j4, (rectangle.x + 2) - (flag ? super.depth3dPoint.x : 0));
  1206.                                 j4 = Math.min(j4, (rectangle.x + rectangle.width) - dimension.width - 1 - (flag ? super.depth3dPoint.x : 0));
  1207.                             }
  1208.                             if(barType == 1 && j > 1)
  1209.                                 flag2 = dimension2.width < rectangle1.width;
  1210.                         }
  1211.                         Object obj = null;
  1212.                         if(valueLabelStyle == 0)
  1213.                         {
  1214.                             g.setColor(getForeground());
  1215.                             Color color = getChartBackground();
  1216.                         } else
  1217.                         {
  1218.                             Color color2 = getSampleColor(0);
  1219.                             if(multiColorOn)
  1220.                                 if(j > 1 || barType == 1 || super.multiSeriesOn)
  1221.                                     color2 = getSampleColor(i3);
  1222.                                 else
  1223.                                     color2 = getSampleColor(l2);
  1224.                             if((color2.getRed() + color2.getGreen() + color2.getBlue()) / 3 > 110)
  1225.                                 g.setColor(Color.black);
  1226.                             else
  1227.                                 g.setColor(Color.white);
  1228.                             Color color1 = color2;
  1229.                         }
  1230.                         if(super.gridAlignment == 1)
  1231.                         {
  1232.                             if(j4 + dimension2.width / 2 < i1 - 3 || j4 + dimension2.width / 2 > j1 + 3)
  1233.                                 flag2 = false;
  1234.                         } else
  1235.                         if(k4 - l1 / 2 < k - 3 || k4 - l1 / 2 > l)
  1236.                             flag2 = false;
  1237.                         if(flag2)
  1238.                             paintLabel(g, s4, j4, k4, dimension, 0, super.gridAlignment != 1 ? 0 : k1);
  1239.                     }
  1240.                 }
  1241.             }
  1242.         }
  1243.     }
  1244.     public void setBarWidth(double d)
  1245.     {
  1246.         d = Math.max(0.0D, d);
  1247.         d = Math.min(1.0D, d);
  1248.         barWidthFraction = d;
  1249.         super.hasChanged = true;
  1250.         autoRepaint();
  1251.     }
  1252.     public double getBarWidth()
  1253.     {
  1254.         return barWidthFraction;
  1255.     }
  1256.     public void setBarLabelStyle(int i)
  1257.     {
  1258.         switch(i)
  1259.         {
  1260.         case 0: // ''
  1261.         case 1: // '01'
  1262.         case 2: // '02'
  1263.             super.barLabelStyle = i;
  1264.             super.hasChanged = true;
  1265.             autoRepaint();
  1266.             break;
  1267.         default:
  1268.             throw new IllegalArgumentException("Invalid barLabelStyle: " + i);
  1269.         }
  1270.     }
  1271.     public int getBarLabelStyle()
  1272.     {
  1273.         return super.barLabelStyle;
  1274.     }
  1275.     public void render(Graphics g)
  1276.     {
  1277.         render(g, !isServletModeOn());
  1278.     }
  1279.     void render(Graphics g, boolean flag)
  1280.     {
  1281.         Rectangle rectangle = getGraphBounds();
  1282.         Rectangle rectangle1 = getDataBounds(rectangle);
  1283.         calculateChartData(rectangle, rectangle1);
  1284.         for(int i = 0; i < super.overlayCharts.size(); i++)
  1285.         {
  1286.             Chart chart = (Chart)super.overlayCharts.elementAt(i);
  1287.             if(chart != null && isOverlayChartOn(i))
  1288.             {
  1289.                 Rectangle rectangle2 = new Rectangle(rectangle);
  1290.                 Rectangle rectangle3 = new Rectangle(rectangle1);
  1291.                 if(is3DModeOn())
  1292.                 {
  1293.                     rectangle2.x -= super.depth3dPoint.x;
  1294.                     rectangle2.y -= super.depth3dPoint.y;
  1295.                     rectangle3.x -= super.depth3dPoint.x;
  1296.                     rectangle3.y -= super.depth3dPoint.y;
  1297.                 }
  1298.                 chart.calculateChartData(rectangle2, rectangle3);
  1299.             }
  1300.         }
  1301.         Dimension dimension = getSize();
  1302.         if(flag && super.offscreen == null)
  1303.         {
  1304.             super.offscreen = createImage(Math.max(1, dimension.width), Math.max(1, dimension.height));
  1305.             super.hasChanged = true;
  1306.         }
  1307.         if(!flag || super.hasChanged || super.offscreen == null)
  1308.         {
  1309.             if(!super.externalGraphicsOn && !flag)
  1310.                 super.og = g;
  1311.             else
  1312.             if(flag || super.externalGraphicsOn)
  1313.             {
  1314.                 if(!super.externalGraphicsOn && super.offscreen != null)
  1315.                     super.og = super.offscreen.getGraphics();
  1316.                 super.og.setColor(getBackground());
  1317.                 super.og.fillRect(0, 0, dimension.width, dimension.height);
  1318.             }
  1319.             paintTitle(super.og, dimension);
  1320.             if(isLegendOn())
  1321.                 paintLegend(super.og, rectangle, getLegendLabels());
  1322.             paintGrid(super.og, rectangle);
  1323.             paintBarLabels(super.og, rectangle);
  1324.             if(super.upperRange != super.lowerRange)
  1325.             {
  1326.                 renderData(super.og, rectangle, rectangle1);
  1327.                 for(int j = 0; j < super.overlayCharts.size(); j++)
  1328.                 {
  1329.                     Chart chart1 = (Chart)super.overlayCharts.elementAt(j);
  1330.                     if(chart1 != null && isOverlayChartOn(j))
  1331.                     {
  1332.                         Rectangle rectangle4 = new Rectangle(rectangle);
  1333.                         Rectangle rectangle5 = new Rectangle(rectangle1);
  1334.                         rectangle4.x -= super.depth3dPoint.x;
  1335.                         rectangle4.y -= super.depth3dPoint.y;
  1336.                         rectangle5.x -= super.depth3dPoint.x;
  1337.                         rectangle5.y -= super.depth3dPoint.y;
  1338.                         if(chart1 instanceof LineChart)
  1339.                             chart1.renderData(super.og, rectangle4, getLineChartBounds(rectangle5));
  1340.                         else
  1341.                         if(chart1 instanceof PieChart)
  1342.                             chart1.renderData(super.og, rectangle4, rectangle5);
  1343.                         else
  1344.                             chart1.renderData(super.og, rectangle, rectangle1);
  1345.                     }
  1346.                 }
  1347.             }
  1348.             if(!super.externalGraphicsOn && super.og != g)
  1349.                 super.og.dispose();
  1350.             super.hasChanged = false;
  1351.         }
  1352.         if((flag || super.externalGraphicsOn) && super.offscreen != null)
  1353.             g.drawImage(super.offscreen, 0, 0, this);
  1354.         paintFloatingLabels(g, rectangle);
  1355.     }
  1356.     private void paint3DBar(Graphics g, Rectangle rectangle, boolean flag, double d)
  1357.     {
  1358.         Polygon polygon = new Polygon();
  1359.         polygon.addPoint(rectangle.x, rectangle.y);
  1360.         polygon.addPoint(polygon.xpoints[0] + super.depth3dPoint.x, polygon.ypoints[0] + super.depth3dPoint.y);
  1361.         polygon.addPoint(polygon.xpoints[1] + rectangle.width, polygon.ypoints[1]);
  1362.         polygon.addPoint(rectangle.x + rectangle.width, rectangle.y);
  1363.         Polygon polygon1 = new Polygon();
  1364.         polygon1.addPoint(rectangle.x + rectangle.width, rectangle.y);
  1365.         polygon1.addPoint(polygon.xpoints[2], polygon.ypoints[2]);
  1366.         polygon1.addPoint(polygon.xpoints[2], polygon.ypoints[2] + rectangle.height);
  1367.         polygon1.addPoint(rectangle.x + rectangle.width, rectangle.y + rectangle.height);
  1368.         g.setColor(g.getColor().darker());
  1369.         g.fillPolygon(polygon);
  1370.         g.setColor(g.getColor().darker());
  1371.         g.fillPolygon(polygon1);
  1372.         if(barOutlineOn)
  1373.         {
  1374.             if(barOutlineColor != null)
  1375.                 g.setColor(barOutlineColor);
  1376.             else
  1377.                 g.setColor(getChartForeground());
  1378.             g.drawPolygon(polygon);
  1379.             g.drawPolygon(polygon1);
  1380.             if(flag)
  1381.             {
  1382.                 g.drawLine(polygon1.xpoints[1] - 1, polygon1.ypoints[1] + 1, polygon1.xpoints[2] - 1, polygon1.ypoints[2]);
  1383.                 g.drawLine(polygon.xpoints[1], polygon.ypoints[1] + 1, polygon.xpoints[2] - 1, polygon.ypoints[2] + 1);
  1384.                 if(super.gridAlignment == 1)
  1385.                 {
  1386.                     g.drawLine(polygon1.xpoints[2] - 1, polygon1.ypoints[2], polygon1.xpoints[3] - 1, polygon1.ypoints[3]);
  1387.                     g.drawLine(polygon.xpoints[0] + 1, polygon.ypoints[0], polygon.xpoints[1] + 1, polygon.ypoints[1]);
  1388.                     if(rectangle.height != 0)
  1389.                         g.drawLine(polygon1.xpoints[0], polygon1.ypoints[0] + 1, polygon1.xpoints[1], polygon1.ypoints[1] + 1);
  1390.                     else
  1391.                         g.drawLine(polygon.xpoints[3] - 1, polygon.ypoints[3] - 1, polygon.xpoints[0] + 1, polygon.ypoints[0] - 1);
  1392.                 } else
  1393.                 {
  1394.                     g.drawLine(polygon1.xpoints[2], polygon1.ypoints[2] - 1, polygon1.xpoints[3], polygon1.ypoints[3] - 1);
  1395.                     g.drawLine(polygon.xpoints[0], polygon.ypoints[0] + 1, polygon.xpoints[1], polygon.ypoints[1] + 1);
  1396.                     if(rectangle.width != 0)
  1397.                         g.drawLine(polygon.xpoints[2] - 1, polygon.ypoints[2], polygon.xpoints[3] - 1, polygon.ypoints[3]);
  1398.                     else
  1399.                         g.drawLine(polygon1.xpoints[3] + 1, polygon1.ypoints[3] - 1, polygon1.xpoints[0] + 1, polygon1.ypoints[0] + 1);
  1400.                 }
  1401.             }
  1402.         } else
  1403.         if(flag)
  1404.         {
  1405.             if(barOutlineColor != null)
  1406.                 g.setColor(barOutlineColor);
  1407.             else
  1408.                 g.setColor(getChartForeground());
  1409.             g.drawPolygon(polygon);
  1410.             g.drawLine(polygon1.xpoints[1], polygon1.ypoints[1], polygon1.xpoints[2], polygon1.ypoints[2]);
  1411.             if(super.gridAlignment == 1)
  1412.             {
  1413.                 g.drawLine(polygon1.xpoints[2], polygon1.ypoints[2], polygon1.xpoints[3], polygon1.ypoints[3]);
  1414.             } else
  1415.             {
  1416.                 g.drawLine(polygon1.xpoints[2], polygon1.ypoints[2] - 1, polygon1.xpoints[3], polygon1.ypoints[3] - 1);
  1417.                 g.drawLine(polygon1.xpoints[3] - 1, polygon1.ypoints[3] - 1, polygon1.xpoints[0] - 1, polygon1.ypoints[0]);
  1418.             }
  1419.         }
  1420.     }
  1421.     public int getValuePosition(double d)
  1422.     {
  1423.         return getValuePosition(0, d, getGraphBounds());
  1424.     }
  1425.     public void setBarOutlineOn(boolean flag)
  1426.     {
  1427.         barOutlineOn = flag;
  1428.         super.hasChanged = true;
  1429.         autoRepaint();
  1430.     }
  1431.     public boolean isMultiSeriesOn()
  1432.     {
  1433.         return super.multiSeriesOn;
  1434.     }
  1435.     private void paint3DZeroDivider(Graphics g, Rectangle rectangle, int i)
  1436.     {
  1437.         i = Math.min(super.rangeOn.length - 1, Math.max(0, i));
  1438.         if(!super.rangeOn[i])
  1439.             return;
  1440.         g.setColor(i != 0 ? getRangeColor(i) : getChartForeground());
  1441.         if(super.gridAlignment == 1)
  1442.         {
  1443.             int j = Math.max(super.zeroLine[i], rectangle.y);
  1444.             j = Math.min(j, rectangle.y + rectangle.height);
  1445.             int l = rectangle.x - super.depth3dPoint.x;
  1446.             int j1 = j - super.depth3dPoint.y;
  1447.             g.drawLine(l, j1, l + rectangle.width, j1);
  1448.             g.drawLine(l + rectangle.width, j1, rectangle.x + rectangle.width, j);
  1449.         } else
  1450.         {
  1451.             int k = Math.max(super.zeroLine[i], rectangle.x);
  1452.             k = Math.min(k, rectangle.x + rectangle.width);
  1453.             int i1 = rectangle.y - super.depth3dPoint.y;
  1454.             int k1 = k - super.depth3dPoint.x;
  1455.             g.drawLine(k1, i1, k1, i1 + rectangle.height);
  1456.             g.drawLine(k1, i1, k, rectangle.y);
  1457.         }
  1458.     }
  1459.     private Rectangle getLineChartBounds(Rectangle rectangle)
  1460.     {
  1461.         Rectangle rectangle1 = new Rectangle(rectangle);
  1462.         int i = barType != 1 ? getSeriesCount() : 1;
  1463.         if(barBounds != null && barBounds.length > 0 && barBounds[0] != null && barBounds[0].length > 0)
  1464.         {
  1465.             int j = (barBounds[0][0].x + (barBounds[0][0].width * i) / 2) - rectangle.x;
  1466.             rectangle1.x += j;
  1467.             rectangle1.width -= j * 2;
  1468.         }
  1469.         return rectangle1;
  1470.     }
  1471.     public Rectangle getGraphBounds()
  1472.     {
  1473.         if(!super.hasChanged && super.currentBounds != null)
  1474.             return super.currentBounds;
  1475.         Rectangle rectangle = super.getGraphBounds(getLegendLabels());
  1476.         Dimension dimension = getSize();
  1477.         int i = rectangle.x;
  1478.         int j = dimension.width - rectangle.width - rectangle.x;
  1479.         int k = rectangle.y;
  1480.         int l = dimension.height - rectangle.height - rectangle.y;
  1481.         for(int i1 = 0; i1 < super.rangeAdjusterOn.length; i1++)
  1482.             if(super.rangeAdjusterOn[i1])
  1483.                 if(super.gridAlignment == 1)
  1484.                 {
  1485.                     if(super.rangeAdjusterPosition[i1] == 0)
  1486.                         i += 6;
  1487.                     else
  1488.                         j += 6;
  1489.                 } else
  1490.                 if(super.rangeAdjusterPosition[i1] == 0)
  1491.                     l += 6;
  1492.                 else
  1493.                     k += 6;
  1494.         if(super.sampleLabelsOn && (super.barLabelStyle == 0 || super.barLabelStyle == 2))
  1495.         {
  1496.             Font font = getFont("barLabelFont");
  1497.             FontMetrics fontmetrics = getFontMetrics(font);
  1498.             int k1 = getLabelAngle("barLabelAngle");
  1499.             if(super.gridAlignment == 1)
  1500.             {
  1501.                 int k2 = 0;
  1502.                 String as[] = getBarLabels();
  1503.                 for(int l4 = 0; l4 < as.length; l4++)
  1504.                 {
  1505.                     Dimension dimension3 = getLabelSize(as[l4], font);
  1506.                     Dimension dimension5 = getAngledLabelSize(dimension3, k1);
  1507.                     k2 = Math.max(dimension5.height, k2);
  1508.                 }
  1509.                 l += k2;
  1510.                 if(k1 % 180 == 0)
  1511.                     l -= fontmetrics.getMaxDescent();
  1512.             } else
  1513.             {
  1514.                 int l2 = 0;
  1515.                 String as1[] = getBarLabels();
  1516.                 for(int i5 = 0; i5 < as1.length; i5++)
  1517.                 {
  1518.                     Dimension dimension4 = getLabelSize(as1[i5], font);
  1519.                     Dimension dimension6 = getAngledLabelSize(dimension4, k1);
  1520.                     l2 = Math.max(l2, dimension6.width);
  1521.                 }
  1522.                 i += l2;
  1523.             }
  1524.         }
  1525.         boolean flag = false;
  1526.         for(int j1 = 0; j1 < super.rangeOn.length; j1++)
  1527.             flag = super.rangeOn[j1] ? true : flag;
  1528.         if(flag || super.rangeLabelsOn || super.targetsLabel.size() > 0)
  1529.         {
  1530.             FontMetrics fontmetrics1 = getFontMetrics(getFont("rangeLabelFont"));
  1531.             String s1 = getLabel("rangeLabelPrefix");
  1532.             String s2 = getLabel("rangeLabelPostfix");
  1533.             if(super.gridAlignment == 1)
  1534.             {
  1535.                 int l3 = 0;
  1536.                 int j5 = 0;
  1537.                 for(Enumeration enumeration = super.targetsLabel.keys(); enumeration.hasMoreElements();)
  1538.                 {
  1539.                     String s8 = (String)enumeration.nextElement();
  1540.                     String s13 = getTargetLabel(s8);
  1541.                     if(s13 != null && s13.length() > 0)
  1542.                         if(super.rangePosition[0] == 0)
  1543.                             l3 = Math.max(l3, fontmetrics1.stringWidth(s13));
  1544.                         else
  1545.                             j5 = Math.max(j5, fontmetrics1.stringWidth(s13));
  1546.                 }
  1547.                 if(super.rangeLabelsOn && super.rangeOn[0])
  1548.                 {
  1549.                     int k5 = getRangeDecimalCount(0);
  1550.                     String s9 = formatNumber(super.upperRange[0], k5);
  1551.                     String s14 = formatNumber(super.lowerRange[0], k5);
  1552.                     s9 = s1 == null ? s9 : s1 + s9;
  1553.                     s14 = s1 == null ? s14 : s1 + s14;
  1554.                     s9 = s2 == null ? s9 : s9 + s2;
  1555.                     s14 = s2 == null ? s14 : s14 + s2;
  1556.                     if(super.rangePosition[0] == 0)
  1557.                     {
  1558.                         l3 = Math.max(l3, fontmetrics1.stringWidth(s9));
  1559.                         l3 = Math.max(l3, fontmetrics1.stringWidth(s14));
  1560.                     } else
  1561.                     {
  1562.                         j5 = Math.max(j5, fontmetrics1.stringWidth(s9));
  1563.                         j5 = Math.max(j5, fontmetrics1.stringWidth(s14));
  1564.                     }
  1565.                 }
  1566.                 if(super.rangeOn[1])
  1567.                 {
  1568.                     int l5 = getRangeDecimalCount(1);
  1569.                     String s10 = formatNumber(super.upperRange[1], l5);
  1570.                     String s15 = formatNumber(super.lowerRange[1], l5);
  1571.                     if(super.rangePosition[1] == 0)
  1572.                     {
  1573.                         l3 = Math.max(l3, fontmetrics1.stringWidth(s10));
  1574.                         l3 = Math.max(l3, fontmetrics1.stringWidth(s15));
  1575.                     } else
  1576.                     {
  1577.                         j5 = Math.max(j5, fontmetrics1.stringWidth(s10));
  1578.                         j5 = Math.max(j5, fontmetrics1.stringWidth(s15));
  1579.                     }
  1580.                 }
  1581.                 i += l3 + 2;
  1582.                 j += j5 <= 0 ? 0 : j5 + 2;
  1583.             } else
  1584.             {
  1585.                 if(super.targetsValue.size() > 0)
  1586.                     k += fontmetrics1.getMaxAscent();
  1587.                 if(super.rangeLabelsOn && super.rangeOn[0])
  1588.                 {
  1589.                     if(super.rangePosition[0] == 0)
  1590.                     {
  1591.                         l += fontmetrics1.getMaxAscent();
  1592.                         if(super.targetsLabel.size() > 0)
  1593.                             l += fontmetrics1.getHeight();
  1594.                     } else
  1595.                     {
  1596.                         k += fontmetrics1.getMaxAscent();
  1597.                         if(super.targetsLabel.size() > 0)
  1598.                             k += fontmetrics1.getHeight();
  1599.                     }
  1600.                     int i4 = getRangeDecimalCount(0);
  1601.                     String s4 = formatNumber(super.upperRange[0], i4);
  1602.                     s4 = s1 == null ? s4 : s1 + s4;
  1603.                     s4 = s2 == null ? s4 : s4 + s2;
  1604.                     j = Math.max(j, fontmetrics1.stringWidth(s4) / 2 + 5);
  1605.                     String s6 = formatNumber(super.lowerRange[0], i4);
  1606.                     s6 = s1 == null ? s6 : s1 + s6;
  1607.                     s6 = s2 == null ? s6 : s6 + s2;
  1608.                     i = Math.max(i, fontmetrics1.stringWidth(s6) / 2 + 5);
  1609.                 }
  1610.                 if(super.rangeOn[1])
  1611.                 {
  1612.                     if(super.rangePosition[1] == 0)
  1613.                         l += fontmetrics1.getMaxAscent();
  1614.                     else
  1615.                         k += fontmetrics1.getMaxAscent();
  1616.                     int j4 = getRangeDecimalCount(1);
  1617.                     String s5 = formatNumber(super.upperRange[1], j4);
  1618.                     j = Math.max(j, fontmetrics1.stringWidth(s5) / 2 + 5);
  1619.                     String s7 = formatNumber(super.lowerRange[1], j4);
  1620.                     i = Math.max(i, fontmetrics1.stringWidth(s7) / 2 + 5);
  1621.                 }
  1622.             }
  1623.         }
  1624.         if(isValueLabelsOn(0) && valueLabelStyle == 0)
  1625.         {
  1626.             Font font1 = getFont("valueLabelFont");
  1627.             FontMetrics fontmetrics2 = getFontMetrics(font1);
  1628.             int i3 = getSampleDecimalCount(0);
  1629.             if(super.gridAlignment == 1)
  1630.             {
  1631.                 double d = getHighestValue(0);
  1632.                 int i6 = getLabelAngle("valueLabelAngle");
  1633.                 String s11 = formatNumber(d, i3);
  1634.                 Dimension dimension8 = getLabelSize(s11, font1);
  1635.                 Dimension dimension11 = getAngledLabelSize(dimension8, i6);
  1636.                 k += dimension11.height - 4;
  1637.                 double d5 = getLowestValue(0);
  1638.                 if(d5 < 0.0D)
  1639.                 {
  1640.                     String s12 = formatNumber(d5, i3);
  1641.                     Dimension dimension9 = getLabelSize(s12, font1);
  1642.                     Dimension dimension12 = getAngledLabelSize(dimension9, i6);
  1643.                     l += dimension12.height - 2;
  1644.                     if(i6 % 180 == 0)
  1645.                         l -= fontmetrics2.getDescent();
  1646.                 }
  1647.             } else
  1648.             {
  1649.                 double d1 = getHighestValue(0);
  1650.                 double d4 = 0.0D;
  1651.                 if(super.upperRange[0] - super.lowerRange[0] != 0.0D)
  1652.                     d4 = (d1 - super.lowerRange[0]) / (super.upperRange[0] - super.lowerRange[0]);
  1653.                 rectangle.x = i;
  1654.                 rectangle.width = dimension.width - i - j;
  1655.                 int j6 = (int)Math.round((double)rectangle.x + d4 * (double)rectangle.width);
  1656.                 int k6 = fontmetrics2.stringWidth(formatNumber(d1, i3));
  1657.                 j6 += k6;
  1658.                 if(j6 > rectangle.x + rectangle.width)
  1659.                     j += Math.min(j6 - rectangle.width - rectangle.x, k6);
  1660.                 double d6 = getLowestValue(0);
  1661.                 d4 = 0.0D;
  1662.                 if(super.upperRange[0] - super.lowerRange[0] != 0.0D)
  1663.                     d4 = (d6 - super.lowerRange[0]) / (super.upperRange[0] - super.lowerRange[0]);
  1664.                 j6 = (int)Math.round((double)rectangle.x + d4 * (double)rectangle.width);
  1665.                 k6 = fontmetrics2.stringWidth(formatNumber(d6, i3));
  1666.                 j6 -= k6;
  1667.                 if(j6 < rectangle.x)
  1668.                     i += Math.min(rectangle.x - j6, k6 - 6 - (super.sampleScrollerOn ? 10 : 0));
  1669.             }
  1670.         }
  1671.         String s = getLabel("sampleAxisLabel");
  1672.         if(s != null)
  1673.         {
  1674.             int l1 = getLabelAngle("sampleAxisLabelAngle");
  1675.             l1 = super.gridAlignment != 0 ? 0 : l1;
  1676.             Font font2 = getFont("sampleAxisLabelFont");
  1677.             getFontMetrics(font2);
  1678.             Dimension dimension1 = getLabelSize(s, font2);
  1679.             Dimension dimension2 = getAngledLabelSize(dimension1, l1);
  1680.             if(super.gridAlignment == 1)
  1681.                 l += dimension2.height + 3;
  1682.             else
  1683.                 i += dimension2.width + 5;
  1684.         }
  1685.         int i2 = 0;
  1686.         do
  1687.         {
  1688.             String s3 = i2 != 0 ? getLabel("rangeAxisLabel_2") : getLabel("rangeAxisLabel");
  1689.             if(s3 != null && super.rangeOn[i2])
  1690.             {
  1691.                 int k4 = i2 != 0 ? getLabelAngle("rangeAxisLabelAngle_2") : getLabelAngle("rangeAxisLabelAngle");
  1692.                 k4 = super.gridAlignment != 1 ? 0 : k4;
  1693.                 Font font3 = getFont("rangeAxisLabelFont");
  1694.                 FontMetrics fontmetrics3 = getFontMetrics(font3);
  1695.                 Dimension dimension7 = getLabelSize(s3, font3);
  1696.                 Dimension dimension10 = getAngledLabelSize(dimension7, k4);
  1697.                 if(super.gridAlignment == 1)
  1698.                 {
  1699.                     if(super.rangePosition[i2] == 0)
  1700.                         i += dimension10.width + 20;
  1701.                     else
  1702.                         j += dimension10.width + 20;
  1703.                 } else
  1704.                 if(super.rangePosition[i2] == 0)
  1705.                     l += (dimension10.height + 5) - (k4 % 360 != 0 ? 0 : fontmetrics3.getDescent());
  1706.                 else
  1707.                     k += dimension10.height + 5;
  1708.             }
  1709.         } while(++i2 < 2);
  1710.         if(is3DModeOn())
  1711.             if(super.depth3d >= 0)
  1712.             {
  1713.                 l += super.depth3d;
  1714.                 i += super.depth3d;
  1715.             } else
  1716.             {
  1717.                 int j2 = Math.max(1, getSampleCount());
  1718.                 if(barType == 0)
  1719.                     j2 *= Math.max(1, getSeriesCount());
  1720.                 if(super.gridAlignment == 1)
  1721.                 {
  1722.                     int j3 = 0;
  1723.                     if((double)j2 + barWidthFraction * 1.25D > 0.0D)
  1724.                         j3 = (int)(((double)rectangle.width * barWidthFraction * 1.25D) / ((double)j2 + barWidthFraction * 1.25D));
  1725.                     i += j3;
  1726.                     rectangle.width = dimension.width - i - j;
  1727.                     double d2 = 0.0D;
  1728.                     if(j2 > 0)
  1729.                         d2 = (double)(rectangle.width / j2) * barWidthFraction;
  1730.                     l += (int)Math.round(d2 / 1.25D);
  1731.                 } else
  1732.                 {
  1733.                     int k3 = 0;
  1734.                     if((double)(1.25F * (float)j2) + barWidthFraction * 0.75D > 0.0D)
  1735.                         k3 = (int)(((double)rectangle.height * barWidthFraction * 0.75D) / ((double)(1.25F * (float)j2) + barWidthFraction * 0.75D));
  1736.                     l += k3;
  1737.                     rectangle.height = dimension.height - k - l;
  1738.                     double d3 = (double)(rectangle.height / j2) * barWidthFraction;
  1739.                     i += (int)Math.round(d3 * 1.25D * 0.75D);
  1740.                 }
  1741.             }
  1742.         Insets insets = getGraphInsets();
  1743.         if(insets != null)
  1744.         {
  1745.             k = insets.top != -1 ? insets.top : k;
  1746.             i = insets.left != -1 ? insets.left : i;
  1747.             l = insets.bottom != -1 ? insets.bottom : l;
  1748.             j = insets.right != -1 ? insets.right : j;
  1749.         }
  1750.         rectangle.x = i;
  1751.         rectangle.width = dimension.width - i - j - 1;
  1752.         rectangle.y = k;
  1753.         rectangle.height = dimension.height - k - l - 1;
  1754.         super.currentBounds = rectangle;
  1755.         return rectangle;
  1756.     }
  1757.     public void setBarOutlineColor(Color color)
  1758.     {
  1759.         barOutlineColor = color;
  1760.         super.hasChanged = true;
  1761.         autoRepaint();
  1762.     }
  1763.     private void paintFloatingLabel(Graphics g, Rectangle rectangle, int i, int j, String s, Font font, FontMetrics fontmetrics)
  1764.     {
  1765.         if(i < 0 || i >= getSeriesCount() || j < 0 || j >= getSampleCount())
  1766.             return;
  1767.         Rectangle rectangle1 = barBounds[i][j];
  1768.         if(rectangle1 == null)
  1769.             return;
  1770.         if(super.gridAlignment == 1)
  1771.         {
  1772.             if(rectangle1.x + rectangle1.width < rectangle.x - super.depth3dPoint.x || rectangle1.x > rectangle.x + rectangle.width)
  1773.                 return;
  1774.             if(rectangle1.y + rectangle1.height < rectangle.y || rectangle1.y > (rectangle.y + rectangle.height) - super.depth3dPoint.y)
  1775.                 return;
  1776.         } else
  1777.         {
  1778.             if(rectangle1.y + rectangle1.height < rectangle.y || rectangle1.y > (rectangle.y + rectangle.height) - super.depth3dPoint.y)
  1779.                 return;
  1780.             if(rectangle1.x + rectangle1.width < rectangle.x - super.depth3dPoint.x || rectangle1.x > rectangle.x + rectangle.width)
  1781.                 return;
  1782.         }
  1783.         Dimension dimension = getLabelSize(s, font);
  1784.         int k = mousePosition.x + 3;
  1785.         if(super.gridAlignment == 1)
  1786.             k = ((rectangle1.x + rectangle1.width / 2) - dimension.width / 2) + 1;
  1787.         else
  1788.         if(mousePosition.x < 0)
  1789.             k = (rectangle1.x + rectangle1.width / 2) - dimension.width / 2;
  1790.         int l = (mousePosition.y - dimension.height) + fontmetrics.getAscent();
  1791.         if(super.gridAlignment == 0 || mousePosition.y < 0)
  1792.             l = ((rectangle1.y + rectangle1.height / 2) - dimension.height / 2) + fontmetrics.getAscent();
  1793.         if(barType == 1 && l - dimension.height / 2 < rectangle1.y)
  1794.             l = rectangle1.y + dimension.height / 2 + 1;
  1795.         else
  1796.         if(is3DModeOn() && super.depth3dPoint.y != 0 && super.gridAlignment == 1 && mousePosition.y < rectangle1.y && mousePosition.y >= 0)
  1797.         {
  1798.             k += (-super.depth3dPoint.x * (rectangle1.y - mousePosition.y)) / super.depth3dPoint.y;
  1799.             Rectangle rectangle2 = null;
  1800.             if(i < getSeriesCount() - 1)
  1801.                 rectangle2 = barBounds[i + 1][j];
  1802.             else
  1803.             if(j < getSampleCount() - 1)
  1804.                 rectangle2 = barBounds[0][j + 1];
  1805.             if(rectangle2 != null)
  1806.             {
  1807.                 int i1 = (-super.depth3dPoint.x * (rectangle2.y - mousePosition.y)) / super.depth3dPoint.y;
  1808.                 if(l >= rectangle2.y && k > rectangle2.x - 10)
  1809.                     k = rectangle2.x - 10;
  1810.                 else
  1811.                 if(l < rectangle2.y && k > (rectangle2.x + i1) - 10)
  1812.                     k = (rectangle2.x + i1) - 10;
  1813.             }
  1814.         }
  1815.         Dimension dimension1 = getSize();
  1816.         k = Math.max(k, 3);
  1817.         k = Math.min(k, dimension1.width - dimension.width - 3);
  1818.         l = Math.max(l, fontmetrics.getAscent() + 1);
  1819.         l = Math.min(l, ((dimension1.height - dimension.height) + fontmetrics.getAscent()) - 1);
  1820.         int j1 = fontmetrics.getHeight();
  1821.         int k1 = fontmetrics.getDescent();
  1822.         g.setColor(new Color(255, 255, 231));
  1823.         g.fillRect(k - 2, ((l - j1) + k1 * 2) - 2, dimension.width + 5, dimension.height);
  1824.         g.setColor(getChartForeground());
  1825.         if(getSeriesCount() == 1 && multiColorOn)
  1826.             g.setColor(getSampleColor(j).darker());
  1827.         else
  1828.         if(multiColorOn)
  1829.             g.setColor(getSampleColor(i).darker());
  1830.         g.drawRect(k - 3, ((l - j1) + k1 * 2) - 3, dimension.width + 5, dimension.height);
  1831.         g.setColor(Color.black);
  1832.         paintLabel(g, s, k, l, dimension, 0, 0);
  1833.     }
  1834.     public static final int SIDE_BY_SIDE_BARS = 0;
  1835.     public static final int STACKED_BARS = 1;
  1836.     public static final int VALUE_LABELS_OUTSIDE = 0;
  1837.     public static final int VALUE_LABELS_INSIDE = 1;
  1838.     public static final int VALUE_LABELS_FLOATING = 2;
  1839.     public static final int BAR_LABELS_BELOW = 0;
  1840.     public static final int BAR_LABELS_FLOATING = 1;
  1841.     public static final int BAR_LABELS_BELOW_AND_FLOATING = 2;
  1842.     private boolean multiColorOn;
  1843.     private int valueLabelStyle;
  1844.     private boolean barOutlineOn;
  1845.     private Color barOutlineColor;
  1846.     private boolean autoLabelSpacingOn;
  1847.     private double barWidthFraction;
  1848.     private int barType;
  1849.     private Rectangle barBounds[][];
  1850.     private int selectedSeries;
  1851.     private int selectedSample;
  1852.     private Point mousePosition;
  1853. }