[pstricks] mouseover/tooltip in a plot
Alexander Grahn
A.Grahn at fzd.de
Mon Dec 1 14:30:03 CET 2008
Sebastian,
On Fri, Nov 28, 2008 at 09:50:42PM +0100, Juergen Gilg wrote:
> Sebastian Preuß wrote:
>>
>> i plot graphics sometimes grphics with pstricks.
>> That works fine.
>> Now i'm trying to set tooltips for every datapoint.
>> So the user see a defined value if he stop the mouse over the point.
>>
>>
> Hi Sebastian,
>
> attached is a simple example with a _Mouseover Event_, activating an
> Optional Content Group (OCG or layer).
> The coordinates of a point are shown when mousing over. This is not a
> Tooltip -- this is even a more sophisticated workaround of a tooltip, where
> you can let appear some LaTeX code within this OCG.
>
> However there is *aeb_pro* needed and the workflow is:
>
> LaTeX --> dvips --> DISTILLER --> Acrobat Pro 7++
>
> to generate the attached PDF.
>
> Adobe Reader 7++ is necessary to view it, cause a PDF viewer is needed,
> that can handle the implemented JavaScript.
If you feel that a simple ascii-text tooltip will do as well, you could
try this (Distiller/AcroPro _not_ required):
\documentclass{article}
\usepackage{pstricks-add}
\usepackage{hyperref}
\newcounter{tooltip}
\newcommand\tooltip[2]{%
% arg #1: text to put on the page
% arg #2: tooltip text
\pdfmark[#1]{
pdfmark=/ANN,
Subtype=/Widget,
Raw={
/TU (#2)/T (tooltip \thetooltip)
/FT/Btn/Ff 65536/H/N
}
}%
\stepcounter{tooltip}%
}
\begin{document}
\begin{center}
\begin{pspicture}(-2,-2)(2,2)
\psaxes(0,0)(-2,-2)(2,2)
\rput(1,1){{\tooltip{$\bullet$}{1,1}}}
\rput(-1,-1){{\tooltip{$\bullet$}{-1,-1}}}
\end{pspicture}
\end{center}
\end{document}
Alexander
PS (to Juergen):
So far, I haven't managed to make parts of the page content optional using pdfmarks and Ghostscript.
More information about the PSTricks
mailing list