Recalculate chart only if needed

Chart data is currently recalculated every time the user leaves the Edit tab.
This patch recalculates the chart only if chart-related data has changed on the
Edit tab.