LineChart.java
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:59k
源码类别:
OA系统
开发平台:
Java
- // Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2002-12-03 18:42:54
- // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
- // Decompiler options: packimports(3)
- // Source File Name: LineChart.java
- package cn.com.fcsoft.chart;
- import java.awt.*;
- import java.awt.event.MouseEvent;
- import java.io.PrintStream;
- import java.util.*;
- // Referenced classes of package com.objectplanet.chart:
- // Chart, ChartSample, PieChart
- public class LineChart extends Chart
- {
- public void setSampleHighlightStyle(int i, int j, int k)
- {
- sampleHighlightSize[i] = Math.max(0, k);
- sampleHighlightStyle[i] = j;
- super.hasChanged = true;
- autoRepaint();
- }
- public int getSampleHighlightStyle(int i)
- {
- try
- {
- return sampleHighlightStyle[i];
- }
- catch(IndexOutOfBoundsException _ex)
- {
- throw new IllegalArgumentException("Invalid series: " + i);
- }
- }
- public boolean isSampleLabelsOn()
- {
- return super.sampleLabelsOn;
- }
- public void setAutoLabelSpacingOn(boolean flag)
- {
- autoLabelSpacingOn = flag;
- super.hasChanged = true;
- autoRepaint();
- }
- public void setStackedOn(boolean flag)
- {
- stackedOn = flag;
- super.hasChanged = true;
- autoRepaint();
- }
- public void setConnectedLinesOn(int i, boolean flag)
- {
- if(i >= 0 && i < connectedLinesOn.length)
- connectedLinesOn[i] = flag;
- else
- if(i == -1)
- {
- for(int j = 0; j < connectedLinesOn.length; j++)
- connectedLinesOn[j] = flag;
- }
- super.hasChanged = true;
- autoRepaint();
- }
- protected void processEvent(AWTEvent awtevent)
- {
- switch(awtevent.getID())
- {
- case 504:
- default:
- break;
- case 505:
- selectedSample = -1;
- selectedSeries = -1;
- repaint();
- break;
- case 503:
- case 506:
- MouseEvent mouseevent = (MouseEvent)awtevent;
- boolean flag = isValueLabelsOn() && valueLabelStyle == 2;
- flag |= super.sampleLabelsOn && sampleLabelStyle == 2;
- flag |= seriesLabelsOn;
- if(!flag)
- break;
- mousePosition.x = mouseevent.getX();
- mousePosition.y = mouseevent.getY();
- ChartSample chartsample = super.checkSelection(mousePosition);
- if(chartsample != null)
- {
- mousePosition.x = -1;
- mousePosition.y = -1;
- } else
- {
- chartsample = checkSelection(mousePosition);
- }
- if(chartsample != null)
- {
- if(chartsample.getIndex() != selectedSample || chartsample.getSeries() != selectedSeries)
- {
- selectedSample = chartsample.getIndex();
- selectedSeries = chartsample.getSeries();
- repaint();
- }
- break;
- }
- boolean flag1 = selectedSample != -1 || selectedSeries != -1;
- selectedSample = -1;
- selectedSeries = -1;
- if(flag1)
- repaint();
- break;
- }
- super.processEvent(awtevent);
- }
- public String[] getLegendLabels()
- {
- if(super.legendLabels != null)
- return super.legendLabels;
- else
- return getSeriesLabels();
- }
- private void paintSampleLabels(Graphics g, Rectangle rectangle, Rectangle rectangle1)
- {
- String as[] = getSampleLabels();
- if(as == null)
- return;
- Font font = getFont("sampleLabelFont");
- g.setFont(font);
- FontMetrics fontmetrics = g.getFontMetrics();
- int i = getSampleCount();
- double d = rectangle1.width;
- if(i > 1)
- d = (float)rectangle1.width / (float)(i - 1);
- int j = rectangle1.y + rectangle1.height;
- double d1 = rectangle1.x;
- int k = rectangle.x;
- int l = rectangle.x + rectangle.width;
- if(is3DModeOn())
- {
- j -= super.depth3dPoint.y;
- d1 -= super.depth3dPoint.x;
- k -= super.depth3dPoint.x;
- l -= super.depth3dPoint.x;
- }
- if(super.sampleScrollerOn)
- j += 10;
- Color color = getChartForeground();
- int i1 = getLabelAngle("sampleLabelAngle");
- double d2 = 0.0D;
- for(int j1 = 0; j1 < as.length; j1++)
- {
- if(as[j1] != null && as[j1].length() > 0 && d1 >= (double)k && d1 <= (double)(l + 1))
- {
- Color color1 = getSampleLabelColor(j1);
- if(color1 == null)
- color1 = getForeground();
- String s = as[j1];
- Dimension dimension = getLabelSize(s, font);
- Dimension dimension1 = getAngledLabelSize(dimension, i1);
- int k1 = j + 8;
- if(i1 % 180 == 0)
- k1 += fontmetrics.getMaxAscent() - 4;
- double d3 = 0.0D;
- if(i1 % 180 == 0)
- d3 = d1 - (double)(dimension1.width / 2);
- else
- if(i1 % 360 > 90 && i1 % 360 < 180 || i1 % 360 > 270)
- d3 = (d1 - (double)dimension1.width) + (double)(fontmetrics.getAscent() / 2);
- else
- d3 = d1 - (double)(fontmetrics.getAscent() / 2);
- g.setColor(color);
- if(autoLabelSpacingOn)
- {
- if(s != null && s.trim().length() > 0 && (d3 > d2 || j1 == 0))
- {
- g.drawLine((int)Math.round(d1), j, (int)Math.round(d1), j + 3);
- g.setColor(color1);
- paintLabel(g, s, (int)Math.round(d3), k1, dimension, 0, i1);
- d2 = d3 + (double)dimension1.width;
- }
- } else
- if(s != null && s.trim().length() > 0)
- {
- g.drawLine((int)Math.round(d1), j, (int)Math.round(d1), j + 3);
- g.setColor(color1);
- paintLabel(g, s, (int)Math.round(d3), k1, dimension, 0, i1);
- }
- }
- d1 += d;
- }
- }
- public void setSampleLabelStyle(int i)
- {
- sampleLabelStyle = i;
- super.hasChanged = true;
- autoRepaint();
- }
- public int getSampleLabelStyle()
- {
- return sampleLabelStyle;
- }
- public void setSeriesLineOn(boolean flag)
- {
- for(int i = 0; i < seriesLinesOn.length; i++)
- seriesLinesOn[i] = flag;
- super.hasChanged = true;
- autoRepaint();
- }
- public void setSeriesLineOn(int i, boolean flag)
- {
- seriesLinesOn[i] = flag;
- super.hasChanged = true;
- autoRepaint();
- }
- private void paintSampleHighlight(Graphics g, int i, int j, int k, Color color)
- {
- java.awt.Shape shape = g.getClip();
- g.setClip(0, 0, 32767, 32767);
- String s = getLegendImage(i);
- Dimension dimension = getImageSize(s);
- if(s != null && dimension.width > 0 && dimension.height > 0)
- {
- Image image = (Image)super.images.get(s);
- if(image != null)
- g.drawImage(image, j - dimension.width / 2, k - dimension.height / 2, this);
- } else
- {
- int l = 6;
- if(i >= 0 && i < sampleHighlightSize.length)
- l = sampleHighlightSize[i];
- int i1 = 0;
- if(i >= 0 && i < sampleHighlightStyle.length)
- i1 = sampleHighlightStyle[i];
- Color color1 = getChartBackground();
- g.setColor(color);
- switch(i1)
- {
- default:
- break;
- case 0: // ' '
- g.drawOval(j - l / 2, k - l / 2, l, l);
- break;
- case 2: // ' 02'
- g.fillOval(j - l / 2, k - l / 2, l + 1, l + 1);
- break;
- case 1: // ' 01'
- g.setColor(color1);
- g.fillOval(j - l / 2, k - l / 2, l + 1, l + 1);
- g.setColor(color);
- g.drawOval(j - l / 2, k - l / 2, l, l);
- break;
- case 3: // ' 03'
- g.drawRect(j - l / 2, k - l / 2, l, l);
- break;
- case 5: // ' 05'
- g.fillRect(j - l / 2, k - l / 2, l + 1, l + 1);
- break;
- case 4: // ' 04'
- g.setColor(color1);
- g.fillRect(j - l / 2, k - l / 2, l + 1, l + 1);
- g.setColor(color);
- g.drawRect(j - l / 2, k - l / 2, l, l);
- break;
- case 6: // ' 06'
- case 7: // ' 07'
- case 8: // 'b'
- int ai[] = new int[4];
- ai[0] = ai[2] = j;
- ai[1] = j + l / 2;
- ai[3] = j - l / 2;
- int ai1[] = new int[4];
- ai1[0] = k - l / 2;
- ai1[2] = k + l / 2;
- ai1[1] = ai1[3] = k;
- if(i1 == 7)
- {
- g.setColor(color1);
- g.fillPolygon(ai, ai1, 4);
- } else
- if(i1 == 8)
- {
- g.setColor(color);
- g.fillPolygon(ai, ai1, 4);
- }
- g.setColor(color);
- g.drawPolygon(ai, ai1, 4);
- break;
- }
- }
- g.setClip(shape);
- }
- double getHighestValue(int i)
- {
- if(stackedOn)
- return getMaxValue(-2);
- else
- return super.getHighestValue(i);
- }
- public double getMaxValue(int i)
- {
- if(i >= -1 || !stackedOn)
- return super.getMaxValue(i);
- double d = 0.0D;
- int j = getSampleCount();
- int k = getSeriesCount();
- for(int l = 0; l < j; l++)
- {
- double d1 = 0.0D;
- for(int i1 = 0; i1 < k; i1++)
- {
- ChartSample chartsample = getSample(i1, l);
- if(chartsample != null && chartsample.value != null && !chartsample.value.isNaN() && chartsample.value.doubleValue() > 0.0D)
- d1 += chartsample.value.doubleValue();
- }
- d = Math.max(d, d1);
- }
- return d;
- }
- protected void calculateChartData(Rectangle rectangle, Rectangle rectangle1)
- {
- calculateZeroLines(rectangle);
- if(is3DModeOn())
- if(super.depth3d > -1)
- {
- super.depth3dPoint.x = super.depth3d;
- super.depth3dPoint.y = -super.depth3d;
- } else
- {
- int i = Math.max(getSampleCount(), 20);
- int j = getSeriesCount();
- if(j > 1 && !stackedOn)
- {
- i /= j;
- i = Math.max(i, 4);
- }
- double d = (double)rectangle.width / (double)i;
- super.depth3dPoint.x = (int)Math.round(d * 1.25D);
- super.depth3dPoint.y = (int)Math.round(-d / 1.25D);
- }
- }
- private void paintFloatingLabels(Graphics g, Rectangle rectangle)
- {
- boolean flag = isValueLabelsOn(-1) && valueLabelStyle == 2;
- flag |= super.sampleLabelsOn && sampleLabelStyle == 2;
- flag |= seriesLabelsOn;
- if(flag)
- {
- Font font = getFont("floatingLabelFont");
- g.setFont(font);
- FontMetrics fontmetrics = g.getFontMetrics();
- if(selectedSample >= 0 && selectedSeries >= 0)
- {
- ChartSample chartsample = getSample(selectedSeries, selectedSample);
- if(chartsample != null && chartsample.value != null && !chartsample.value.isNaN())
- {
- String s = constructFloatingLabel(selectedSeries, selectedSample, seriesLabelsOn);
- paintFloatingLabel(g, rectangle, selectedSeries, selectedSample, s, font, fontmetrics);
- }
- } else
- if(selectedSeries >= 0 && isFloatingOnLegendOn())
- {
- int i = getSampleCount();
- for(int j = 0; j < i; j++)
- {
- ChartSample chartsample1 = getSample(selectedSeries, j);
- if(chartsample1 != null && chartsample1.value != null && !chartsample1.value.isNaN())
- {
- String s1 = constructFloatingLabel(selectedSeries, j, false);
- paintFloatingLabel(g, rectangle, selectedSeries, j, s1, font, fontmetrics);
- }
- }
- }
- }
- }
- public boolean isSeriesLineOn(int i)
- {
- return seriesLinesOn[i];
- }
- public void setSampleLabelsOn(boolean flag)
- {
- super.sampleLabelsOn = flag;
- super.hasChanged = true;
- autoRepaint();
- }
- public boolean isSeriesLabelsOn()
- {
- return seriesLabelsOn;
- }
- /**
- * @deprecated Method setLineWidth is deprecated
- */
- public void setLineWidth(int i)
- {
- setLineWidth(-1, i);
- }
- public void setLineWidth(int i, int j)
- {
- if(i >= 0 && i < lineWidth.length)
- lineWidth[i] = j;
- else
- if(i < 0)
- {
- for(int k = 0; k < lineWidth.length; k++)
- lineWidth[k] = j;
- }
- super.hasChanged = true;
- autoRepaint();
- }
- /**
- * @deprecated Method getLineWidth is deprecated
- */
- public int getLineWidth()
- {
- return getLineWidth(0);
- }
- public int getLineWidth(int i)
- {
- if(i >= 0 && i < lineWidth.length)
- return lineWidth[i];
- else
- return lineWidth[0];
- }
- public void setValueLabelStyle(int i)
- {
- valueLabelStyle = i;
- super.hasChanged = true;
- autoRepaint();
- }
- public int getValueLabelStyle()
- {
- return valueLabelStyle;
- }
- public boolean isSampleHighlightOn(int i, int j)
- {
- try
- {
- return sampleHighlightOn[i][j];
- }
- catch(IndexOutOfBoundsException _ex)
- {
- throw new IllegalArgumentException("Invalid series or index: " + i + ", " + j);
- }
- }
- public ChartSample checkSelection(Point point)
- {
- if(point == null)
- return null;
- ChartSample chartsample = null;
- getSeriesCount();
- if(isLegendOn() && super.legendBounds != null)
- {
- for(int i = 0; i < super.legendBounds.length; i++)
- {
- if(super.legendBounds[i] == null || !super.legendBounds[i].contains(point))
- continue;
- chartsample = new ChartSample(-1);
- chartsample.setSeries(i);
- break;
- }
- }
- if(chartsample == null && samplePosition != null)
- {
- byte byte0 = 3;
- for(int j = 0; j < samplePosition.length; j++)
- {
- Point apoint[] = samplePosition[j];
- if(apoint != null)
- {
- for(int k = 0; k < apoint.length; k++)
- if(apoint[k] != null)
- {
- Point point1 = new Point(apoint[k]);
- if(is3DModeOn())
- {
- point1.x -= super.depth3dPoint.x;
- if(!stackedOn)
- {
- double d = (double)super.depth3dPoint.x / (double)getSeriesCount();
- int l = (int)Math.round(d * (double)j);
- point1.x += l;
- }
- }
- boolean flag = point.x >= point1.x - byte0 && point.x <= point1.x + byte0;
- flag &= point.y >= point1.y - byte0 && point.y <= point1.y + byte0;
- if(flag)
- return getSample(j, k);
- }
- }
- }
- }
- return chartsample;
- }
- protected void renderData(Graphics g, Rectangle rectangle, Rectangle rectangle1)
- {
- paintLines(g, rectangle, rectangle1);
- }
- public void reset()
- {
- super.reset();
- valueLabelStyle = 0;
- autoLabelSpacingOn = false;
- super.multiSeriesOn = true;
- selectedSample = -1;
- selectedSeries = -1;
- super.hasChanged = true;
- }
- public void setSampleColors(Color acolor[])
- {
- super.setSampleColors(acolor);
- if(acolor == null)
- setSampleColor(2, new Color(132, 255, 198));
- super.hasChanged = true;
- autoRepaint();
- }
- public LineChart()
- {
- this(1, 5, 100D);
- }
- public LineChart(int i, int j, double d)
- {
- this(i, j, d, 0.0D);
- }
- public LineChart(int i, int j, double d, double d1)
- {
- super(j);
- super.chartType = "line";
- super.multiSeriesOn = true;
- sampleHighlightOn = new boolean[i][j];
- sampleHighlightStyle = new int[i];
- sampleHighlightSize = new int[i];
- seriesLinesOn = new boolean[i];
- lineWidth = new int[i];
- for(int k = 0; k < sampleHighlightSize.length; k++)
- {
- sampleHighlightSize[k] = 6;
- seriesLinesOn[k] = true;
- lineWidth[k] = 2;
- }
- connectedLinesOn = new boolean[i];
- samplePosition = new Point[i][j];
- for(int l = 0; l < samplePosition.length; l++)
- {
- for(int i1 = 0; i1 < samplePosition[l].length; i1++)
- samplePosition[l][i1] = new Point();
- }
- mousePosition = new Point();
- setAutomaticRepaintOn(false);
- setSeriesCount(i);
- setRange(0, d);
- setLowerRange(0, d1);
- setSampleColors(null);
- setAutomaticRepaintOn(true);
- selectedSample = -1;
- selectedSeries = -1;
- lastSelectedLine = -1;
- }
- private void paintLine(Graphics g, int i, Rectangle rectangle, Rectangle rectangle1, Color color, boolean flag)
- {
- int j = getSeriesCount();
- if(i < 0 || i >= j)
- throw new IllegalArgumentException("Invalid series: " + i);
- if(flag)
- lastSelectedLine = i;
- ChartSample achartsample[] = getSamples(i);
- if(achartsample == null || achartsample.length == 0)
- return;
- double d = rectangle1.width;
- if(achartsample.length - 1 > 0)
- d = (double)(rectangle1.width - 1) / (double)(achartsample.length - 1);
- Color color1 = !stackedOn && !flag ? color : color.darker();
- boolean flag1 = is3DModeOn();
- Graphics g1 = g;
- if(flag1)
- g1.setClip((rectangle.x - super.depth3dPoint.x) + 1, rectangle.y + 1, (rectangle.width + super.depth3dPoint.x) - 1, rectangle.height - super.depth3dPoint.y - 1);
- else
- g1.setClip(rectangle.x + 1, rectangle.y, rectangle.width - 1, rectangle.height + 1);
- double d1 = rectangle1.x + 1;
- int ai[] = new int[4];
- int ai1[] = new int[4];
- boolean flag2 = false;
- double d2 = d1;
- double d3 = calculateYPos(i, 0, rectangle1);
- for(int k = 0; k < achartsample.length - 1; k++)
- {
- boolean flag3 = achartsample[k] != null && achartsample[k].value != null && !achartsample[k].value.isNaN();
- boolean flag4 = achartsample[k + 1] != null && achartsample[k + 1].value != null && !achartsample[k + 1].value.isNaN();
- if(flag3)
- {
- d2 = d1;
- d3 = calculateYPos(i, k, rectangle1);
- flag2 = true;
- }
- boolean flag5 = flag3 && flag4;
- flag5 |= flag4 && connectedLinesOn[i];
- if(flag5 && flag2)
- {
- if(connectedLinesOn[i])
- {
- ai[0] = (int)d2;
- ai1[0] = (int)d3;
- } else
- {
- ai[0] = (int)d1;
- ai1[0] = calculateYPos(i, k, rectangle1);
- }
- ai[1] = (int)(d1 + d);
- ai1[1] = calculateYPos(i, k + 1, rectangle1);
- if(flag1)
- {
- ai[0] -= super.depth3dPoint.x;
- ai[1] -= super.depth3dPoint.x;
- ai[2] -= super.depth3dPoint.x;
- ai[3] -= super.depth3dPoint.x;
- if(!stackedOn)
- {
- double d4 = (double)super.depth3dPoint.x / (double)j;
- int i2 = (int)Math.round(d4 * (double)i);
- ai[0] += i2;
- ai[1] += i2;
- ai[2] += i2;
- ai[3] += i2;
- }
- }
- if(stackedOn)
- {
- ai[2] = ai[1];
- ai1[2] = calculateYPos(i - 1, k + 1, rectangle1);
- ai[3] = ai[0];
- ai1[3] = calculateYPos(i - 1, k, rectangle1);
- }
- boolean flag7 = false;
- int l1 = rectangle.x - (flag1 ? super.depth3dPoint.x * 2 : 0);
- int j2 = rectangle.x + rectangle.width;
- flag7 |= ai[0] >= l1 && ai[0] <= j2;
- flag7 |= ai[1] >= l1 && ai[1] <= j2;
- flag7 |= ai[0] <= l1 && ai[1] >= j2;
- if(flag7)
- {
- ai[0] = Math.max(ai[0], -10000);
- ai[1] = Math.max(ai[1], -10000);
- ai[0] = Math.min(ai[0], 11000);
- ai[1] = Math.min(ai[1], 11000);
- ai1[0] = Math.max(ai1[0], -10000);
- ai1[1] = Math.max(ai1[1], -10000);
- ai1[0] = Math.min(ai1[0], 11000);
- ai1[1] = Math.min(ai1[1], 11000);
- if(seriesLinesOn[i])
- if(flag1 && stackedOn)
- {
- boolean flag8 = i == j - 1;
- boolean flag9 = k == achartsample.length - 2;
- if(k < achartsample.length - 2)
- {
- flag9 |= achartsample[k + 2] == null || achartsample[k + 2].value == null || achartsample[k + 2].value.isNaN();
- flag9 &= !connectedLinesOn[i];
- }
- paint3DLine(g1, ai[0], ai1[0], ai[1], ai1[1], ai1[2], color1, flag8, flag9);
- } else
- if(flag1)
- paint3DLine(g1, ai[0], ai1[0], ai[1], ai1[1], ai1[2], color1, true, false);
- if(stackedOn && seriesLinesOn[i])
- {
- g1.setColor(flag ? color.darker() : color);
- g1.fillPolygon(ai, ai1, 4);
- g1.setColor(color.darker());
- g1.drawLine(ai[1], ai1[1], ai[2], ai1[2]);
- }
- g1.setColor(color);
- if(flag1 && stackedOn)
- g1.setColor(color.darker().darker());
- else
- if(flag1 || stackedOn)
- g1.setColor(color.darker());
- if(seriesLinesOn[i] || flag)
- {
- g1.drawLine(ai[0], ai1[0], ai[1], ai1[1]);
- if(!flag1 && !stackedOn && lineWidth[i] > 1 && (seriesLinesOn[i] || flag))
- {
- double d5 = 0.0D;
- if(ai[1] - ai[0] != 0)
- d5 = Math.abs((double)(ai1[1] - ai1[0]) / (double)(ai[1] - ai[0]));
- int k2 = 1;
- for(int i3 = 2; i3 <= lineWidth[i]; i3++)
- {
- int j3 = (i3 / 2) * k2;
- if(d5 <= 1.0D)
- g1.drawLine(ai[0], ai1[0] + j3, ai[1], ai1[1] + j3);
- else
- g1.drawLine(ai[0] - j3, ai1[0], ai[1] - j3, ai1[1]);
- k2 = -k2;
- }
- }
- }
- if(flag && seriesLinesOn[i] && !flag1 && !stackedOn)
- {
- double d6 = 0.0D;
- if(ai[1] - ai[0] != 0)
- d6 = Math.abs((double)(ai1[1] - ai1[0]) / (double)(ai[1] - ai[0]));
- int l2 = lineWidth[i] / 2 + 1;
- g1.setColor(color.darker().darker());
- if(d6 <= 1.0D)
- g1.drawLine(ai[0], ai1[0] + l2, ai[1], ai1[1] + l2);
- else
- g1.drawLine(ai[0] - l2, ai1[0], ai[1] - l2, ai1[1]);
- }
- }
- }
- d1 += d;
- }
- if(!flag1)
- {
- d1 = rectangle1.x + 1;
- for(int l = 0; l < achartsample.length; l++)
- {
- ChartSample chartsample = achartsample[l];
- if(chartsample != null && chartsample.value != null && !chartsample.value.isNaN() && sampleHighlightOn[i][l])
- {
- int k1 = calculateYPos(i, l, rectangle1);
- boolean flag6 = k1 >= rectangle.y && k1 <= rectangle.y + rectangle.height && d1 >= (double)rectangle.x && d1 <= (double)(rectangle.x + rectangle.width + 1);
- if(flag6)
- paintSampleHighlight(g, i, (int)Math.round(d1), k1, color);
- }
- d1 += d;
- }
- }
- d1 = rectangle1.x + 1;
- for(int i1 = 0; i1 < achartsample.length; i1++)
- {
- int j1 = calculateYPos(i, i1, rectangle1);
- if(samplePosition != null && i < samplePosition.length && samplePosition[i] != null && i1 < samplePosition[i].length && samplePosition[i][i1] != null)
- {
- samplePosition[i][i1].x = (int)Math.round(d1);
- samplePosition[i][i1].y = Math.round(j1);
- }
- d1 += d;
- }
- g.setClip(0, 0, 32767, 32767);
- }
- public boolean isAutoLabelSpacingOn()
- {
- return autoLabelSpacingOn;
- }
- public boolean isStackedOn()
- {
- return stackedOn;
- }
- public boolean isConnectedLinesOn(int i)
- {
- if(i >= 0 && i < connectedLinesOn.length)
- return connectedLinesOn[i];
- if(i == -1)
- {
- boolean flag = false;
- for(int j = 0; j < connectedLinesOn.length; j++)
- if(connectedLinesOn[j])
- flag = true;
- return flag;
- } else
- {
- return false;
- }
- }
- public void setLegendImage(int i, String s)
- {
- if(i >= 0 && i < 1000)
- {
- super.setLegendImage(i, s);
- if(highlightImages == null)
- highlightImages = new String[i + 1];
- if(i >= highlightImages.length)
- {
- String as[] = new String[i + 1];
- System.arraycopy(highlightImages, 0, as, 0, highlightImages.length);
- highlightImages = as;
- }
- highlightImages[i] = s;
- super.hasChanged = true;
- autoRepaint();
- }
- }
- private String constructFloatingLabel(int i, int j, boolean flag)
- {
- if(i < 0 || i >= getSeriesCount() || j < 0 || j >= getSampleCount())
- return "";
- String s = "";
- if(flag)
- {
- String s1 = getSeriesLabel(i);
- if(s1 != null)
- {
- s += s1;
- if(!s1.endsWith("n") && super.sampleLabelsOn && sampleLabelStyle == 2 && getSampleLabel(j) != null)
- s += " : ";
- }
- }
- if(super.sampleLabelsOn && sampleLabelStyle == 2 && getSampleLabel(j) != null)
- s += getSampleLabel(j);
- if(isValueLabelsOn() && valueLabelStyle == 2)
- {
- String s2 = getLabel("valueLabelPrefix_" + i);
- if(s2 == null)
- s2 = getLabel("valueLabelPrefix");
- String s3 = getLabel("valueLabelPostfix_" + i);
- if(s3 == null)
- s3 = getLabel("valueLabelPostfix");
- if(s.length() > 0)
- {
- String s4 = formatNumber(getSampleValue(i, j), getSampleDecimalCount(i));
- s4 = s2 == null ? s4 : s2 + s4;
- s4 = s3 == null ? s4 : s4 + s3;
- if(s.endsWith("n"))
- s += s4;
- else
- s = s + " : " + s4;
- } else
- {
- s = formatNumber(getSampleValue(i, j), getSampleDecimalCount(i));
- s = s2 == null ? s : s2 + s;
- s = s3 == null ? s : s + s3;
- }
- }
- return s;
- }
- private int calculateYPos(int i, int j, Rectangle rectangle)
- {
- double d = 0.0D;
- if(i >= 0 && stackedOn)
- {
- for(int k = 0; k <= i; k++)
- d += getSampleValue(k, j);
- } else
- if(i >= 0)
- d = getSampleValue(i, j);
- int l = getSeriesRange(i);
- double d1 = 0.0D;
- if(super.currentUpperRange[l] - super.currentLowerRange[l] != 0.0D)
- d1 = (d - super.currentLowerRange[l]) / (super.currentUpperRange[l] - super.currentLowerRange[l]);
- int i1 = (rectangle.y + rectangle.height) - (int)(d1 * (double)rectangle.height);
- boolean flag = is3DModeOn();
- if(flag && stackedOn)
- i1 -= super.depth3dPoint.y;
- else
- if(flag)
- {
- i1 -= super.depth3dPoint.y;
- double d2 = ((double)super.depth3dPoint.y / (double)getSeriesCount()) * (double)i;
- i1 += (int)Math.round(d2);
- }
- return i1;
- }
- private void paintValueLabels(Graphics g, Rectangle rectangle, Rectangle rectangle1, int i, boolean flag)
- {
- if(valueLabelStyle == 2)
- return;
- Font font = getFont("valueLabelFont");
- g.setFont(font);
- FontMetrics fontmetrics = g.getFontMetrics();
- int j = fontmetrics.getAscent();
- int k = getSampleDecimalCount(i);
- int l = getSampleCount();
- int i1 = getSeriesCount();
- int j1 = getLabelAngle("valueLabelAngle");
- getSize();
- double d = rectangle1.x;
- double d1 = rectangle1.width;
- if(l > 2)
- d1 = (double)rectangle1.width / (double)(l - 1);
- double d2 = super.depth3dPoint.x;
- boolean flag1 = is3DModeOn();
- if(flag1)
- {
- d -= super.depth3dPoint.x;
- double d3 = ((double)super.depth3dPoint.x / (double)i1) * (double)i;
- d += d3;
- }
- g.setColor(getChartForeground());
- String s = getLabel("valueLabelPrefix_" + i);
- if(s == null)
- s = getLabel("valueLabelPrefix");
- String s1 = getLabel("valueLabelPostfix_" + i);
- if(s1 == null)
- s1 = getLabel("valueLabelPostfix");
- ChartSample achartsample[] = getSamples(i);
- for(int k1 = 0; k1 < achartsample.length; k1++)
- {
- if(!flag && (achartsample[k1] == null || achartsample[k1].value == null || achartsample[k1].value.isNaN()))
- {
- d += d1;
- continue;
- }
- double d4 = 0.0D;
- if(flag)
- {
- boolean flag2 = false;
- for(int l1 = 0; l1 < i1; l1++)
- {
- ChartSample chartsample = getSample(l1, k1);
- if(chartsample != null && chartsample.value != null && !chartsample.value.isNaN())
- {
- d4 += chartsample.value.doubleValue();
- flag2 = true;
- }
- }
- if(!flag2)
- {
- d += d1;
- continue;
- }
- } else
- {
- d4 = achartsample[k1].getFloatValue();
- }
- String s2 = formatNumber(d4, k);
- s2 = s == null ? s2 : s + s2;
- s2 = s1 == null ? s2 : s2 + s1;
- Dimension dimension = getLabelSize(s2, font);
- Dimension dimension1 = getAngledLabelSize(dimension, j1);
- int i2 = (int)Math.round(d - (double)(dimension1.width / 2)) + 1;
- if(valueLabelStyle == 0)
- {
- if(flag1)
- i2 = Math.max((rectangle1.x - super.depth3dPoint.x) + 2, i2);
- else
- i2 = Math.max(rectangle1.x + 2, i2);
- i2 = Math.min(i2, (rectangle.x + rectangle.width) - dimension1.width - 1);
- }
- if(j1 % 360 > 90 && j1 % 360 < 180 || j1 % 360 > 270)
- i2 = (int)(d - (double)(fontmetrics.getAscent() / 2));
- int j2 = calculateYPos(i, k1, rectangle1) - 1;
- int k2 = j2;
- if(j1 % 180 != 0)
- k2 -= dimension1.height + 1;
- if(valueLabelStyle == 1)
- {
- if(j1 % 180 == 0)
- k2 += j / 2;
- else
- k2 = j2 - dimension1.height / 2;
- } else
- if(!stackedOn)
- {
- double d5 = k1 <= 0 || achartsample[k1 - 1] == null ? d4 : achartsample[k1 - 1].getFloatValue();
- double d7 = k1 >= achartsample.length - 1 || achartsample[k1 + 1] == null ? d4 : achartsample[k1 + 1].getFloatValue();
- double d9 = (d4 - d5) / d1;
- double d10 = (d7 - d4) / d1;
- if(d9 < d10)
- {
- if(j1 % 180 == 0)
- k2 += j;
- else
- k2 += dimension1.height + 4;
- if(j1 % 360 > 90 && j1 % 360 < 180 || j1 % 360 > 270)
- i2 = (int)((d - (double)dimension1.width) + (double)(fontmetrics.getAscent() / 2));
- } else
- if(flag1)
- {
- double d11 = (double)super.depth3dPoint.x / (double)i1;
- i2 = (int)((double)i2 + d11);
- d11 = (double)super.depth3dPoint.y / (double)i1;
- k2 = (int)((double)k2 + d11);
- }
- try
- {
- boolean flag4 = sampleHighlightOn[i][k1];
- int l2 = sampleHighlightSize[i];
- if(flag4 && d9 < d10)
- k2 += l2 / 2;
- else
- if(flag4)
- k2 -= l2 / 2;
- }
- catch(IndexOutOfBoundsException indexoutofboundsexception)
- {
- System.out.println("Internal error with value labels");
- indexoutofboundsexception.printStackTrace();
- }
- }
- boolean flag3 = true;
- if(flag1)
- {
- if(j2 <= k2)
- {
- flag3 = j2 >= rectangle.y - 2 && j2 <= (rectangle.y + rectangle.height + 2) - super.depth3dPoint.y && d >= (double)(rectangle.x - 2 - super.depth3dPoint.x) && d <= (double)(rectangle.x + rectangle.width + 2);
- } else
- {
- double d6 = (double)super.depth3dPoint.x / (double)i1;
- double d8 = (double)super.depth3dPoint.y / (double)i1;
- flag3 = (double)j2 >= (double)rectangle.y - d8 - 2D && (double)j2 <= (double)((rectangle.y + rectangle.height) - super.depth3dPoint.y) - d8 && d >= (double)(rectangle.x - super.depth3dPoint.x) - d6 - 2D && d <= ((double)(rectangle.x + rectangle.width) - d6) + 2D;
- }
- } else
- {
- flag3 = j2 >= rectangle.y - 2 && j2 <= rectangle.y + rectangle.height + 2 && d >= (double)(rectangle.x - 4) && d <= (double)(rectangle.x + rectangle.width + 2);
- }
- if(flag3)
- paintLabel(g, s2, i2, k2, dimension, 0, j1);
- d += d1;
- }
- }
- public void render(Graphics g)
- {
- render(g, !isServletModeOn());
- }
- void render(Graphics g, boolean flag)
- {
- Dimension dimension = getSize();
- 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)
- {
- Rectangle rectangle2 = new Rectangle(rectangle);
- Rectangle rectangle4 = new Rectangle(rectangle1);
- if(is3DModeOn())
- {
- rectangle2.x -= super.depth3dPoint.x;
- rectangle2.y -= super.depth3dPoint.y;
- rectangle4.x -= super.depth3dPoint.x;
- rectangle4.y -= super.depth3dPoint.y;
- }
- chart.calculateChartData(rectangle2, rectangle4);
- }
- }
- 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);
- }
- paintGrid(super.og, rectangle);
- paintTitle(super.og, dimension);
- if(super.sampleLabelsOn && sampleLabelStyle != 2)
- paintSampleLabels(super.og, rectangle, rectangle1);
- if(isLegendOn())
- paintLegend(super.og, rectangle, getLegendLabels());
- 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 rectangle3 = new Rectangle(rectangle);
- Rectangle rectangle5 = new Rectangle(rectangle1);
- rectangle3.x -= super.depth3dPoint.x;
- rectangle3.y -= super.depth3dPoint.y;
- rectangle5.x -= super.depth3dPoint.x;
- rectangle5.y -= super.depth3dPoint.y;
- if((chart1 instanceof LineChart) || (chart1 instanceof PieChart))
- chart1.renderData(super.og, rectangle3, rectangle5);
- else
- chart1.renderData(super.og, rectangle, rectangle1);
- }
- }
- if(is3DModeOn())
- {
- for(int k = super.rangeOn.length - 1; k >= 0; k--)
- paint3DZeroDivider(super.og, rectangle, k);
- if(isRangeOn(1))
- paint3DEdges(super.og, rectangle);
- }
- 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 paintLines(Graphics g, Rectangle rectangle, Rectangle rectangle1)
- {
- int i = getSeriesCount();
- if(i > 0)
- {
- for(int j = i - 1; j >= 0; j--)
- {
- int i1 = getSeriesRange(j);
- if(super.currentUpperRange[i1] != super.currentLowerRange[i1])
- paintLine(g, j, rectangle, rectangle1, getSampleColor(j), isSelected(j, -1));
- }
- if(!is3DModeOn() && lastSelectedLine >= 0)
- {
- int k = lastSelectedLine;
- paintLine(g, k, rectangle, rectangle1, getSampleColor(k), isSelected(k, -1));
- }
- if(stackedOn)
- {
- if(isValueLabelsOn(0))
- paintValueLabels(g, rectangle, rectangle1, i - 1, true);
- } else
- {
- for(int l = i - 1; l >= 0; l--)
- if(isValueLabelsOn(l))
- paintValueLabels(g, rectangle, rectangle1, l, false);
- }
- }
- }
- public int getValuePosition(double d)
- {
- return getValuePosition(0, d, getGraphBounds());
- }
- public void setSeriesLabelsOn(boolean flag)
- {
- seriesLabelsOn = flag;
- super.hasChanged = true;
- autoRepaint();
- }
- public void setSampleHighlightOn(boolean flag)
- {
- for(int i = 0; i < sampleHighlightOn.length; i++)
- {
- for(int j = 0; j < sampleHighlightOn[i].length; j++)
- sampleHighlightOn[i][j] = flag;
- }
- super.hasChanged = true;
- autoRepaint();
- }
- public void setSampleHighlightOn(int i, boolean flag)
- {
- try
- {
- for(int j = 0; j < sampleHighlightOn[i].length; j++)
- sampleHighlightOn[i][j] = flag;
- }
- catch(IndexOutOfBoundsException _ex)
- {
- throw new IllegalArgumentException("Invalid series: " + i);
- }
- super.hasChanged = true;
- autoRepaint();
- }
- public void setSampleHighlightOn(int i, int j, boolean flag)
- {
- try
- {
- sampleHighlightOn[i][j] = flag;
- }
- catch(IndexOutOfBoundsException _ex)
- {
- throw new IllegalArgumentException("Invalid series or index: " + i + ", " + j);
- }
- super.hasChanged = true;
- autoRepaint();
- }
- public int getSampleHighlightSize(int i)
- {
- try
- {
- return sampleHighlightSize[i];
- }
- catch(IndexOutOfBoundsException _ex)
- {
- throw new IllegalArgumentException("Invalid series: " + i);
- }
- }
- protected void checkDataIntegrity()
- {
- super.checkDataIntegrity();
- int i = getSeriesCount();
- int j = getSampleCount();
- int k = sampleHighlightOn.length;
- int l = k <= 0 ? 0 : sampleHighlightOn[0].length;
- if(i != k || j != l)
- {
- boolean aflag[][] = new boolean[i][j];
- for(int j1 = 0; j1 < i; j1++)
- {
- for(int l1 = 0; l1 < j; l1++)
- if(j1 < k && l1 < l)
- aflag[j1][l1] = sampleHighlightOn[j1][l1];
- }
- sampleHighlightOn = aflag;
- int ai[] = new int[i];
- int ai1[] = new int[i];
- boolean aflag1[] = new boolean[i];
- boolean aflag2[] = new boolean[i];
- int ai2[] = new int[i];
- for(int i2 = 0; i2 < i; i2++)
- if(i2 < k)
- {
- ai[i2] = sampleHighlightStyle[i2];
- ai1[i2] = sampleHighlightSize[i2];
- aflag1[i2] = seriesLinesOn[i2];
- aflag2[i2] = connectedLinesOn[i2];
- ai2[i2] = lineWidth[i2];
- } else
- {
- ai1[i2] = 6;
- aflag1[i2] = true;
- ai2[i2] = 2;
- }
- sampleHighlightStyle = ai;
- sampleHighlightSize = ai1;
- seriesLinesOn = aflag1;
- connectedLinesOn = aflag2;
- lineWidth = ai2;
- }
- samplePosition = new Point[i][j];
- for(int i1 = 0; i1 < samplePosition.length; i1++)
- {
- for(int k1 = 0; k1 < samplePosition[i1].length; k1++)
- samplePosition[i1][k1] = new Point();
- }
- if(lastSelectedLine >= i)
- lastSelectedLine = -1;
- }
- public Rectangle getGraphBounds()
- {
- if(!super.hasChanged && super.currentBounds != null)
- return super.currentBounds;
- Rectangle rectangle = super.getGraphBounds(getLegendLabels());
- Dimension dimension = getSize();
- int i = rectangle.x;
- int j = dimension.width - rectangle.width - rectangle.x;
- int k = rectangle.y;
- int l = dimension.height - rectangle.height - rectangle.y;
- for(int i1 = 0; i1 < super.rangeAdjusterOn.length; i1++)
- if(super.rangeAdjusterOn[i1])
- if(super.rangeAdjusterPosition[i1] == 0)
- i += 6;
- else
- j += 6;
- if(super.sampleLabelsOn && getSampleCount() > 0 && sampleLabelStyle != 2)
- {
- Font font = getFont("sampleLabelFont");
- FontMetrics fontmetrics = getFontMetrics(font);
- int k1 = 0;
- int j2 = getLabelAngle("sampleLabelAngle");
- String as[] = getSampleLabels();
- for(int k3 = 0; k3 < as.length; k3++)
- {
- Dimension dimension2 = getLabelSize(as[k3], font);
- Dimension dimension5 = getAngledLabelSize(dimension2, j2);
- k1 = Math.max(dimension5.height, k1);
- }
- l += k1 + 3;
- if(j2 % 180 == 0)
- l -= fontmetrics.getMaxDescent();
- String s4 = getSampleLabel(getSampleCount() - 1);
- int j4 = 0;
- if(s4 != null)
- {
- Dimension dimension6 = getLabelSize(s4, font);
- Dimension dimension8 = getAngledLabelSize(dimension6, j2);
- j4 = dimension8.width / 2 - 5;
- }
- int i5 = 0;
- if(isLegendOn() && getLegendPosition() == 1)
- i5 = super.legend.width;
- if(j4 > i5)
- j += j4 - i5;
- }
- boolean flag = false;
- for(int j1 = 0; j1 < super.rangeOn.length; j1++)
- flag = super.rangeOn[j1] ? true : flag;
- if(flag || super.rangeLabelsOn || super.targetsLabel.size() > 0)
- {
- FontMetrics fontmetrics1 = getFontMetrics(getFont("rangeLabelFont"));
- String s1 = getLabel("rangeLabelPrefix");
- String s2 = getLabel("rangeLabelPostfix");
- int l2 = 0;
- int l3 = 0;
- for(Enumeration enumeration = super.targetsLabel.keys(); enumeration.hasMoreElements();)
- {
- String s5 = (String)enumeration.nextElement();
- String s8 = getTargetLabel(s5);
- if(s8 != null && s8.length() > 0)
- if(super.rangePosition[0] == 0)
- l2 = Math.max(l2, fontmetrics1.stringWidth(s8));
- else
- l3 = Math.max(l3, fontmetrics1.stringWidth(s8));
- }
- if(super.rangeLabelsOn && super.rangeOn[0])
- {
- int k4 = getRangeDecimalCount(0);
- String s6 = formatNumber(super.upperRange[0], k4);
- String s9 = formatNumber(super.lowerRange[0], k4);
- s6 = s1 == null ? s6 : s1 + s6;
- s9 = s1 == null ? s9 : s1 + s9;
- s6 = s2 == null ? s6 : s6 + s2;
- s9 = s2 == null ? s9 : s9 + s2;
- if(super.rangePosition[0] == 0)
- {
- l2 = Math.max(l2, fontmetrics1.stringWidth(s6));
- l2 = Math.max(l2, fontmetrics1.stringWidth(s9));
- } else
- {
- l3 = Math.max(l3, fontmetrics1.stringWidth(s6));
- l3 = Math.max(l3, fontmetrics1.stringWidth(s9));
- }
- }
- if(super.rangeOn[1])
- {
- int l4 = getRangeDecimalCount(1);
- String s7 = formatNumber(super.upperRange[1], l4);
- String s10 = formatNumber(super.lowerRange[1], l4);
- if(super.rangePosition[1] == 0)
- {
- l2 = Math.max(l2, fontmetrics1.stringWidth(s7));
- l2 = Math.max(l2, fontmetrics1.stringWidth(s10));
- } else
- {
- l3 = Math.max(l3, fontmetrics1.stringWidth(s7));
- l3 = Math.max(l3, fontmetrics1.stringWidth(s10));
- }
- }
- i += l2 + 2;
- j += l3 <= 0 ? 0 : l3 + 2;
- }
- String s = getLabel("sampleAxisLabel");
- if(s != null)
- {
- Font font1 = getFont("sampleAxisLabelFont");
- FontMetrics fontmetrics2 = getFontMetrics(font1);
- int i3 = getLabelAngle("sampleAxisLabelAngle");
- Dimension dimension1 = getLabelSize(s, font1);
- Dimension dimension3 = getAngledLabelSize(dimension1, i3);
- l += dimension3.height + 3;
- if(i3 % 180 == 0)
- l -= fontmetrics2.getDescent();
- }
- int l1 = 0;
- do
- {
- String s3 = l1 != 0 ? getLabel("rangeAxisLabel_2") : getLabel("rangeAxisLabel");
- if(s3 != null)
- {
- Font font2 = getFont("rangeAxisLabelFont");
- getFontMetrics(font2);
- int i4 = l1 != 0 ? getLabelAngle("rangeAxisLabelAngle_2") : getLabelAngle("rangeAxisLabelAngle");
- Dimension dimension4 = getLabelSize(s3, font2);
- Dimension dimension7 = getAngledLabelSize(dimension4, i4);
- if(super.rangePosition[l1] == 0)
- i += dimension7.width + 20;
- else
- j += dimension7.width + 20;
- }
- } while(++l1 < 2);
- if(is3DModeOn())
- if(super.depth3d > -1)
- {
- i += super.depth3dPoint.x;
- l -= super.depth3dPoint.y;
- } else
- {
- int i2 = Math.max(20, getSampleCount());
- int k2 = getSeriesCount();
- if(k2 > 1 && !stackedOn)
- {
- i2 /= k2;
- i2 = Math.max(i2, 4);
- }
- int j3 = (int)(((float)rectangle.width * 1.25F) / ((float)i2 + 1.25F));
- i += j3;
- rectangle.width = dimension.width - i - j;
- double d = rectangle.width / i2;
- l += (int)Math.round(d / 1.25D);
- }
- Insets insets = getGraphInsets();
- if(insets != null)
- {
- k = insets.top != -1 ? insets.top : k;
- i = insets.left != -1 ? insets.left : i;
- l = insets.bottom != -1 ? insets.bottom : l;
- j = insets.right != -1 ? insets.right : j;
- }
- rectangle.x = i;
- rectangle.width = dimension.width - i - j - 1;
- rectangle.y = k;
- rectangle.height = dimension.height - k - l - 1;
- super.currentBounds = rectangle;
- return rectangle;
- }
- private void paint3DLine(Graphics g, int i, int j, int k, int l, int i1, Color color,
- boolean flag, boolean flag1)
- {
- int ai[] = new int[4];
- int ai1[] = new int[4];
- int j1 = stackedOn ? 1 : Math.max(1, getSeriesCount());
- int k1 = (int)Math.round((double)super.depth3dPoint.x / (double)j1);
- int l1 = (int)Math.round((double)super.depth3dPoint.y / (double)j1);
- ai[0] = i;
- ai1[0] = j;
- ai[1] = i + k1;
- ai1[1] = j + l1;
- ai[2] = ai[1] + (k - i);
- ai1[2] = l + l1;
- ai[3] = k;
- ai1[3] = l;
- Color color1 = color.darker();
- if(flag)
- {
- double d = 0.0D;
- if(ai[1] - ai[0] != 0)
- d = (double)(j - l) / (double)(k - i);
- if(d > 0.68999999999999995D)
- g.setColor(color1);
- else
- g.setColor(color);
- g.fillPolygon(ai, ai1, 4);
- g.setColor(color1);
- g.drawLine(ai[0], ai1[0], ai[1], ai1[1]);
- g.drawLine(ai[1], ai1[1], ai[2], ai1[2]);
- g.drawLine(ai[2], ai1[2], ai[3], ai1[3]);
- }
- if(flag1)
- {
- ai[0] = ai[3];
- ai1[0] = ai1[3];
- ai[1] = ai[2];
- ai1[1] = ai1[2];
- ai[2] = ai[2];
- ai1[2] = i1 + l1;
- ai[3] = ai[0];
- ai1[3] = i1;
- g.setColor(color);
- g.fillPolygon(ai, ai1, 4);
- g.setColor(color1);
- g.drawLine(ai[0], ai1[0], ai[1], ai1[1]);
- g.drawLine(ai[1], ai1[1], ai[2], ai1[2]);
- g.drawLine(ai[2], ai1[2], ai[3], ai1[3]);
- g.drawLine(ai[3], ai1[3], ai[0], ai1[0]);
- }
- }
- private void paint3DZeroDivider(Graphics g, Rectangle rectangle, int i)
- {
- i = Math.min(super.rangeOn.length - 1, Math.max(0, i));
- if(super.rangeOn[i])
- {
- int j = Math.max(super.zeroLine[i], rectangle.y);
- j = Math.min(j, rectangle.y + rectangle.height);
- int k = rectangle.x - super.depth3dPoint.x;
- int l = j - super.depth3dPoint.y;
- g.setColor(i != 0 ? getRangeColor(i) : getChartForeground());
- g.drawLine(k, l, k + rectangle.width, l);
- g.drawLine(k + rectangle.width, l, rectangle.x + rectangle.width, j);
- }
- }
- private void paintFloatingLabel(Graphics g, Rectangle rectangle, int i, int j, String s, Font font, FontMetrics fontmetrics)
- {
- if(i < 0 || i >= getSeriesCount() || j < 0 || j >= getSampleCount())
- return;
- Point point = null;
- if(samplePosition != null && i < samplePosition.length && samplePosition[i] != null && j <= samplePosition[i].length)
- point = samplePosition[i][j];
- if(point == null)
- return;
- int k = 0;
- if(is3DModeOn())
- if(stackedOn)
- {
- k = -super.depth3d;
- } else
- {
- double d = (double)super.depth3dPoint.x / (double)getSeriesCount();
- k = (int)Math.round(d * (double)i) - super.depth3dPoint.x;
- }
- if(point.x < rectangle.x || point.x > (rectangle.x + rectangle.width) - k)
- return;
- if(point.y < rectangle.y || point.y > (is3DModeOn() ? (rectangle.y + rectangle.height) - super.depth3dPoint.y : rectangle.y + rectangle.height))
- {
- return;
- } else
- {
- Dimension dimension = getLabelSize(s, font);
- int l = (point.x - dimension.width / 2) + k;
- int i1 = ((point.y - dimension.height) + fontmetrics.getAscent()) - 3;
- Dimension dimension1 = getSize();
- l = Math.max(l, 3);
- l = Math.min(l, dimension1.width - dimension.width - 3);
- i1 = Math.max(i1, fontmetrics.getAscent());
- i1 = Math.min(i1, ((dimension1.height - dimension.height) + fontmetrics.getAscent()) - 1);
- int j1 = fontmetrics.getHeight();
- int k1 = fontmetrics.getDescent();
- g.setColor(new Color(255, 255, 231));
- g.fillRect(l - 2, ((i1 - j1) + k1 * 2) - 2, dimension.width + 5, dimension.height);
- g.setColor(getChartForeground());
- g.setColor(getSampleColor(i).darker());
- g.drawRect(l - 3, ((i1 - j1) + k1 * 2) - 3, dimension.width + 5, dimension.height);
- g.setColor(Color.black);
- paintLabel(g, s, l, i1, dimension, 0, 0);
- return;
- }
- }
- public void setSampleHighlightStyle(int i, int j)
- {
- for(int k = 0; k < sampleHighlightStyle.length; k++)
- setSampleHighlightStyle(k, i, j);
- }
- public static final int SAMPLE_HIGHLIGHT_CIRCLE = 0;
- public static final int SAMPLE_HIGHLIGHT_CIRCLE_OPAQUE = 1;
- public static final int SAMPLE_HIGHLIGHT_CIRCLE_FILLED = 2;
- public static final int SAMPLE_HIGHLIGHT_SQUARE = 3;
- public static final int SAMPLE_HIGHLIGHT_SQUARE_OPAQUE = 4;
- public static final int SAMPLE_HIGHLIGHT_SQUARE_FILLED = 5;
- public static final int SAMPLE_HIGHLIGHT_DIAMOND = 6;
- public static final int SAMPLE_HIGHLIGHT_DIAMOND_OPAQUE = 7;
- public static final int SAMPLE_HIGHLIGHT_DIAMOND_FILLED = 8;
- public static final int VALUE_LABELS_OUTSIDE_POINT = 0;
- public static final int VALUE_LABELS_AT_POINT = 1;
- public static final int FLOATING = 2;
- public static final int BELOW = 3;
- private int valueLabelStyle;
- private int sampleLabelStyle;
- private boolean seriesLabelsOn;
- private boolean autoLabelSpacingOn;
- private int lineWidth[];
- private boolean stackedOn;
- private boolean sampleHighlightOn[][];
- private int sampleHighlightStyle[];
- private int sampleHighlightSize[];
- private boolean seriesLinesOn[];
- private boolean connectedLinesOn[];
- private String highlightImages[];
- private Point samplePosition[][];
- private int selectedSeries;
- private int selectedSample;
- private Point mousePosition;
- private int lastSelectedLine;
- }