Menu

#125 Make clickable graphics possible

closed-out-of-date
nobody
None
5
2008-01-26
2005-11-18
P.Marek
No

First of all let me say that I'm impressed by the
changes done from gnuplot 3 to 4. Especially the mouse
control in the plot window is very much appreciated.

I'd like to generate graphics for a web page with
gnuplot. For that I'd need some elements (eg. axis
ticks) clickable, so that I can "zoom" or rearrange the
data.

The obvious target for that is SVG, as that includes
the possibility to define links; but if that could be
done for PNG too (perhaps with a new command like
"export click maps") I'd be very glad.

Thank you!

Regards,

Phil

Discussion

  • Petr Mikulik

    Petr Mikulik - 2005-11-24

    Logged In: YES
    user_id=31505

    I think there are external tools for making clickable web
    graphic maps.

    You cantry yourself to work out a clickable interface -- use
    the "bind" command to define you own hotkeys on an
    interactive terminal and produce an appropriate label or
    whatever you need to paste in the final output file.

     
  • P.Marek

    P.Marek - 2005-11-24

    Logged In: YES
    user_id=740781

    Well, the problem with external tools is that they basically
    have to derive the "clickable" positions somehow.

    Eg. take a simple graph - some points over some time
    interval, say weeks.
    If I now want to make the weeks (the labels on the x-axis)
    clickable and show details for this week - how does an
    external program find out which week is where?

    Given SVG output it might be possible - with good algorithms
    to distinguish y-axis labels from x-axis labels from other
    labels ....

    With an PNG that leads to an OCR run (on possibly 90° turned
    strings) or a complete re-engineering of the dimension,
    orientation, and positioning of the plot - at which point
    the program itself could simply put out some SVG statements ...

    What I'd like is to have some syntax to specify URLs for
    single elements, and, possibly, a terminal-related call for
    exporting a CMAP or whatever (for the cases where a bitmap
    is exported. SVG can have the links inline).

    Regards,

    Phil

     
  • Petr Mikulik

    Petr Mikulik - 2005-11-24

    Logged In: YES
    user_id=31505

    The discussion should separate into these parts:
    - clickable positions, driven from an external program --
    easy (like ginput function in Octave/Matlab)
    - png clickable maps in html -- easy, there are external
    tools for this
    - svg interactive maps: you seem to know a lot about this,
    so you can probably find an appropriate implementation; you
    can use some postprocessing by javascript or php from what
    gnuplot returns

     
  • P.Marek

    P.Marek - 2005-11-24

    Logged In: YES
    user_id=740781

    1) I don't know about ginput and Matlab. Could you please
    explain what you mean here?

    2) Making maps for eg PNG is easy - *if you know the
    coordinates*.
    And a simple script piping into gnuplot doesn't.

    3) Postprocessing a SVG would be possible (but not nice), if
    there was an easy way to distinguish the various strings and
    elements.
    Currently all I get from gnuplot is a SVG with lots of
    <g transform="translate(316,466)"
    style="..."><text>...</text>.
    There's no information if that's on the x-axis, the y-axis,
    a custom label, a data label, legend or whatever.

    It would be enough (but still not the Best Way) to include
    specific IDs in the SVG (if that's at all possible; I know
    SVG from opening generated files :-):
    <g id="axis-x-0" ...>
    <g id="axis-x-1" ...>
    <g id="axis-x-2" ...>
    <g id="axis-y-0" ...>
    <g id="axis-y-1" ...>
    <g id="axis-y-2" ...>
    <g id="custom-0" ...>
    <g id="legend-0" ...>
    and so on.
    Then a script could (with reasonable expense) parse the SVG
    and change it.

    Of course, in the long run I'd find it best if there was
    something like
    set format x "week %d" URL "http://server/url?data=%d"
    which would output automatically for svg, ps, and pdf, and
    which had another command for outputting maps, like graphviz.

     
  • Petr Mikulik

    Petr Mikulik - 2005-11-24

    Logged In: YES
    user_id=31505

    1) A program (Octave, python, your C, ...) can interact with
    gnuplot through a pipe, and it can also read mouse
    coordinates. See gnuplot web page for more info (section
    "bidirectional communication").

    2) You know the coordinates if it's you who are generating a
    map for a specified xrange and yrange.

    3) You can put your own "set label" at some specific
    positions wherefrom you can extract coordinates.

     
  • P.Marek

    P.Marek - 2005-11-25

    Logged In: YES
    user_id=740781

    Sorry, I do not seem to make myself clear.
    But I'll try again. (Thanks for your patience !)

    I have a webpage, with cgi/php/whatever on the server.
    The backend generates a graphic (bugs per week, if you
    like), and displays it on the browser of the user.

    The user shall now be able to click on the data-points
    and/or the x-axis-labels to "zoom" a week and show details.

    Making the graph is easy. Just do a "SELECT count(id) FROM
    bugs ORDER BY week;", put that with a bit of text header on
    STDIN of gnuplot, and the graphic is finished.

    Now I can display something - but I don't know where the
    points and labels on the graphic are.
    To know that I'd have to calculate positions from size of
    graphic, fontsize, minimum and maximum values of the axes,
    etc., and when that is done I wouldn't need gnuplot anymore,
    I'd already have done the graph myself.

    So I'd just put a line of header more, eg.
    set format x "week %d" URL "http://server/url?data=%d"
    and be done, as the URL would automatically be used in SVG,
    and for PNG/GIF there could be another command to export the
    map.

     
  • Hans-Bernhard Broeker

    Logged In: YES
    user_id=27517

    @P.Marek: A good part of the confusion between is caused by
    terminology differences.

    To put what you want in a more gnuplot-like context, what
    you want is sort-of an implementation of the mouse
    interaction interface for file output terminal drivers.

    I.e. similar to the feature that lets the GUI terminal
    drivers interactively display the data coordinates of points
    as the mouse is moved around, the file output drivers could
    export the same information (basically xleft, xright, ...)
    to a separate file, or as comment records in in their
    ordinary output files.

    There's been a patch proposing something like this for GIF,
    long ago, but I rejected that, IIRC because its
    implementation was too much at odds with gnuplot's internal
    structure. It was called 'coordinate transforms information
    export' or somehting like that. Good luck finding it in the
    tracker pages...

     
  • Ethan Merritt

    Ethan Merritt - 2008-01-11

    Logged In: YES
    user_id=235620
    Originator: NO

    Half of this request is, I think, satisfied by recent additions to CVS that export the axis coordinate mapping of the current plot on the current terminal to GPVAL_TERM_XMIN GPVAL_TERM_XMAX and so on.

    The other half is at least potentially addressed by Patch #1866413 "Demarcate plots to allow post-processing". Check out the sample SVG plot with live links attached to individual plot elements.

     
  • Ethan Merritt

    Ethan Merritt - 2008-01-11
    • status: open --> pending-out-of-date
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending-out-of-date --> closed-out-of-date
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.