Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject Font in graph

pcsssroy

Location : India
Member since : Dec 16, 2004
Messages : 1
 Dec 16, 2004 at 6:28 PM
Hi,

I am facing a problem in using PJA toolkit on AIX with Websphere 5.0.2. There is a servlet which on the fly generates a graph & display with text. Even though graph is generated properly but fonts are not getting displayed. We did all the setting as mentioned in eTek, still I am not able to figure out the problem. Can you please help me on this.

Thanks in advance

Best Regards,
Siddhartha Roy

Code is...
/**
* Request the producer create an image
*
* @param stream stream to write image into
* @return image type
*/
public String createImage(OutputStream stream, int prices[]) throws IOException {

arrayLength = prices.length;
minValue = prices[0];
maxValue = prices[0];
getMinMaxAverage(prices);

System.out.println("minValue = " + minValue);
System.out.println("maxValue = " + maxValue);
System.out.println("averageValue = " + averageValue);

int interval = (maxValue - minValue ) / 10;
interval = ((interval+10) /10 ) * 10;

System.out.println("interval = " + interval);



int verticalStart = ((minValue - interval) / interval) * interval;
int verticalEnd = ((maxValue + 2 * interval) / interval) * interval;
verticalPoints = (verticalEnd - verticalStart)/ interval + 1;
int horizontalInterval = 0;
if(arrayLength > 10 ) {
horizontalInterval = arrayLength /10;
}
else {
horizontalInterval = 1;
}

while(verticalStart >= 0) {
verticalStart = verticalStart - interval;
verticalPoints++;
}

while(verticalEnd < 48) {
verticalEnd = verticalEnd + interval;
verticalPoints++;
}


System.setProperty("awt.toolkit","com.eteks.awt.PJAToolkit");
System.setProperty("java.awt.graphicsenv","com.eteks.java2d.PJAGraphicsEnvironment");
System.setProperty("java2d.font.usePlatformFont","false");

System.out.println("verticalStart " + verticalStart);
System.out.println("verticalEnd " + verticalEnd);
System.out.println("verticalPoints " + verticalPoints);
System.out.println("horizontalInterval " + horizontalInterval);

JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(stream);

//BufferedImage bi =
PJABufferedImage bi =
new PJABufferedImage(
ImageWidth + 10,
ImageHeight,
PJABufferedImage.TYPE_BYTE_INDEXED);





PJAGraphicsEnvironment objPJAGraphicsEnvironment = new PJAGraphicsEnvironment();
graphics = objPJAGraphicsEnvironment.createGraphics(bi);


graphics.setColor(Color.white);
graphics.fillRect(0, 0, bi.getWidth(), bi.getHeight());
graphics.setColor(Color.black);

System.out.println("222222 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+graphics.getFont());

graphics.draw(
new Rectangle2D.Double(
HorzInset,
VertInset / 4,
ImageWidth - HorzInset - 5,
ImageHeight - VertInset - 5));

createVerticalAxis();
assignVerticalRange(verticalStart, verticalEnd , interval, "Filling Time (Hrs)");
createHorizontalAxis(horizontalInterval);

System.out.println("333333333333");

assignHorizontalRange(1, arrayLength, horizontalInterval, "Filling #");
graphics.setColor(Color.green);
graphics.setStroke(dashed);
drawLimitLine(0);

System.out.println("44444444");

graphics.setStroke(new BasicStroke());
graphics.setColor(Color.blue);
drawLimitLine(averageValue);
graphics.setColor(Color.green);
graphics.setStroke(dashed);
drawLimitLine(48);
graphics.setColor(Color.black);
plotPrices(prices);

System.out.println("5555555555");

encoder.encode(bi);

System.out.println("66666666666");

return "image/jpg";
}

/**
* Create the vertical axis
*
*
*/
void createVerticalAxis() {
vertAxis =
new Line2D.Double(
HorzInset,
VertInset,
HorzInset,
ImageHeight - VertInset);
graphics.draw(vertAxis);

// Draw the vertical hatch marks
int verticalLength = ImageHeight - (VertInset);
int interval = verticalLength / (verticalPoints -1);

Line2D.Double vertHatch = null;
verticalAxisTicks = new Line2D.Double[verticalPoints];
for (int i = 0; i < verticalPoints ; i++) {

vertHatch =
new Line2D.Double(
vertAxis.getP1().getX() - HatchLength,
(VertInset / 4) + interval * i,
vertAxis.getP1().getX(),
(VertInset / 4) + interval * i);
verticalAxisTicks[i] = vertHatch;
if (i == 0 || i == verticalPoints -1) {
continue;
}
graphics.draw(vertHatch);

}
verticalYTop = verticalAxisTicks[0].getP1().getY();
verticalYBottom = verticalAxisTicks[verticalPoints-1].getP1().getY();
}

/**
* Create the horizontal axis
*
*
*/
void createHorizontalAxis(int interval) {
horAxis =
new Line2D.Double(
HorzInset,
ImageHeight - (HorzInset - 10),
ImageWidth - 5,
ImageHeight - (HorzInset - 10));
graphics.draw(horAxis);

int horLength = ImageWidth - (HorzInset - 5);
double horInterval = ((double) horLength) / (arrayLength + 1);
horInterval -= 0.1;
Line2D.Double horHatch = null;
horizontalAxisTicks = new Line2D.Double[arrayLength + 1];

// Draw the horizontal hatches

for (int i = 0; i < arrayLength +1 ; i++) {
horHatch =
new Line2D.Double(
horAxis.getP1().getX() + horInterval * i,
horAxis.getP1().getY(),
horAxis.getP1().getX() + horInterval * i,
horAxis.getP1().getY() + HatchLength);
horizontalAxisTicks[i] = horHatch;
if (i==0 || i % interval != 0) {
continue;
}
graphics.draw(horHatch);

}
}

/**
* Assignes the range for the vertical axis
*
*/
void assignVerticalRange(
int low,
int high,
int increment,
String verticalName) {
lowVerticalRange = low;
highVerticalRange = high;

int current = low;
int hatchCount = verticalAxisTicks.length - 1;

//***************************************************************
// Label each vertical tick starting with the low value and
// increasing by increment value
//***************************************************************
while (current <= high) {
decorateVerticalLine(
verticalAxisTicks[hatchCount],
new Integer(current).toString());
current += increment;
hatchCount--;
}

double baseX = ImageWidth - HorzInset * 9.6;
double baseY = ImageHeight - VertInset * 3.3;
graphics.rotate(Math.toRadians(270));
graphics.drawString(
verticalName,
new Float(baseX).floatValue(),
new Float(baseY).floatValue());
//graphics.rotate(Math.PI/8.0);
graphics.rotate(Math.toRadians(90));

}

/**
* Adds decorating text to the enpoint of a horizontal line
*
*/
void decorateVerticalLine(Line2D.Double line, String text) {
double endX = line.getX1();
double endY = line.getY1();
double baseX = endX;
double baseY = endY;

//***************************************************************
// The text should be slightly to the left of the line
// and centered
//***************************************************************

FontMetrics metrics = graphics.getFontMetrics();


baseX -= metrics.stringWidth(text);
baseY += metrics.getAscent() / 2;
graphics.drawString(
text,
new Float(baseX).floatValue(),
new Float(baseY).floatValue());
}

/**
* Assignes the range for the horizontal axis
*
*/
void assignHorizontalRange(
int low,
int high,
int increment,
String horizontalName) {
lowHorizontalRange = low;
highHorizontalRange = high;

int current = high;
int hatchCount = horizontalAxisTicks.length - 2;

//***************************************************************
// Label each horizontal tick starting with the low value and
// increasing by increment value
//***************************************************************

while (current >= low) {
decorateHorizontalLine(
horizontalAxisTicks[(current/increment)*increment],
new Integer((current/increment)*increment).toString());
current -= increment;
hatchCount--;
}

double baseX = ImageWidth - HorzInset * 4 + 10;
double baseY = ImageHeight - VertInset / 4;
graphics.drawString(
horizontalName,
new Float(baseX).floatValue(),
new Float(baseY).floatValue());

}

/**
* Adds decorating text to the enpoint of a vertical line
*
*/
void decorateHorizontalLine(Line2D.Double line, String text) {
double endX = line.getX2();
double endY = line.getY2();
double baseX = endX;
double baseY = endY;

//***************************************************************
// Center the text over the line
//***************************************************************
//FontMetrics metrics = graphics.getFontMetrics();
FontMetrics metrics = graphics.getFontMetrics();
baseX -= metrics.stringWidth(text) / 2;
baseY += metrics.getAscent();

graphics.drawString(
text,
new Float(baseX).floatValue(),
new Float(baseY).floatValue());

}

/**
* Draw Maximum/Minimum/Center Limit Line
*
*
*/
void drawLimitLine(int limit) {
double yAxisLength = verticalYBottom - verticalYTop;
double startPointValue =
calculatePriceRatio(limit) * yAxisLength + (VertInset / 4);
Point2D.Double startPoint =
new Point2D.Double(
horizontalAxisTicks[1].getX1() - 10,
startPointValue);
double endPointValue =
calculatePriceRatio(limit) * yAxisLength + (VertInset / 4);
Point2D.Double nextPoint =
new Point2D.Double(
horizontalAxisTicks[arrayLength].getX1() + 10,
endPointValue);
Line2D.Double line = new Line2D.Double(startPoint, nextPoint);
graphics.draw(line);
}

/**
* Plot the five closing stock prices
*
*
*/
void plotPrices(int[] prices) {
int totalPoints = prices.length;
int pointNo = 1;
double yAxisLength = verticalYBottom - verticalYTop;
double startPointValue =
calculatePriceRatio(prices[pointNo - 1]) * yAxisLength
+ (VertInset / 4);
Point2D.Double startPoint =
new Point2D.Double(
horizontalAxisTicks[pointNo].getX1(),
startPointValue);

graphics.setStroke(stroke);
graphics.drawOval(
(int) (horizontalAxisTicks[pointNo].getX1() - 5),
(int) (startPointValue - 2),
5,
5);

for (; pointNo < totalPoints; pointNo++) {
startPointValue =
calculatePriceRatio(prices[pointNo - 1]) * yAxisLength
+ (VertInset / 4);
startPoint =
new Point2D.Double(
horizontalAxisTicks[pointNo].getX1() - 2,
startPointValue + 2);

double nextPointValue =
calculatePriceRatio(prices[pointNo]) * yAxisLength
+ (VertInset / 4);
Point2D.Double nextPoint =
new Point2D.Double(
horizontalAxisTicks[pointNo + 1].getX1() - 2,
nextPointValue + 2);

graphics.drawOval(
(int) (horizontalAxisTicks[pointNo + 1].getX1() - 5),
(int) (nextPointValue - 2),
5,
5);
Line2D.Double line = new Line2D.Double(startPoint, nextPoint);
graphics.draw(line);

startPoint = nextPoint;
}
}

/**
* Determine the location of the price in the range of price data
*
*/
double calculatePriceRatio(int price) {
//***************************************************************
// calculatePriceRatio will determine the percentage of the
// Y axis the price is, then multiply by the Y axis length.
//
//***************************************************************
double totalDataRange = highVerticalRange - lowVerticalRange;
double pointDelta = highVerticalRange - price;
double ratio = pointDelta / totalDataRange;
return ratio;
}

void getMinMaxAverage(int prices[]) {
int sum = 0;
for(int i=0 ; i < prices.length ; i++) {
if(prices[i] < minValue) {
minValue = prices[i];
}
if(prices[i] > maxValue) {
maxValue = prices[i];
}
sum += prices[i];
}
averageValue = sum/prices.length;
}

private Line2D.Double vertAxis;
private Line2D.Double horAxis;
private Line2D.Double[] horizontalAxisTicks;
private int highVerticalRange;
private int lowVerticalRange;
private int highHorizontalRange;
private int lowHorizontalRange;
private Graphics2D graphics;
private Line2D.Double[] verticalAxisTicks;
private double verticalYTop;
private double verticalYBottom;
private double horizontalXStart;
private double horizontalXEnd;
private final BasicStroke stroke = new BasicStroke(2.0f);

private final float dash1[] = { 10.0f };
private final BasicStroke dashed =
new BasicStroke(
1.0f,
BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER,
10.0f,
dash1,
0.0f);

---
Siddhartha

testdrive

Location : Atanta, USA
Member since : Jun 23, 2005
Messages : 3
 Jun 24, 2005 at 6:10 PM
> Hi,
>
> I am facing a problem in using PJA toolkit on AIX with Websphere 5.0.2. There is a servlet which on the fly generates a graph & display with text. Even though graph is generated properly but fonts are not getting displayed. We did all the setting as mentioned in eTek, still I am not able to figure out the problem. Can you please help me on this.
>
> Thanks in advance
>
> Best Regards,
> Siddhartha Roy
>
> Code is...
> /**
> * Request the producer create an image
> *
> * @param stream stream to write image into
> * @return image type
> */
> public String createImage(OutputStream stream, int prices[]) throws IOException {
>
> arrayLength = prices.length;
> minValue = prices[0];
> maxValue = prices[0];
> getMinMaxAverage(prices);
>
> System.out.println("minValue = " + minValue);
> System.out.println("maxValue = " + maxValue);
> System.out.println("averageValue = " + averageValue);
>
> int interval = (maxValue - minValue ) / 10;
> interval = ((interval+10) /10 ) * 10;
>
> System.out.println("interval = " + interval);
>
>
>
> int verticalStart = ((minValue - interval) / interval) * interval;
> int verticalEnd = ((maxValue + 2 * interval) / interval) * interval;
> verticalPoints = (verticalEnd - verticalStart)/ interval + 1;
> int horizontalInterval = 0;
> if(arrayLength > 10 ) {
> horizontalInterval = arrayLength /10;
> }
> else {
> horizontalInterval = 1;
> }
>
> while(verticalStart >= 0) {
> verticalStart = verticalStart - interval;
> verticalPoints++;
> }
>
> while(verticalEnd < 48) {
> verticalEnd = verticalEnd + interval;
> verticalPoints++;
> }
>
>
> System.setProperty("awt.toolkit","com.eteks.awt.PJAToolkit");
> System.setProperty("java.awt.graphicsenv","com.eteks.java2d.PJAGraphicsEnvironment");
> System.setProperty("java2d.font.usePlatformFont","false");
>
> System.out.println("verticalStart " + verticalStart);
> System.out.println("verticalEnd " + verticalEnd);
> System.out.println("verticalPoints " + verticalPoints);
> System.out.println("horizontalInterval " + horizontalInterval);
>
> JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(stream);
>
> //BufferedImage bi =
> PJABufferedImage bi =
> new PJABufferedImage(
> ImageWidth + 10,
> ImageHeight,
> PJABufferedImage.TYPE_BYTE_INDEXED);
>
>
>
>
>
> PJAGraphicsEnvironment objPJAGraphicsEnvironment = new PJAGraphicsEnvironment();
> graphics = objPJAGraphicsEnvironment.createGraphics(bi);
>
>
> graphics.setColor(Color.white);
> graphics.fillRect(0, 0, bi.getWidth(), bi.getHeight());
> graphics.setColor(Color.black);
>
> System.out.println("222222 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+graphics.getFont());
>
> graphics.draw(
> new Rectangle2D.Double(
> HorzInset,
> VertInset / 4,
> ImageWidth - HorzInset - 5,
> ImageHeight - VertInset - 5));
>
> createVerticalAxis();
> assignVerticalRange(verticalStart, verticalEnd , interval, "Filling Time (Hrs)");
> createHorizontalAxis(horizontalInterval);
>
> System.out.println("333333333333");
>
> assignHorizontalRange(1, arrayLength, horizontalInterval, "Filling #");
> graphics.setColor(Color.green);
> graphics.setStroke(dashed);
> drawLimitLine(0);
>
> System.out.println("44444444");
>
> graphics.setStroke(new BasicStroke());
> graphics.setColor(Color.blue);
> drawLimitLine(averageValue);
> graphics.setColor(Color.green);
> graphics.setStroke(dashed);
> drawLimitLine(48);
> graphics.setColor(Color.black);
> plotPrices(prices);
>
> System.out.println("5555555555");
>
> encoder.encode(bi);
>
> System.out.println("66666666666");
>
> return "image/jpg";
> }
>
> /**
> * Create the vertical axis
> *
> *
> */
> void createVerticalAxis() {
> vertAxis =
> new Line2D.Double(
> HorzInset,
> VertInset,
> HorzInset,
> ImageHeight - VertInset);
> graphics.draw(vertAxis);
>
> // Draw the vertical hatch marks
> int verticalLength = ImageHeight - (VertInset);
> int interval = verticalLength / (verticalPoints -1);
>
> Line2D.Double vertHatch = null;
> verticalAxisTicks = new Line2D.Double[verticalPoints];
> for (int i = 0; i < verticalPoints ; i++) {
>
> vertHatch =
> new Line2D.Double(
> vertAxis.getP1().getX() - HatchLength,
> (VertInset / 4) + interval * i,
> vertAxis.getP1().getX(),
> (VertInset / 4) + interval * i);
> verticalAxisTicks[i] = vertHatch;
> if (i == 0 || i == verticalPoints -1) {
> continue;
> }
> graphics.draw(vertHatch);
>
> }
> verticalYTop = verticalAxisTicks[0].getP1().getY();
> verticalYBottom = verticalAxisTicks[verticalPoints-1].getP1().getY();
> }
>
> /**
> * Create the horizontal axis
> *
> *
> */
> void createHorizontalAxis(int interval) {
> horAxis =
> new Line2D.Double(
> HorzInset,
> ImageHeight - (HorzInset - 10),
> ImageWidth - 5,
> ImageHeight - (HorzInset - 10));
> graphics.draw(horAxis);
>
> int horLength = ImageWidth - (HorzInset - 5);
> double horInterval = ((double) horLength) / (arrayLength + 1);
> horInterval -= 0.1;
> Line2D.Double horHatch = null;
> horizontalAxisTicks = new Line2D.Double[arrayLength + 1];
>
> // Draw the horizontal hatches
>
> for (int i = 0; i < arrayLength +1 ; i++) {
> horHatch =
> new Line2D.Double(
> horAxis.getP1().getX() + horInterval * i,
> horAxis.getP1().getY(),
> horAxis.getP1().getX() + horInterval * i,
> horAxis.getP1().getY() + HatchLength);
> horizontalAxisTicks[i] = horHatch;
> if (i==0 || i % interval != 0) {
> continue;
> }
> graphics.draw(horHatch);
>
> }
> }
>
> /**
> * Assignes the range for the vertical axis
> *
> */
> void assignVerticalRange(
> int low,
> int high,
> int increment,
> String verticalName) {
> lowVerticalRange = low;
> highVerticalRange = high;
>
> int current = low;
> int hatchCount = verticalAxisTicks.length - 1;
>
> //***************************************************************
> // Label each vertical tick starting with the low value and
> // increasing by increment value
> //***************************************************************
> while (current <= high) {
> decorateVerticalLine(
> verticalAxisTicks[hatchCount],
> new Integer(current).toString());
> current += increment;
> hatchCount--;
> }
>
> double baseX = ImageWidth - HorzInset * 9.6;
> double baseY = ImageHeight - VertInset * 3.3;
> graphics.rotate(Math.toRadians(270));
> graphics.drawString(
> verticalName,
> new Float(baseX).floatValue(),
> new Float(baseY).floatValue());
> //graphics.rotate(Math.PI/8.0);
> graphics.rotate(Math.toRadians(90));
>
> }
>
> /**
> * Adds decorating text to the enpoint of a horizontal line
> *
> */
> void decorateVerticalLine(Line2D.Double line, String text) {
> double endX = line.getX1();
> double endY = line.getY1();
> double baseX = endX;
> double baseY = endY;
>
> //***************************************************************
> // The text should be slightly to the left of the line
> // and centered
> //***************************************************************
>
> FontMetrics metrics = graphics.getFontMetrics();
>
>
> baseX -= metrics.stringWidth(text);
> baseY += metrics.getAscent() / 2;
> graphics.drawString(
> text,
> new Float(baseX).floatValue(),
> new Float(baseY).floatValue());
> }
>
> /**
> * Assignes the range for the horizontal axis
> *
> */
> void assignHorizontalRange(
> int low,
> int high,
> int increment,
> String horizontalName) {
> lowHorizontalRange = low;
> highHorizontalRange = high;
>
> int current = high;
> int hatchCount = horizontalAxisTicks.length - 2;
>
> //***************************************************************
> // Label each horizontal tick starting with the low value and
> // increasing by increment value
> //***************************************************************
>
> while (current >= low) {
> decorateHorizontalLine(
> horizontalAxisTicks[(current/increment)*increment],
> new Integer((current/increment)*increment).toString());
> current -= increment;
> hatchCount--;
> }
>
> double baseX = ImageWidth - HorzInset * 4 + 10;
> double baseY = ImageHeight - VertInset / 4;
> graphics.drawString(
> horizontalName,
> new Float(baseX).floatValue(),
> new Float(baseY).floatValue());
>
> }
>
> /**
> * Adds decorating text to the enpoint of a vertical line
> *
> */
> void decorateHorizontalLine(Line2D.Double line, String text) {
> double endX = line.getX2();
> double endY = line.getY2();
> double baseX = endX;
> double baseY = endY;
>
> //***************************************************************
> // Center the text over the line
> //***************************************************************
> //FontMetrics metrics = graphics.getFontMetrics();
> FontMetrics metrics = graphics.getFontMetrics();
> baseX -= metrics.stringWidth(text) / 2;
> baseY += metrics.getAscent();
>
> graphics.drawString(
> text,
> new Float(baseX).floatValue(),
> new Float(baseY).floatValue());
>
> }
>
> /**
> * Draw Maximum/Minimum/Center Limit Line
> *
> *
> */
> void drawLimitLine(int limit) {
> double yAxisLength = verticalYBottom - verticalYTop;
> double startPointValue =
> calculatePriceRatio(limit) * yAxisLength + (VertInset / 4);
> Point2D.Double startPoint =
> new Point2D.Double(
> horizontalAxisTicks[1].getX1() - 10,
> startPointValue);
> double endPointValue =
> calculatePriceRatio(limit) * yAxisLength + (VertInset / 4);
> Point2D.Double nextPoint =
> new Point2D.Double(
> horizontalAxisTicks[arrayLength].getX1() + 10,
> endPointValue);
> Line2D.Double line = new Line2D.Double(startPoint, nextPoint);
> graphics.draw(line);
> }
>
> /**
> * Plot the five closing stock prices
> *
> *
> */
> void plotPrices(int[] prices) {
> int totalPoints = prices.length;
> int pointNo = 1;
> double yAxisLength = verticalYBottom - verticalYTop;
> double startPointValue =
> calculatePriceRatio(prices[pointNo - 1]) * yAxisLength
> + (VertInset / 4);
> Point2D.Double startPoint =
> new Point2D.Double(
> horizontalAxisTicks[pointNo].getX1(),
> startPointValue);
>
> graphics.setStroke(stroke);
> graphics.drawOval(
> (int) (horizontalAxisTicks[pointNo].getX1() - 5),
> (int) (startPointValue - 2),
> 5,
> 5);
>
> for (; pointNo < totalPoints; pointNo++) {
> startPointValue =
> calculatePriceRatio(prices[pointNo - 1]) * yAxisLength
> + (VertInset / 4);
> startPoint =
> new Point2D.Double(
> horizontalAxisTicks[pointNo].getX1() - 2,
> startPointValue + 2);
>
> double nextPointValue =
> calculatePriceRatio(prices[pointNo]) * yAxisLength
> + (VertInset / 4);
> Point2D.Double nextPoint =
> new Point2D.Double(
> horizontalAxisTicks[pointNo + 1].getX1() - 2,
> nextPointValue + 2);
>
> graphics.drawOval(
> (int) (horizontalAxisTicks[pointNo + 1].getX1() - 5),
> (int) (nextPointValue - 2),
> 5,
> 5);
> Line2D.Double line = new Line2D.Double(startPoint, nextPoint);
> graphics.draw(line);
>
> startPoint = nextPoint;
> }
> }
>
> /**
> * Determine the location of the price in the range of price data
> *
> */
> double calculatePriceRatio(int price) {
> //***************************************************************
> // calculatePriceRatio will determine the percentage of the
> // Y axis the price is, then multiply by the Y axis length.
> //
> //***************************************************************
> double totalDataRange = highVerticalRange - lowVerticalRange;
> double pointDelta = highVerticalRange - price;
> double ratio = pointDelta / totalDataRange;
> return ratio;
> }
>
> void getMinMaxAverage(int prices[]) {
> int sum = 0;
> for(int i=0 ; i < prices.length ; i++) {
> if(prices[i] < minValue) {
> minValue = prices[i];
> }
> if(prices[i] > maxValue) {
> maxValue = prices[i];
> }
> sum += prices[i];
> }
> averageValue = sum/prices.length;
> }
>
> private Line2D.Double vertAxis;
> private Line2D.Double horAxis;
> private Line2D.Double[] horizontalAxisTicks;
> private int highVerticalRange;
> private int lowVerticalRange;
> private int highHorizontalRange;
> private int lowHorizontalRange;
> private Graphics2D graphics;
> private Line2D.Double[] verticalAxisTicks;
> private double verticalYTop;
> private double verticalYBottom;
> private double horizontalXStart;
> private double horizontalXEnd;
> private final BasicStroke stroke = new BasicStroke(2.0f);
>
> private final float dash1[] = { 10.0f };
> private final BasicStroke dashed =
> new BasicStroke(
> 1.0f,
> BasicStroke.CAP_BUTT,
> BasicStroke.JOIN_MITER,
> 10.0f,
> dash1,
> 0.0f);
>


Did you get answer to this problem? I am having the same problem in Linux with IBM JVM 1.3.1

--Kal
---
Kal


Home pageFind It!ContactTop

© Copyrights 1997-2014 eTeks - All rights reserved

PJAPJA documentation