#9 Tooltips For Chart Data Components

All (20)

Would it be possible to implement a mouse listener
such that when a user holds the mouse over a section
of a line on a chart a tooltip pops up to display the
value of the nearest plot point on the chart?

As an extension the tooltips could be configurable to
show other values such as the legend, and the X axis


  • Jason J Simas

    Jason J Simas - 2001-11-30

    Logged In: YES

    I don't know. What's the most lightweight component that I
    can listen for mouse entered/exit events on? It looks to
    be the class, Component. For each point plotted, I'd have
    to create a component that implements the mouse listener
    interface, and it would have to be as small as say 3x3
    pixels. For large data sets with say 300 elements,
    wouldn't this ruin performance? So, it couldn't generally
    be on right?


    LBChar2D chart2D = new LBChart2D (...);
    float[][] dataSets = new float[N][M];
    Rectangle[N][M] chart2D.getGraphBounds();

  • Jason J Simas

    Jason J Simas - 2001-11-30

    Logged In: YES

    Wait, it would be more like. I'd have to have 300
    Components that I call, addMouseListener on, but I would
    pass, one single class to all 300, the listener. The
    listener would have to determine which of the 300 fired the
    event in relation to the data set values (i.e. Component to
    value mapping), paint a small box with the text in it,
    listen for mouse exit events, remove the box.

  • Jason J Simas

    Jason J Simas - 2001-12-05
    • labels: 329314 --> All
    • milestone: --> All
    • assigned_to: nobody --> jjsimas
  • Carl Shelbourne

    Carl Shelbourne - 2001-12-05

    Logged In: YES

    I'm not so sure that it needs to be that complex. Would it
    be possible to provide an API, that say given the X and Y
    co-ordinates of the mouse pointer over a chart, it could
    return back the actual row (X-axis) number nearest to the
    point on the graph.

    We could then show a single tooltip for all the values at
    that row from the data set.

    This would require writing the mouse listener, and a
    tooltip implementation.

    Anybody requiring this functionality, would need to
    implement these classes in whatever class they are writing
    to use the Chart2D functionality.

    If performance is an issue, maybe we could implement this
    as a right click option, where right clicking an area of
    the chart would popup a pane with this info on?

  • Jason J Simas

    Jason J Simas - 2001-12-30
    • summary: Tooltip for the values of the chart --> Tooltips For Chart Data Components
  • Jason J Simas

    Jason J Simas - 2002-01-12
    • priority: 5 --> 1

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks