#3 Label for barchart is not working

closed-fixed
David Gilbert
None
5
2008-06-27
2008-02-25
Anonymous
No

Hello,

the labe for the bar chart is not working. I attached the files to fix the bug. Also I modified the code of the servlet that it will not sort the data for line chart lxy.

Kind regards,

Olaf

Discussion

  • The changed servlet

     
    Attachments
  • Olaf Meyer
    Olaf Meyer
    2008-02-25

    Logged In: YES
    user_id=2019024
    Originator: NO

    Upps, I forgot to attach the class for the BarLabel:
    /* ======================
    * Eastwood Chart Servlet
    * ======================
    *
    * (C) Copyright 2007, by Object Refinery Limited.
    *
    * Project Info: http://www.jfree.org/eastwood/index.html
    *
    * This program is free software: you can redistribute it and/or modify
    * it under the terms of the GNU Affero General Public License as
    * published by the Free Software Foundation, either version 3 of the
    * License, or (at your option) any later version.
    *
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU Affero General Public License for more details.
    *
    * You should have received a copy of the GNU Affero General Public License
    * along with this program. If not, see <http://www.gnu.org/licenses/>.
    *
    * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
    * in the United States and other countries.]
    *
    * ---------------
    * GValueAxis.java
    * ---------------
    * (C) Copyright 2007, by Object Refinery Limited.
    *
    * Original Author: David Gilbert (for Object Refinery Limited);
    *
    * Changes
    * -------
    * 13-Dec-2007 : Version 1 (DG);
    *
    */

    package org.jfree.eastwood;

    import java.util.List;

    import org.jfree.chart.labels.CategorySeriesLabelGenerator;
    import org.jfree.data.category.CategoryDataset;

    /**
    * A bar label generator that ignores the series keys and just returns
    * the strings specified in the constructor. This is used by the
    * {@link ChartServlet} servlet to emulate the Google Chart API.
    */
    public class GCategorySeriesLabelGenerator implements CategorySeriesLabelGenerator {

    /** Storage for the labels. */
    private List labels;

    /**
    * Creates a new label generator.
    *
    * @param labels a list of labels (<code>null</code> not permitted).
    */
    public GCategorySeriesLabelGenerator(List labels) {
    if (labels == null) {
    throw new IllegalArgumentException("Null 'labels' argument.");
    }
    this.labels = labels;
    }

    /**
    * Returns a string that will be used as the label for the specified
    * series.
    *
    * @param dataset the dataset (ignored here).
    * @param series the series index.
    *
    * @return The label string.
    */
    public String generateLabel(CategoryDataset dataset, int series) {
    Object item = this.labels.get(series);
    if (item != null) {
    return item.toString();
    }
    else {
    return "";
    }
    }

    }

     
  • David Gilbert
    David Gilbert
    2008-06-27

    • assigned_to: nobody --> mungady
     
  • David Gilbert
    David Gilbert
    2008-06-27

    Logged In: YES
    user_id=112975
    Originator: NO

    Do you have an example of a failing chart? I tried looking through your patch, but you've made extensive formatting changes, so I'm finding it hard to see which code you actually modified. I'll come back to this later.

    Regards,

    Dave Gilbert

     
  • David Gilbert
    David Gilbert
    2008-06-27

    Logged In: YES
    user_id=112975
    Originator: NO

    Oh, I think I understand now - the 'chdl' tag isn't working for bar charts. I just committed patch 2002341 which fixes that. Closing this bug.

    Regards,

    Dave Gilbert

     
  • David Gilbert
    David Gilbert
    2008-06-27

    • labels: 1050396 -->
    • milestone: 788247 -->
    • status: open --> closed-fixed