📄 barchart.java
字号:
d2 = (double)rectangle1.width / (double)i;
else
d2 = (double)rectangle1.height / (double)i;
d5 = d2 * barWidthFraction;
if(barType == 0)
d5 /= j;
}
double d6 = d2 * (1.0D - barWidthFraction);
double d7 = 0.0D;
boolean flag = is3DModeOn();
if(super.gridAlignment == 1)
{
d7 = (double)rectangle1.x + d6 / 2D;
if(flag)
d7 -= super.depth3dPoint.x;
} else
{
d7 = (double)rectangle1.y + d6 / 2D;
if(flag)
d7 -= super.depth3dPoint.y;
}
if(super.gridAlignment == 1)
{
for(int k1 = 0; k1 < i; k1++)
{
for(int i2 = 0; i2 < j; i2++)
{
Rectangle rectangle2 = barBounds[i2][k1];
rectangle2.x = (int)Math.round(d7);
rectangle2.width = (int)Math.round(d7 + d5) - rectangle2.x;
boolean flag1 = barType == 1;
int k2 = flag1 ? 0 : getSeriesRange(i2);
double d8 = getSampleValue(i2, k1);
if(d8 >= 0.0D)
{
double d10 = 0.0D;
if(super.currentUpperRange[k2] != 0.0D)
d10 = (d8 / super.currentUpperRange[k2]) * (double)(super.zeroLine[k2] - rectangle1.y);
rectangle2.height = (int)Math.round(d10);
rectangle2.y = super.zeroLine[k2] - rectangle2.height;
rectangle2.height = Math.max(0, rectangle2.height);
if(flag1 && i2 > 0)
{
double d14 = 0.0D;
for(int i4 = 0; i4 < i2; i4++)
if(getSampleValue(i4, k1) >= 0.0D)
d14 += getSampleValue(i4, k1);
double d18 = 0.0D;
if(super.currentUpperRange[k2] != 0.0D)
d18 = (d14 / super.currentUpperRange[k2]) * (double)(super.zeroLine[k2] - rectangle1.y);
double d22 = (double)super.zeroLine[k2] - d18 - d10;
rectangle2.y = (int)Math.round(d22);
rectangle2.height = (int)Math.round((d10 + d22) - (double)Math.round(d22));
}
int i3 = rectangle2.y + rectangle2.height;
int k3 = rectangle1.y + rectangle1.height;
if(i3 > k3)
rectangle2.height -= i3 - k3;
} else
{
double d11 = 0.0D;
if(super.currentLowerRange[k2] != 0.0D)
d11 = (d8 / super.currentLowerRange[k2]) * (double)((rectangle1.y + rectangle1.height) - super.zeroLine[k2]);
rectangle2.height = (int)Math.round(d11);
rectangle2.y = super.zeroLine[k2];
if(flag1 && i2 > 0)
{
double d15 = 0.0D;
for(int j4 = 0; j4 < i2; j4++)
if(getSampleValue(j4, k1) < 0.0D)
d15 += getSampleValue(j4, k1);
double d19 = 0.0D;
if(super.currentLowerRange[k2] != 0.0D)
d19 = (d15 / super.currentLowerRange[k2]) * (double)((rectangle1.y + rectangle1.height) - super.zeroLine[k2]);
double d23 = (double)super.zeroLine[k2] + d19;
rectangle2.y = (int)Math.round(d23);
rectangle2.height = (int)Math.round((d11 + d23) - (double)Math.round(d23));
}
if(rectangle2.y < rectangle1.y)
{
rectangle2.height -= rectangle1.y - rectangle2.y;
rectangle2.y = rectangle1.y;
}
}
if(flag)
rectangle2.y -= super.depth3dPoint.y;
if(barType == 0 || i2 == j - 1)
d7 += d5;
}
d7 += d6;
}
} else
{
for(int l1 = 0; l1 < i; l1++)
{
for(int j2 = 0; j2 < j; j2++)
{
Rectangle rectangle3 = barBounds[j2][l1];
rectangle3.y = (int)Math.round(d7);
rectangle3.height = (int)Math.round(d7 + d5) - rectangle3.y;
boolean flag2 = barType == 1;
int l2 = flag2 ? 0 : getSeriesRange(j2);
double d9 = getSampleValue(j2, l1);
if(d9 >= 0.0D)
{
double d12 = 0.0D;
if(super.currentUpperRange[l2] != 0.0D)
d12 = (d9 / super.currentUpperRange[l2]) * (double)((rectangle1.x + rectangle1.width) - super.zeroLine[l2]);
rectangle3.width = (int)Math.round(d12);
rectangle3.x = super.zeroLine[l2];
if(barType == 1 && j2 > 0)
{
double d16 = 0.0D;
for(int k4 = 0; k4 < j2; k4++)
if(getSampleValue(k4, l1) >= 0.0D)
d16 += getSampleValue(k4, l1);
double d20 = 0.0D;
if(super.currentUpperRange[l2] != 0.0D)
d20 = (d16 / super.currentUpperRange[l2]) * (double)((rectangle1.x + rectangle1.width) - super.zeroLine[l2]);
double d24 = (double)super.zeroLine[l2] + d20;
rectangle3.x = (int)Math.round(d24);
rectangle3.width = (int)Math.round((d12 + d24) - (double)Math.round(d24));
}
if(rectangle3.x < rectangle1.x)
{
rectangle3.width -= rectangle1.x - rectangle3.x;
rectangle3.x = rectangle1.x;
}
} else
{
double d13 = 0.0D;
if(super.currentLowerRange[l2] != 0.0D)
d13 = (d9 / super.currentLowerRange[l2]) * (double)(super.zeroLine[l2] - rectangle1.x);
rectangle3.width = (int)Math.round(d13);
rectangle3.x = super.zeroLine[l2] - rectangle3.width;
if(barType == 1 && j2 > 0)
{
double d17 = 0.0D;
for(int l4 = 0; l4 < j2; l4++)
if(getSampleValue(l4, l1) < 0.0D)
d17 += getSampleValue(l4, l1);
double d21 = 0.0D;
if(super.currentLowerRange[l2] != 0.0D)
d21 = (d17 / super.currentLowerRange[l2]) * (double)(super.zeroLine[l2] - rectangle1.x);
double d25 = (double)super.zeroLine[l2] - d21 - d13;
rectangle3.x = (int)Math.round(d25);
rectangle3.width = (int)Math.round((d13 + d25) - (double)Math.round(d25));
}
int j3 = rectangle3.x + rectangle3.width;
int l3 = rectangle1.x + rectangle1.width;
if(j3 > l3)
rectangle3.width -= j3 - l3;
}
if(flag)
rectangle3.x -= super.depth3dPoint.x;
if(barType == 0 || j2 == j - 1)
d7 += d5;
}
d7 += d6;
}
}
}
private void paintBarLabels(Graphics g, Rectangle rectangle)
{
if(!super.sampleLabelsOn || super.barLabelStyle == 1)
return;
String as[] = getBarLabels();
if(as == null)
return;
Font font = getFont("barLabelFont");
g.setFont(font);
FontMetrics fontmetrics = g.getFontMetrics();
if(super.gridAlignment == 1)
{
int i = getLabelAngle("barLabelAngle");
int k = 0;
int i1 = Math.min(as.length, getSampleCount());
for(int k1 = 0; k1 < i1; k1++)
if(as[k1] != null)
{
Color color1 = getSampleLabelColor(k1);
if(color1 != null)
g.setColor(color1);
else
g.setColor(getForeground());
Dimension dimension1 = getLabelSize(as[k1], font);
Dimension dimension3 = getAngledLabelSize(dimension1, i);
int i2 = barBounds[0][k1].x;
int k2 = (barBounds[barBounds.length - 1][k1].x + barBounds[barBounds.length - 1][k1].width) - i2;
int i3 = i2 + k2 / 2;
if(i % 90 == 0)
i2 = i3 - dimension3.width / 2;
else
if(i % 180 > 90)
i2 = (i3 + k2 / 2) - dimension3.width;
else
i2 = i3 - k2 / 2;
int k3 = rectangle.x - 2 - (is3DModeOn() ? super.depth3dPoint.x : 0);
if(i3 >= k3 && i3 <= rectangle.x + rectangle.width + 2)
{
int i4 = rectangle.y + rectangle.height + 6;
if(i % 180 == 0)
i4 += fontmetrics.getMaxAscent() - 4;
if(is3DModeOn())
i4 -= super.depth3dPoint.y;
if(super.sampleScrollerOn)
i4 += 10;
if(isValueLabelsOn() && valueLabelStyle == 0 && super.lowerRange[0] < 0.0D)
{
int k4 = rectangle.y;
int l4 = super.zeroLine[0] - (is3DModeOn() ? super.depth3dPoint.y : 0);
for(int i5 = 0; i5 < barBounds.length; i5++)
{
int k5 = barBounds[i5][k1].y + barBounds[i5][k1].height;
if(k5 > k4 && k5 > l4)
k4 = k5;
}
i4 = Math.max(i4, k4 + fontmetrics.getMaxAscent() + 10);
k4 = (rectangle.y + rectangle.height) - (is3DModeOn() ? super.depth3dPoint.y : 0);
i4 = Math.min(i4, k4 + fontmetrics.getMaxAscent() + 10);
}
if(autoLabelSpacingOn)
{
if(as[k1] != null && as[k1].trim().length() > 0 && (i2 > k || k1 == 0))
{
paintLabel(g, as[k1], i2, i4, dimension1, 0, i);
k = i2 + dimension3.width;
}
} else
{
paintLabel(g, as[k1], i2, i4, dimension1, 0, i);
}
}
}
} else
{
int j = getLabelAngle("barLabelAngle");
int l = Math.min(as.length, getSampleCount());
for(int j1 = 0; j1 < l; j1++)
if(as[j1] != null)
{
Color color = getSampleLabelColor(j1);
if(color != null)
g.setColor(color);
else
g.setColor(getForeground());
Dimension dimension = getLabelSize(as[j1], font);
Dimension dimension2 = getAngledLabelSize(dimension, j);
int l1 = (barBounds[barBounds.length - 1][j1].y + barBounds[barBounds.length - 1][j1].height) - barBounds[0][j1].y;
int j2 = barBounds[0][j1].y + l1 / 2;
int l2 = j2 - dimension2.height / 2;
if(j % 180 == 0)
l2 += fontmetrics.getAscent() - 1;
else
if(j % 180 > 90)
l2 = j2 - l1 / 2;
else
l2 = (j2 + l1 / 2) - dimension2.height;
if(j % 180 != 0 || l2 >= rectangle.y - 2 && l2 <= (rectangle.y + rectangle.height) - (is3DModeOn() ? super.depth3dPoint.y : 0))
{
int j3 = rectangle.x - dimension2.width - 3;
if(is3DModeOn())
j3 -= super.depth3dPoint.x;
if(super.sampleScrollerOn)
j3 -= 10;
if(isValueLabelsOn() && valueLabelStyle == 0 && super.lowerRange[0] < 0.0D)
{
int l3 = rectangle.x + rectangle.width;
int j4 = 0;
double d = 0.0D;
for(int j5 = 0; j5 < barBounds.length; j5++)
if(getSampleValue(j5, j1) < 0.0D)
{
if(barType == 1)
d += getSampleValue(j5, j1);
else
d = getSampleValue(j5, j1);
if(barBounds[j5][j1].x < l3)
{
String s = getLabel("valueLabelPrefix");
String s1 = getLabel("valueLabelPostfix");
l3 = barBounds[j5][j1].x;
String s2 = formatNumber(d, getSampleDecimalCount(0));
s2 = s == null ? s2 : s + s2;
s2 = s1 == null ? s2 : s2 + s1;
j4 = fontmetrics.stringWidth(s2);
}
}
j3 = Math.min(j3, l3 - j4 - dimension2.width - 3);
l3 = rectangle.x - (is3DModeOn() ? super.depth3dPoint.x : 0);
j3 = Math.max(j3, l3 - j4 - dimension2.width - 3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -