making a dataset "default off" in SVG plot

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

making a dataset "default off" in SVG plot

Kevin Klein
I am using the SVG output to create interactive plots with multiple
datasets.  Each dataset's visibility can be toggled off by clicking its
corresponding point in the key, but all datasets start out visible by
default.  Is there a way to make datasets start out not visible by default?
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: making a dataset "default off" in SVG plot

Ethan A Merritt-2
On Monday, 06 February 2017 12:00:26 PM Kevin Klein wrote:
> I am using the SVG output to create interactive plots with multiple
> datasets.  Each dataset's visibility can be toggled off by clicking its
> corresponding point in the key, but all datasets start out visible by
> default.  Is there a way to make datasets start out not visible by default?

Not from inside gnuplot, but it would be easy enough to
edit the resulting *.svg file before displaying it.

In the *.svg output file you will find lines like this, one per plot:

<g id="gnuplot_plot_1_keyentry" visibility="visible" onclick="gnuplot_svg.toggleVisibility(evt,'gnuplot_plot_1')">

Change visibility="visible" to visibility="hidden".

        Ethan


--


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: making a dataset "default off" in SVG plot

Ethan A Merritt-2
On Monday, 06 February 2017 10:30:11 AM Ethan A Merritt wrote:

> On Monday, 06 February 2017 12:00:26 PM Kevin Klein wrote:
> > I am using the SVG output to create interactive plots with multiple
> > datasets.  Each dataset's visibility can be toggled off by clicking its
> > corresponding point in the key, but all datasets start out visible by
> > default.  Is there a way to make datasets start out not visible by default?
>
> Not from inside gnuplot, but it would be easy enough to
> edit the resulting *.svg file before displaying it.
>
> In the *.svg output file you will find lines like this, one per plot:
>
> <g id="gnuplot_plot_1_keyentry" visibility="visible" onclick="gnuplot_svg.toggleVisibility(evt,'gnuplot_plot_1')">
>
> Change visibility="visible" to visibility="hidden".

Oops, sorry. I was too quick to answer.

The line you have to change is not the one that says
 
<g id="gnuplot_plot_1_keyentry" ...

That changes the visibility of the key entry itself.
The visibility of the corresponding plot can be changed on a
preceeding line.
 
An example change to hide plot 1 on entry would look like this:

diff -ur simple.svg hide.svg
--- simple.svg  2017-02-06 13:06:19.613753344 -0800
+++ hide.svg    2017-02-06 13:06:00.159755956 -0800
@@ -490,7 +490,7 @@
 </g>
 <g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter">
        <path stroke='black'  d='M62.2,129.1 L62.2,75.1 L220.6,75.1 L220.6,129.1 L62.2,129.1 Z  '/></g>
-       <g id="gnuplot_plot_1"><title>sin(x)</title>
+       <g id="gnuplot_plot_1" visibility="hidden"><title>sin(x)</title>
 <g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter">
        <g id="gnuplot_plot_1_keyentry" visibility="visible" onclick="gnuplot_svg.toggleVisibility(evt,'gnuplot_plot_1')">
        <g transform="translate(161.8,88.0)" stroke="none" fill="black" font-family="Arial" font-size="12.00"  text-anchor="end">


   Ethan


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Loading...