TransWikia.com

Interactive point tooltip still active on pgfplot when status updated by ocg to invisible

TeX - LaTeX Asked by alican yildiz on June 17, 2021

My problem is as below. I have pdf report which i want to use it with ocg to display when needed. There are many plot which has clickable point option and plotted by pgfplot library. These plots are able to show/hide by ocg supported buttons and also as i said before they are clickable and snap option activated.

The problem is starting when i want to click point to check value on it. Here you can see even if curve is invisible clicked point snaping if it’s in range of snap.

For example in below code i was clicked wave2 button to hide ‘wave2’ then clicked to about 15,15 point on graph and it still snap it like wave2 still visible. I understand it snap point has an argument as exact point: x-Value,y-Value.

Below the wave2 is active if i click wave2 curve’s point popup is normal because of visibilty status.
enter image description here

But here if i click wave2 curve’s point it still popup like wave2 visibile.
enter image description here

So, is there a way to disable snaping according to status of visiblity of curve ?

Below you can see the full code;

documentclass{report}
usepackage[tikz]{ocgx2}
usetikzlibrary{backgrounds,calc,shadows,chains,shapes.geometric}
usetikzlibrary{fit}
usetikzlibrary{matrix}
usetikzlibrary{arrows,patterns}
usepackage[utf8]{inputenc}
usepackage[english]{babel}
usepackage[ddmmyyyy,hhmmss]{datetime}
usepackage{titlesec}
renewcommand{dateseparator}{.}

usepackage{abstract}
renewcommand{abstractnamefont}{normalfontLargebfseries}
renewcommand{absnamepos}{flushleft}
setlength{absleftindent}{0pt}
setlength{absrightindent}{0pt}

%titleformat{chapter}[display]normalfontbfseries}{thechapter.}{0pt}{Huge}
titleformat{chapter}{normalfonthugebf}{thechapter.}{20pt}{Hugebf}

pagenumbering{roman}
setcounter{section}{0}
setcounter{secnumdepth}{4}
setcounter{tocdepth}{4}

usepackage[hidelinks]{hyperref}
hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

usepackage{pgfplotstable,pgfplots}
pgfplotsset{width=7cm,compat=1.17}
usepgfplotslibrary{clickable}

tikzset{%
  button on/.style={%
    draw,minimum size=5mm,
    line width=1pt,
    fill=blue!50,rounded corners,
    switch ocg with mark off={#1}{},
  },
}

begin{document}
tableofcontents
newpage
begin{abstract}
Some text...
end{abstract}

pagenumbering{arabic}
newpage
setcounter{page}{1}

chapter{Genel Parametreler}
More text...

chapter{Uygulanan Testler}
asd
section{Burn In Testleri}
asd
subsection{Burn-In 1}
asd
subsubsection{asdasd}
begin{figure}
begin{tikzpicture}
begin{axis}
    [% options
    xmin=0, xmax=25,
    ymin=0, ymax=100,
    width = linewidth,
    xlabel=$x$,
    ylabel={$y$},
    annot/snap dist=5,
    clickable coords size = {8,5}, % size in characters for the snapping pop ups
    annot/popup size generic = {8,5}, % size in characters  for the rest
    annot/point format/.initial={(%.1f, %.1f)},
    scatter/classes={a={mark=*,red!100}, b={mark=*,blue!100}},
    cycle list name=color list
    ]
begin{scope}[ocg={name=Wawe1 example,ref=Wawe1,status=invisible}]
addplot
    [% options 
    scatter,smooth, scatter src=explicit symbolic,clickable coords = {exact coords: <br/> (xy)}, mark size = 1pt
    ] 
    coordinates 
    {
    (0,0)[a]
    (10,9.8)[a]
    (5,5)[a]
    (9,9)[a]
    };
end{scope}
begin{scope}[ocg={name=Wawe2 example,ref=Wawe2,status=invisible}]
addplot
    [% options 
    scatter,smooth, scatter src=explicit symbolic, clickable coords = {exact coords: <br/> (xy)}, mark size = 1pt
    ] 
    coordinates 
    {
    (10,10)[b]
    (12,12)[b]
    (15,15)[b]
    (13,7)[b]
    };   
end{scope}
end{axis}
node[button on=Wawe1]at (-2,8)(but){};
node[right=0 of but]{Wawe1};
node[below=3pt of but,button on=Wawe2](but){};
node[right=0 of but]{Wawe2};
end{tikzpicture}
end{figure}
subsubsection{asdas2d}
asdasd


end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP