📄 barchart.java
字号:
if(flag)
k4 = Math.max((k - super.depth3dPoint.y) + 2, k4);
else
k4 = Math.max(k + 2, k4);
}
if(k1 % 180 > 0 && k1 % 180 < 90)
j4 = rectangle1.x - 1;
else
if(k1 % 180 > 90)
j4 = ((rectangle1.x + rectangle1.width) - dimension2.width) + 1;
}
} else
{
if(d1 >= 0.0D)
{
j4 = rectangle1.x + rectangle1.width + 3;
j4 = Math.min(rectangle.x + rectangle.width + 3, j4);
j4 = Math.max(i1 + 3, j4);
} else
{
j4 = rectangle1.x - dimension.width - 3;
j4 = Math.max(i1 - dimension.width - 3, j4);
j4 = Math.min((i1 + rectangle.width) - dimension.width - 3, j4);
}
k4 = ((rectangle1.y + rectangle1.height / 2 + l1 / 2) - i2) + 1;
if(flag && j == 1 && d1 >= 0.0D)
{
k4 += super.depth3dPoint.y;
j4 += super.depth3dPoint.x;
j4 = Math.min(rectangle.x + rectangle.width + 3, j4);
}
}
} else
if(super.gridAlignment == 1)
{
j4 = ((rectangle1.x + rectangle1.width / 2) - dimension2.width / 2) + 1;
if(d1 >= 0.0D)
{
if(k1 % 180 == 0)
{
k4 = rectangle1.y + fontmetrics.getAscent();
k4 = Math.max(k4, (rectangle.y + dimension2.height) - 1);
k4 = Math.min(k4, (rectangle.y + rectangle.height) - 2);
} else
{
k4 = rectangle1.y + 3;
k4 = Math.min(k4, (rectangle1.y + rectangle1.height) - dimension2.height - 2);
k4 = Math.max(k4, rectangle.y + 3);
}
} else
if(k1 % 180 == 0)
{
k4 = (rectangle1.y + rectangle1.height) - 2;
k4 = Math.min(k4, (rectangle.y + rectangle.height) - 2 - (flag ? super.depth3dPoint.y : 0));
k4 = Math.max(k4, (rectangle.y + dimension2.height) - 1);
} else
{
k4 = (rectangle1.y + rectangle1.height) - dimension2.height - 2;
k4 = Math.min(k4, (rectangle.y + rectangle.height) - dimension2.height - 2 - (flag ? super.depth3dPoint.y : 0));
k4 = Math.max(k4, (rectangle.y + 3) - (flag ? super.depth3dPoint.y : 0));
}
if(barType == 1 && j > 1)
flag2 = dimension2.height < rectangle1.height;
} else
{
k4 = ((rectangle1.y + rectangle1.height / 2 + l1 / 2) - i2) + 1;
if(d1 >= 0.0D)
{
j4 = (rectangle1.x + rectangle1.width) - dimension.width - 1;
j4 = Math.max(j4, rectangle1.x + 2);
j4 = Math.min(j4, (rectangle.x + rectangle.width) - dimension.width - 1);
} else
{
j4 = rectangle1.x + 2;
j4 = Math.max(j4, (rectangle.x + 2) - (flag ? super.depth3dPoint.x : 0));
j4 = Math.min(j4, (rectangle.x + rectangle.width) - dimension.width - 1 - (flag ? super.depth3dPoint.x : 0));
}
if(barType == 1 && j > 1)
flag2 = dimension2.width < rectangle1.width;
}
Object obj = null;
if(valueLabelStyle == 0)
{
g.setColor(getForeground());
Color color = getChartBackground();
} else
{
Color color2 = getSampleColor(0);
if(multiColorOn)
if(j > 1 || barType == 1 || super.multiSeriesOn)
color2 = getSampleColor(i3);
else
color2 = getSampleColor(l2);
if((color2.getRed() + color2.getGreen() + color2.getBlue()) / 3 > 110)
g.setColor(Color.black);
else
g.setColor(Color.white);
Color color1 = color2;
}
if(super.gridAlignment == 1)
{
if(j4 + dimension2.width / 2 < i1 - 3 || j4 + dimension2.width / 2 > j1 + 3)
flag2 = false;
} else
if(k4 - l1 / 2 < k - 3 || k4 - l1 / 2 > l)
flag2 = false;
if(flag2)
paintLabel(g, s4, j4, k4, dimension, 0, super.gridAlignment != 1 ? 0 : k1);
}
}
}
}
}
public void setBarWidth(double d)
{
d = Math.max(0.0D, d);
d = Math.min(1.0D, d);
barWidthFraction = d;
super.hasChanged = true;
autoRepaint();
}
public double getBarWidth()
{
return barWidthFraction;
}
public void setBarLabelStyle(int i)
{
switch(i)
{
case 0: // '\0'
case 1: // '\001'
case 2: // '\002'
super.barLabelStyle = i;
super.hasChanged = true;
autoRepaint();
break;
default:
throw new IllegalArgumentException("Invalid barLabelStyle: " + i);
}
}
public int getBarLabelStyle()
{
return super.barLabelStyle;
}
public void render(Graphics g)
{
render(g, !isServletModeOn());
}
void render(Graphics g, boolean flag)
{
Rectangle rectangle = getGraphBounds();
Rectangle rectangle1 = getDataBounds(rectangle);
calculateChartData(rectangle, rectangle1);
for(int i = 0; i < super.overlayCharts.size(); i++)
{
Chart chart = (Chart)super.overlayCharts.elementAt(i);
if(chart != null && isOverlayChartOn(i))
{
Rectangle rectangle2 = new Rectangle(rectangle);
Rectangle rectangle3 = new Rectangle(rectangle1);
if(is3DModeOn())
{
rectangle2.x -= super.depth3dPoint.x;
rectangle2.y -= super.depth3dPoint.y;
rectangle3.x -= super.depth3dPoint.x;
rectangle3.y -= super.depth3dPoint.y;
}
chart.calculateChartData(rectangle2, rectangle3);
}
}
Dimension dimension = getSize();
if(flag && super.offscreen == null)
{
super.offscreen = createImage(Math.max(1, dimension.width), Math.max(1, dimension.height));
super.hasChanged = true;
}
if(!flag || super.hasChanged || super.offscreen == null)
{
if(!super.externalGraphicsOn && !flag)
super.og = g;
else
if(flag || super.externalGraphicsOn)
{
if(!super.externalGraphicsOn && super.offscreen != null)
super.og = super.offscreen.getGraphics();
super.og.setColor(getBackground());
super.og.fillRect(0, 0, dimension.width, dimension.height);
}
paintTitle(super.og, dimension);
if(isLegendOn())
paintLegend(super.og, rectangle, getLegendLabels());
paintGrid(super.og, rectangle);
paintBarLabels(super.og, rectangle);
if(super.upperRange != super.lowerRange)
{
renderData(super.og, rectangle, rectangle1);
for(int j = 0; j < super.overlayCharts.size(); j++)
{
Chart chart1 = (Chart)super.overlayCharts.elementAt(j);
if(chart1 != null && isOverlayChartOn(j))
{
Rectangle rectangle4 = new Rectangle(rectangle);
Rectangle rectangle5 = new Rectangle(rectangle1);
rectangle4.x -= super.depth3dPoint.x;
rectangle4.y -= super.depth3dPoint.y;
rectangle5.x -= super.depth3dPoint.x;
rectangle5.y -= super.depth3dPoint.y;
if(chart1 instanceof LineChart)
chart1.renderData(super.og, rectangle4, getLineChartBounds(rectangle5));
else
if(chart1 instanceof PieChart)
chart1.renderData(super.og, rectangle4, rectangle5);
else
chart1.renderData(super.og, rectangle, rectangle1);
}
}
}
if(!super.externalGraphicsOn && super.og != g)
super.og.dispose();
super.hasChanged = false;
}
if((flag || super.externalGraphicsOn) && super.offscreen != null)
g.drawImage(super.offscreen, 0, 0, this);
paintFloatingLabels(g, rectangle);
}
private void paint3DBar(Graphics g, Rectangle rectangle, boolean flag, double d)
{
Polygon polygon = new Polygon();
polygon.addPoint(rectangle.x, rectangle.y);
polygon.addPoint(polygon.xpoints[0] + super.depth3dPoint.x, polygon.ypoints[0] + super.depth3dPoint.y);
polygon.addPoint(polygon.xpoints[1] + rectangle.width, polygon.ypoints[1]);
polygon.addPoint(rectangle.x + rectangle.width, rectangle.y);
Polygon polygon1 = new Polygon();
polygon1.addPoint(rectangle.x + rectangle.width, rectangle.y);
polygon1.addPoint(polygon.xpoints[2], polygon.ypoints[2]);
polygon1.addPoint(polygon.xpoints[2], polygon.ypoints[2] + rectangle.height);
polygon1.addPoint(rectangle.x + rectangle.width, rectangle.y + rectangle.height);
g.setColor(g.getColor().darker());
g.fillPolygon(polygon);
g.setColor(g.getColor().darker());
g.fillPolygon(polygon1);
if(barOutlineOn)
{
if(barOutlineColor != null)
g.setColor(barOutlineColor);
else
g.setColor(getChartForeground());
g.drawPolygon(polygon);
g.drawPolygon(polygon1);
if(flag)
{
g.drawLine(polygon1.xpoints[1] - 1, polygon1.ypoints[1] + 1, polygon1.xpoints[2] - 1, polygon1.ypoints[2]);
g.drawLine(polygon.xpoints[1], polygon.ypoints[1] + 1, polygon.xpoints[2] - 1, polygon.ypoints[2] + 1);
if(super.gridAlignment == 1)
{
g.drawLine(polygon1.xpoints[2] - 1, polygon1.ypoints[2], polygon1.xpoints[3] - 1, polygon1.ypoints[3]);
g.drawLine(polygon.xpoints[0] + 1, polygon.ypoints[0], polygon.xpoints[1] + 1, polygon.ypoints[1]);
if(rectangle.height != 0)
g.drawLine(polygon1.xpoints[0], polygon1.ypoints[0] + 1, polygon1.xpoints[1], polygon1.ypoints[1] + 1);
else
g.drawLine(polygon.xpoints[3] - 1, polygon.ypoints[3] - 1, polygon.xpoints[0] + 1, polygon.ypoints[0] - 1);
} else
{
g.drawLine(polygon1.xpoints[2], polygon1.ypoints[2] - 1, polygon1.xpoints[3], polygon1.ypoints[3] - 1);
g.drawLine(polygon.xpoints[0], polygon.ypoints[0] + 1, polygon.xpoints[1], polygon.ypoints[1] + 1);
if(rectangle.width != 0)
g.drawLine(polygon.xpoints[2] - 1, polygon.ypoints[2], polygon.xpoints[3] - 1, polygon.ypoints[3]);
else
g.drawLine(polygon1.xpoints[3] + 1, polygon1.ypoints[3] - 1, polygon1.xpoints[0] + 1, polygon1.ypoints[0] + 1);
}
}
} else
if(flag)
{
if(barOutlineColor != null)
g.setColor(barOutlineColor);
else
g.setColor(getChartForeground());
g.drawPolygon(polygon);
g.drawLine(polygon1.xpoints[1], polygon1.ypoints[1], polygon1.xpoints[2], polygon1.ypoints[2]);
if(super.gridAlignment == 1)
{
g.drawLine(polygon1.xpoints[2], polygon1.ypoints[2], polygon1.xpoints[3], polygon1.ypoints[3]);
} else
{
g.drawLine(polygon1.xpoints[2], polygon1.ypoints[2] - 1, polygon1.xpoints[3], polygon1.ypoints[3] - 1);
g.drawLine(polygon1.xpoints[3] - 1, polygon1.ypoints[3] - 1, polygon1.xpoints[0] - 1, polygon1.ypoints[0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -