Bug 1359961 - pmchart plots disappear when legend is turned off and back on again
Summary: pmchart plots disappear when legend is turned off and back on again
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcp
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Dave Brolley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-26 01:12 UTC by Mark Goodwin
Modified: 2017-06-09 19:02 UTC (History)
7 users (show)

Fixed In Version: pcp-3.11.9-1.fc24 pcp-3.11.10-1.fc26
Clone Of:
Environment:
Last Closed: 2017-06-09 19:02:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mark Goodwin 2016-07-26 01:12:28 UTC
Description of problem: pmchart plots disappear when legend is turned off and back on again using the Edit/chart dialog

Version-Release number of selected component (if applicable): pcp-3.11.3-1 / F24

How reproducible: easily

Steps to Reproduce:
1. pmchart -c Loadavg
2. Edit/Chart
3. Disable legend, Apply, Enable legend, Apply

Actual results: all plots disappear for the current chart

Expected results: legend re-enabled without loss of any plots!

Comment 1 Dave Brolley 2017-03-27 19:57:27 UTC
Here is a patch which fixes this problem. Reversed boolean logic was making the plots disappear when they were still visible. Seems like an obvious fix.

However, I'm wondering why this loop and replot are necessary at all. There is no similar check and replot when the legend is turned off. Removing this entire loop and the call to replot() also fixes this problem.

----------------------------------------------------------

diff --git a/src/pmchart/chart.cpp b/src/pmchart/chart.cpp
index f6b92a4..6a1f974 100644
--- a/src/pmchart/chart.cpp
+++ b/src/pmchart/chart.cpp
@@ -890,7 +890,7 @@ Chart::setLegendVisible(bool on)
            // force each Legend item to "checked" state matching
            // the initial plotting state
            for (int i = 0; i < my.items.size(); i++)
-               my.items[i]->item()->setVisible(my.items[i]->removed());
+               my.items[i]->item()->setVisible(!my.items[i]->removed());
            replot();
        }
     }

Comment 2 Dave Brolley 2017-03-27 20:51:08 UTC
Here's a possible reason for this check when restoring the legend.

If you click on a metric in the legend, you can toggle the plotting of that metric on and off. If you remove the legend while a metric is "off", it remains "off" if you later restore the legend. However the new legend is literally newly created and thinks that the metric is "on".

Including this loop and replot restores all active metrics to the "on" state in the plot.

Comment 3 Dave Brolley 2017-03-27 20:58:43 UTC
The original patch is now available as
 commit 7b23667da3449cf7adbbfcc83bff678f914054cc at
 git://git.pcp.io/brolley/pcp.git rhbz1359961

Comment 4 Fedora Update System 2017-04-02 05:13:10 UTC
pcp-3.11.9-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-aca0a468b4

Comment 5 Fedora Update System 2017-04-02 05:14:56 UTC
pcp-3.11.9-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-def05eeac1

Comment 6 Fedora Update System 2017-04-02 05:15:34 UTC
pcp-3.11.9-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c6c3616693

Comment 7 Fedora Update System 2017-04-03 02:21:36 UTC
pcp-3.11.9-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-c6c3616693

Comment 8 Fedora Update System 2017-04-03 02:22:02 UTC
pcp-3.11.9-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-def05eeac1

Comment 9 Fedora Update System 2017-04-03 03:53:15 UTC
pcp-3.11.9-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-aca0a468b4

Comment 10 Fedora Update System 2017-04-10 21:20:38 UTC
pcp-3.11.9-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2017-04-11 04:51:10 UTC
pcp-3.11.9-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2017-05-18 16:31:00 UTC
pcp-3.11.10-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c0a1605df5

Comment 13 Fedora Update System 2017-05-19 21:10:10 UTC
pcp-3.11.10-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-c0a1605df5

Comment 14 Fedora Update System 2017-06-09 19:02:31 UTC
pcp-3.11.10-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.