Skip to content

Commit 98f97f0

Browse files
committed
Run view port jobs after applying changes
1 parent 4f77a15 commit 98f97f0

File tree

1 file changed

+11
-8
lines changed
  • MPChartLib/src/main/java/com/github/mikephil/charting/charts

1 file changed

+11
-8
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,20 +1676,23 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
16761676
Log.i(LOG_TAG, "OnSizeChanged()");
16771677

16781678
if (w > 0 && h > 0 && w < 10000 && h < 10000) {
1679-
1680-
mViewPortHandler.setChartDimens(w, h);
1681-
16821679
if (mLogEnabled)
16831680
Log.i(LOG_TAG, "Setting chart dimens, width: " + w + ", height: " + h);
1681+
mViewPortHandler.setChartDimens(w, h);
1682+
} else {
1683+
if (mLogEnabled)
1684+
Log.w(LOG_TAG, "*Avoiding* setting chart dimens! width: " + w + ", height: " + h);
1685+
}
16841686

1685-
for (Runnable r : mJobs) {
1686-
post(r);
1687-
}
1687+
// This may cause the chart view to mutate properties affecting the view port --
1688+
// lets do this before we try to run any pending jobs on the view port itself
1689+
notifyDataSetChanged();
16881690

1689-
mJobs.clear();
1691+
for (Runnable r : mJobs) {
1692+
post(r);
16901693
}
16911694

1692-
notifyDataSetChanged();
1695+
mJobs.clear();
16931696

16941697
super.onSizeChanged(w, h, oldw, oldh);
16951698
}

0 commit comments

Comments
 (0)