JFreeChart 0.9.17 probably bugg found

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Thunder_scream

JFreeChart 0.9.17 probably bugg found

Post by Thunder_scream » Sat Mar 27, 2004 9:15 am

Hi! just tried the new release and compiler is complaing ..when I try to compile..and its right here in this code given below for every instance where the method createTextBock is called the compiler is complaining.

this is from the source file..TextTitle.java

Code: Select all

  * Draws a the title vertically within the specified area.  This method will be called
     * from the {@link #draw(Graphics2D, Rectangle2D) draw} method.
     * 
     * @param g2  the graphics device.
     * @param area  the area for the title.
     */
    protected void drawVertical(Graphics2D g2, Rectangle2D area) {
        Rectangle2D titleArea = (Rectangle2D) area.clone();
        getSpacer().trim(titleArea);
        g2.setFont(this.font);
        g2.setPaint(this.paint);
        TextBlock title = TextUtilities.createTextBlock(
            this.text, this.font, this.paint, (float) titleArea.getHeight(), new G2TextMeasurer(g2)
it saying that "this.paint" should be maxWith of type float?
paint returns paint..

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Mar 29, 2004 10:54 am

Make sure you are using jcommon-0.9.2.jar and not an earlier version.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Guest

Post by Guest » Mon Mar 29, 2004 5:13 pm

ok...that took away ....the error but I now get..this..

log4j:WARN No appenders could be found for logger (org.jfree.chart.JFreeChart).

log4j:WARN Please initialize the log4j system properly.

How to I get rid of this...
Thanks

garv

Post by garv » Tue Mar 30, 2004 3:59 pm

Initialse Log4j.

Code: Select all

import org.apache.log4j.Logger;
import org.apache.log4j.varia.NullAppender;

// put this in your main() function
Logger.getRootLogger().addAppender(
    new NullAppender()
);

Log4j has nothing to do with JFreeChart tho. For further questions, please refer to the Log4j documentation site:
http://logging.apache.org/log4j/docs/

hank
Posts: 31
Joined: Mon May 12, 2003 10:02 am
Location: Lake of Constance, Germany

Post by hank » Tue Mar 30, 2004 4:19 pm

this is not quite right,

jfreechart uses log4j.
I found following references:
  • Axis.java - org.jfree.chart.axis
    CategoryAxis.java - org.jfree.chart.axis
    JFreeChart.java - org.jfree.chart
    logger - org.jfree.chart.axis.Axis (2 matches)
    logger - org.jfree.chart.axis.CategoryAxis (2 matches)
    logger - org.jfree.chart.JFreeChart (2 matches)
    logger - org.jfree.chart.plot.PieLabelDistributor (2 matches)
    logger - org.jfree.chart.plot.PiePlot (2 matches)
    logger - org.jfree.chart.plot.XYPlot (2 matches)
    logger - org.jfree.chart.StandardLegend (2 matches)
    logger - org.jfree.chart.title.TextTitle (2 matches)
    PieLabelDistributor.java - org.jfree.chart.plot
    PiePlot.java - org.jfree.chart.plot
    StandardLegend.java - org.jfree.chart
    TextTitle.java - org.jfree.chart.title
    XYPlot.java - org.jfree.chart.plot
So, the caller has to initialize log4j, even if the calling code is not using log4j at all.

Easy and quick, this should be possible by:

Code: Select all

      org.apache.log4j.BasicConfigurator.configure();
      org.apache.log4j.Logger.getRootLogger().setLevel( org.apache.log4j.Level.OFF );
Make sure you have log4j.jar in the classpath.

HTH, cheers

Heinrich

tuc

different TextTitle bug (doc bug?)

Post by tuc » Tue Jun 08, 2004 7:07 pm

From the javadoc for TextTitle:

Code: Select all

public TextTitle(java.lang.String text,
                 java.awt.Font font,
                 org.jfree.ui.HorizontalAlignment horizontalAlignment)

    Creates a new title, using default attributes where necessary.

    For the horizontal alignment, use the constants (LEFT, RIGHT and CENTER) defined in the Title class. 
The problem is that the LEFT/RIGHT/CENTER constants defined in the Title class are ints, not org.jfree.ui.HorizontalAlignment objects.
(With one exception: DEFAULT_HORIZONTAL_ALIGNMENT is a HorizontalAlignment.)

In 0.9.16 I was calling

Code: Select all

new TextTitle(str, eFont, TextTitle.LEFT);
but that doesn't compile with 0.9.20. As a quick workaround I'm just took out the alignment

Code: Select all

new TextTitle(str, eFont); //, TextTitle.LEFT);
but now I get centered titles.

I don't see any javadoc for org.jfree.ui.HorizontalAlignment but org.jfree.ui.HorizontalAlignment.LEFT seems to exist. Should the docs for TextTitle be changed?

Locked