|
From: <nat...@us...> - 2003-08-25 04:26:21
|
Update of /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts
In directory sc8-pr-cvs1:/tmp/cvs-serv12424
Modified Files:
Legend.java
Log Message:
includes a bug fix for combos
Index: Legend.java
===================================================================
RCS file: /cvsroot/jcharts/krysalis-jcharts/src/java/org/krysalis/jcharts/Legend.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Legend.java 8 Aug 2003 08:51:27 -0000 1.7
--- Legend.java 24 Aug 2003 14:47:59 -0000 1.8
***************
*** 331,343 ****
if( (chartType == ChartType.POINT) || (chartType == ChartType.LINE) )
{
! for( int i = 0; i < numberOfLabels; i++ )
{
//---get the bounds of the shape
Double shapeWidthDouble = new Double( ( ( (Shape) this.shapes.get( i ) ).getBounds2D().getWidth() ) );
float shapeWidth = shapeWidthDouble.floatValue();
! this.iconSide = Math.max(this.iconSide, shapeWidth);
}
! }
!
this.determineWidthAndHeight( numberOfLabels );
}
--- 331,344 ----
if( (chartType == ChartType.POINT) || (chartType == ChartType.LINE) )
{
! //for( int i = 0; i < numberOfLabels; i++ )
! for( int i = 0; i < this.shapes.size(); i++ )
{
//---get the bounds of the shape
Double shapeWidthDouble = new Double( ( ( (Shape) this.shapes.get( i ) ).getBounds2D().getWidth() ) );
float shapeWidth = shapeWidthDouble.floatValue();
! this.iconSide = Math.max(this.iconSide, shapeWidth);
}
! }
!
this.determineWidthAndHeight( numberOfLabels );
}
***************
*** 416,426 ****
//---account for icons
width += (this.iconSide + this.legendProperties.getIconPadding()) * this.numColumns;
!
//---account for space between each column
width += this.legendProperties.getColumnPadding() * (this.numColumns - 1);
!
//---account for lineStrokes for LINE charts
if( chartType == ChartType.LINE)
! {
width += this.legendProperties.getIconLineStrokeLength() * 2 * this.numColumns;
}
--- 417,427 ----
//---account for icons
width += (this.iconSide + this.legendProperties.getIconPadding()) * this.numColumns;
!
//---account for space between each column
width += this.legendProperties.getColumnPadding() * (this.numColumns - 1);
!
//---account for lineStrokes for LINE charts
if( chartType == ChartType.LINE)
! {
width += this.legendProperties.getIconLineStrokeLength() * 2 * this.numColumns;
}
***************
*** 440,445 ****
public void render()
{
! Graphics2D g2d = this.chart.getGraphics2D();
!
//---get the bounds of the image
Rectangle2D.Float rectangle = new Rectangle2D.Float( this.x, this.y, width - 1, this.height - 1 );
--- 441,446 ----
public void render()
{
! Graphics2D g2d = this.chart.getGraphics2D();
!
//---get the bounds of the image
Rectangle2D.Float rectangle = new Rectangle2D.Float( this.x, this.y, width - 1, this.height - 1 );
***************
*** 485,489 ****
//LOOP
for( int i = 0; i < this.numColumns; i++ )
! {
rectangle.x = posX;
--- 486,490 ----
//LOOP
for( int i = 0; i < this.numColumns; i++ )
! {
rectangle.x = posX;
***************
*** 492,499 ****
// only Point and Line Charts will have shapes drawn
! if( this.shapes.size() > 0 )
{
Shape shape = (Shape)this.shapes.get( labelIndex);
!
//---get the original transform so can reset it
AffineTransform affineTransform = g2d.getTransform();
--- 493,500 ----
// only Point and Line Charts will have shapes drawn
! if( this.shapes.size() > 0 && this.shapes.size() > labelIndex )
{
Shape shape = (Shape)this.shapes.get( labelIndex);
!
//---get the original transform so can reset it
AffineTransform affineTransform = g2d.getTransform();
***************
*** 531,537 ****
double XOffset = shapeBounds.getWidth() / 2;
double YOffset = shapeBounds.getHeight() / 2;
!
g2d.setStroke(this.lineChartProperties.getLineStrokes()[ labelIndex]);
!
Line2D.Double line = new Line2D.Double(0, YOffset, this.legendProperties.getIconLineStrokeLength(), YOffset);
g2d.draw( line );
--- 532,538 ----
double XOffset = shapeBounds.getWidth() / 2;
double YOffset = shapeBounds.getHeight() / 2;
!
g2d.setStroke(this.lineChartProperties.getLineStrokes()[ labelIndex]);
!
Line2D.Double line = new Line2D.Double(0, YOffset, this.legendProperties.getIconLineStrokeLength(), YOffset);
g2d.draw( line );
|