Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Tooltip with linechart getting data from BD!

Help
Sikander
2006-09-27
2013-01-13
  • Sikander
    Sikander
    2006-09-27

    Hi All,

    I'm trying to put values using tooltip feature, but it doesn't work... I found no example with tooltip getting values from database...

    My code is like:

    ps = conexao.prepareStatement(query);
                      rs = ps.executeQuery();

                      while (rs.next())
                      {
                      // Inserindo no DataSet a data_hora_gravacao e o tempo de processamento.
                                        dataset.addValue(rs.getInt(1),rs.getString(2),rs.getString(3));
                      }
                 }
                 catch (SQLException e) {
                 log.debug(e);
          }

           return dataset;
        }

    /**Inner Class to generate tool tips for  data.*/
            CategoryToolTipGenerator TG = new CategoryToolTipGenerator() {
                      public String generateToolTip(CategoryDataset dataset, int arg1, int arg2) {
        return String.valueOf(dataset.getValue(arg2));
                    }
            };
            public CategoryToolTipGenerator getTG() {
                 return this.TG;
            }
    ...
    ##############################################
    I'm getting only an error with variable dataset...

    I would like to put the value of my Y axis on each shape ploted where data came on "dataset.addValue(rs.getInt(1)"

    Is there any way to do this? I'm using line chart...

    Thanks
    Sikander ram