View Single Post
  #3   Report Post  
Richard Ahlvin
 
Posts: n/a
Default


"Jon Peltier" wrote in message
...
You can manually hide a legend entry by selecting it (select the legend
first, then the entry, using two single clicks) and pressing Delete. To
get it back you have to delete the entire legend and then add it back.

I have done this for the series I want to always appear. (I have data points
series with legend entrys and an associated line series with no legend
entry; I dynamically change these A-OK.)

You can't automatically adjust the legend based on a formula. You can
filter the data, and any hidden data isn't plotted, either as a series
or as a legend entry. But this isn't automatic either.

This is a viable approach; I have x-y (scatter) plots of some series. I have
been setting the y's to #N/A which makes the series disappear on the plot
but not its legend entry.
Also I can make the legend text disappear by setting its cell null (i.e. "")
but that does not remove the entry, it just removes the text.

You could write a macro which hides and restores the legend based on the
visibility of the series.

This is an approach I could try; But I have not found the chart object; it
appears to be a script and not a VBA object. I think I could figgure it out
in VBA, but I'm not familiar with the scripting (which I thought was
obsolete!) I have been able to copy a complicated chart and change its
source data by making the chart a separate sheet, going to the script, then
using find/replace to change the data sheet name, then move the chart back
to the desired location.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


Richard Ahlvin wrote:

How do I hide/show a series on a chart legend (scatter plot.)
I tried a null string (""), but the trace still shows. I also tried

#N/A.
But it then shows "#N/A"; the same with function: NA(). What I am

trying to
do is to have a control button to show or hide a series from the chart.

I
can set all the series values to #N/A which hides it, but I am having
trouble trying to hide the legend for the series. I also tried an "if"
function in the chart-series dialog, but It evidently will only accept

a
cell pointer.