GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Cleanup, preparations for autoScaleMinMax fix · FlyingAndroid/MPAndroidChart@62bc0de

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • MPChartLib/src/main/java/com/github/mikephil/charting/data
    • ChartData.java
    • CombinedData.java
    • PieData.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java‎

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java
+17-14Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public ChartData() {
6868
*/
6969
public ChartData(T... dataSets) {
7070
mDataSets = arrayToList(dataSets);
71-
init();
71+
notifyDataChanged();
7272
}
7373

7474
/**
@@ -95,15 +95,7 @@ private List<T> arrayToList(T[] array) {
9595
*/
9696
public ChartData(List<T> sets) {
9797
this.mDataSets = sets;
98-
init();
99-
}
100-
101-
/**
102-
* performs all kinds of initialization calculations, such as min-max and
103-
* value count and sum
104-
*/
105-
protected void init() {
106-
calcMinMax();
98+
notifyDataChanged();
10799
}
108100

109101
/**
@@ -112,11 +104,11 @@ protected void init() {
112104
* the contained data has changed.
113105
*/
114106
public void notifyDataChanged() {
115-
init();
107+
calcMinMax();
116108
}
117109

118110
/**
119-
* calc minimum and maximum values (both x and y) over all DataSets
111+
* Calc minimum and maximum values (both x and y) over all DataSets.
120112
*/
121113
public void calcMinMax() {
122114

@@ -145,7 +137,7 @@ public void calcMinMax() {
145137
mLeftAxisMax = firstLeft.getYMax();
146138
mLeftAxisMin = firstLeft.getYMin();
147139

148-
for (IDataSet dataSet : mDataSets) {
140+
for (T dataSet : mDataSets) {
149141
if (dataSet.getAxisDependency() == AxisDependency.LEFT) {
150142
if (dataSet.getYMin() < mLeftAxisMin)
151143
mLeftAxisMin = dataSet.getYMin();
@@ -164,7 +156,7 @@ public void calcMinMax() {
164156
mRightAxisMax = firstRight.getYMax();
165157
mRightAxisMin = firstRight.getYMin();
166158

167-
for (IDataSet dataSet : mDataSets) {
159+
for (T dataSet : mDataSets) {
168160
if (dataSet.getAxisDependency() == AxisDependency.RIGHT) {
169161
if (dataSet.getYMin() < mRightAxisMin)
170162
mRightAxisMin = dataSet.getYMin();
@@ -436,6 +428,12 @@ public void addEntry(Entry e, int dataSetIndex) {
436428
}
437429
}
438430

431+
/**
432+
* Adjusts the current minimum and maximum values based on the provided Entry object.
433+
*
434+
* @param e
435+
* @param axis
436+
*/
439437
protected void calcMinMax(Entry e, AxisDependency axis) {
440438

441439
if (mYMax < e.getY())
@@ -462,6 +460,11 @@ protected void calcMinMax(Entry e, AxisDependency axis) {
462460
}
463461
}
464462

463+
/**
464+
* Adjusts the minimum and maximum values based on the given DataSet.
465+
*
466+
* @param d
467+
*/
465468
protected void calcMinMax(T d) {
466469

467470
if (mYMax < d.getYMax())
Collapse file

‎MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java‎

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,27 @@ public CombinedData() {
2929

3030
public void setData(LineData data) {
3131
mLineData = data;
32-
init();
32+
notifyDataChanged();
3333
}
3434

3535
public void setData(BarData data) {
3636
mBarData = data;
37-
init();
37+
notifyDataChanged();
3838
}
3939

4040
public void setData(ScatterData data) {
4141
mScatterData = data;
42-
init();
42+
notifyDataChanged();
4343
}
4444

4545
public void setData(CandleData data) {
4646
mCandleData = data;
47-
init();
47+
notifyDataChanged();
4848
}
4949

5050
public void setData(BubbleData data) {
5151
mBubbleData = data;
52-
init();
52+
notifyDataChanged();
5353
}
5454

5555
@Override
@@ -104,7 +104,6 @@ public void calcMinMax() {
104104
mRightAxisMin = data.mRightAxisMin;
105105

106106
}
107-
108107
}
109108

110109
public BubbleData getBubbleData() {
@@ -166,7 +165,7 @@ public void notifyDataChanged() {
166165
if (mBubbleData != null)
167166
mBubbleData.notifyDataChanged();
168167

169-
init(); // recalculate everything
168+
calcMinMax(); // recalculate everything
170169
}
171170

172171
/**
Collapse file

‎MPChartLib/src/main/java/com/github/mikephil/charting/data/PieData.java‎

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/data/PieData.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public PieData(IPieDataSet dataSet) {
3333
public void setDataSet(IPieDataSet dataSet) {
3434
mDataSets.clear();
3535
mDataSets.add(dataSet);
36-
init();
36+
notifyDataChanged();
3737
}
3838

3939
/**

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.