Mercurial > jwe > octave
changeset 24464:359596cc55dd
Fix ordering of legend objects when updated via callback (bug #46835).
* legend.m (cb_legend_update): Don't use __getlegenddata__ to find list of
graphics objects to label and text strings to display because that function
does not return an ordered list. Instead, get this information directly
from legend object.
* legend.m (cb_line_listener): When re-building legend because "DisplayName"
has changed, use the first handle associated with the legend object in case
this is a plotyy object with two axes.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 26 Dec 2017 09:51:54 -0800 |
parents | b1ae8fe2ee00 |
children | 1b4c4d6ead56 |
files | scripts/plot/appearance/legend.m |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m Tue Dec 26 08:10:49 2017 -0800 +++ b/scripts/plot/appearance/legend.m Tue Dec 26 09:51:54 2017 -0800 @@ -1124,7 +1124,9 @@ recursive = true; unwind_protect hax = getfield (get (hleg, "userdata"), "handle"); - [hplots, ~] = __getlegenddata__ (hleg); + ## Hack. Maybe store this somewhere else such as appdata. + hplots = [ get(hleg, "deletefcn"){6:end} ]; + text_strings = get (hleg, "string"); position = get (hleg, "unmodified_axes_position"); outerposition = get (hleg, "unmodified_axes_outerposition"); units = get (hax, "units"); @@ -1143,7 +1145,7 @@ set (hax, {"units"}, units); endif - hleg = legend (hax(1), hplots, get (hleg, "string")); + hleg = legend (hax(1), hplots, text_strings); unwind_protect_cleanup recursive = false; end_unwind_protect @@ -1270,7 +1272,7 @@ if (isempty (hplots)) delete (hlegend); else - legend (legdata.handle, hplots, text_strings); + legend (legdata.handle(1), hplots, text_strings); endif else kids = get (hlegend, "children"); @@ -1797,5 +1799,3 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect - -