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 — Improve setColors methods, cleanup · FlyingAndroid/MPAndroidChart@3f0f3a8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • MPChartExample/src/com/xxmassdeveloper/mpchartexample
    • LineChartActivity2.java
  • MPChartLib/src/main/java/com/github/mikephil/charting
    • data
      • BaseDataSet.java
      • LineDataSet.java
    • utils
      • FSize.java
      • Transformer.java
      • TransformerHorizontalBarChart.java
      • Utils.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity2.java‎

Copy file name to clipboardExpand all lines: MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivity2.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ protected void onCreate(Bundle savedInstanceState) {
5858

5959
mChart = (LineChart) findViewById(R.id.chart1);
6060
mChart.setOnChartValueSelectedListener(this);
61-
mChart.setLogEnabled(true);
6261

6362
// no description text
6463
mChart.setDescription("");
Collapse file

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

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseDataSet.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void setColors(List<Integer> colors) {
150150
*
151151
* @param colors
152152
*/
153-
public void setColors(int[] colors) {
153+
public void setColors(int... colors) {
154154
this.mColors = ColorTemplate.createColors(colors);
155155
}
156156

Collapse file

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

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/data/LineDataSet.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public void setCircleColors(List<Integer> colors) {
298298
*
299299
* @param colors
300300
*/
301-
public void setCircleColors(int[] colors) {
301+
public void setCircleColors(int... colors) {
302302
this.mCircleColors = ColorTemplate.createColors(colors);
303303
}
304304

Collapse file

‎MPChartLib/src/main/java/com/github/mikephil/charting/utils/FSize.java‎

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/utils/FSize.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,4 @@ public String toString() {
7373
public int hashCode() {
7474
return Float.floatToIntBits(width) ^ Float.floatToIntBits(height);
7575
}
76-
7776
}
Collapse file

‎MPChartLib/src/main/java/com/github/mikephil/charting/utils/Transformer.java‎

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/utils/Transformer.java
+16-18Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,10 @@ public void prepareMatrixOffset(boolean inverted) {
8484
.setTranslate(mViewPortHandler.offsetLeft(), -mViewPortHandler.offsetTop());
8585
mMatrixOffset.postScale(1.0f, -1.0f);
8686
}
87-
88-
// mMatrixOffset.set(offset);
89-
90-
// mMatrixOffset.reset();
91-
//
92-
// mMatrixOffset.postTranslate(mOffsetLeft, getHeight() -
93-
// mOffsetBottom);
9487
}
9588

9689
protected float[] valuePointsForGenerateTransformedValuesScatter = new float[1];
90+
9791
/**
9892
* Transforms an List of Entry into a float array containing the x and
9993
* y values transformed with all matrices for the SCATTERCHART.
@@ -106,7 +100,7 @@ public float[] generateTransformedValuesScatter(IScatterDataSet data, float phas
106100

107101
final int count = (int) ((to - from) * phaseX + 1) * 2;
108102

109-
if(valuePointsForGenerateTransformedValuesScatter.length != count){
103+
if (valuePointsForGenerateTransformedValuesScatter.length != count) {
110104
valuePointsForGenerateTransformedValuesScatter = new float[count];
111105
}
112106
float[] valuePoints = valuePointsForGenerateTransformedValuesScatter;
@@ -118,7 +112,7 @@ public float[] generateTransformedValuesScatter(IScatterDataSet data, float phas
118112
if (e != null) {
119113
valuePoints[j] = e.getX();
120114
valuePoints[j + 1] = e.getY() * phaseY;
121-
}else{
115+
} else {
122116
valuePoints[j] = 0;
123117
valuePoints[j + 1] = 0;
124118
}
@@ -130,6 +124,7 @@ public float[] generateTransformedValuesScatter(IScatterDataSet data, float phas
130124
}
131125

132126
protected float[] valuePointsForGenerateTransformedValuesBubble = new float[1];
127+
133128
/**
134129
* Transforms an List of Entry into a float array containing the x and
135130
* y values transformed with all matrices for the BUBBLECHART.
@@ -141,7 +136,7 @@ public float[] generateTransformedValuesBubble(IBubbleDataSet data, float phaseY
141136

142137
final int count = (to - from + 1) * 2; // (int) Math.ceil((to - from) * phaseX) * 2;
143138

144-
if(valuePointsForGenerateTransformedValuesBubble.length != count){
139+
if (valuePointsForGenerateTransformedValuesBubble.length != count) {
145140
valuePointsForGenerateTransformedValuesBubble = new float[count];
146141
}
147142
float[] valuePoints = valuePointsForGenerateTransformedValuesBubble;
@@ -153,7 +148,7 @@ public float[] generateTransformedValuesBubble(IBubbleDataSet data, float phaseY
153148
if (e != null) {
154149
valuePoints[j] = e.getX();
155150
valuePoints[j + 1] = e.getY() * phaseY;
156-
}else{
151+
} else {
157152
valuePoints[j] = 0;
158153
valuePoints[j + 1] = 0;
159154
}
@@ -165,6 +160,7 @@ public float[] generateTransformedValuesBubble(IBubbleDataSet data, float phaseY
165160
}
166161

167162
protected float[] valuePointsForGenerateTransformedValuesLine = new float[1];
163+
168164
/**
169165
* Transforms an List of Entry into a float array containing the x and
170166
* y values transformed with all matrices for the LINECHART.
@@ -177,7 +173,7 @@ public float[] generateTransformedValuesLine(ILineDataSet data,
177173

178174
final int count = (int) ((to - from) * phaseX + 1) * 2;
179175

180-
if(valuePointsForGenerateTransformedValuesLine.length != count){
176+
if (valuePointsForGenerateTransformedValuesLine.length != count) {
181177
valuePointsForGenerateTransformedValuesLine = new float[count];
182178
}
183179
float[] valuePoints = valuePointsForGenerateTransformedValuesLine;
@@ -189,7 +185,7 @@ public float[] generateTransformedValuesLine(ILineDataSet data,
189185
if (e != null) {
190186
valuePoints[j] = e.getX();
191187
valuePoints[j + 1] = e.getY() * phaseY;
192-
}else{
188+
} else {
193189
valuePoints[j] = 0;
194190
valuePoints[j + 1] = 0;
195191
}
@@ -201,6 +197,7 @@ public float[] generateTransformedValuesLine(ILineDataSet data,
201197
}
202198

203199
protected float[] valuePointsForGenerateTransformedValuesCandle = new float[1];
200+
204201
/**
205202
* Transforms an List of Entry into a float array containing the x and
206203
* y values transformed with all matrices for the CANDLESTICKCHART.
@@ -213,7 +210,7 @@ public float[] generateTransformedValuesCandle(ICandleDataSet data,
213210

214211
final int count = (int) ((to - from) * phaseX + 1) * 2;
215212

216-
if(valuePointsForGenerateTransformedValuesCandle.length != count){
213+
if (valuePointsForGenerateTransformedValuesCandle.length != count) {
217214
valuePointsForGenerateTransformedValuesCandle = new float[count];
218215
}
219216
float[] valuePoints = valuePointsForGenerateTransformedValuesCandle;
@@ -225,7 +222,7 @@ public float[] generateTransformedValuesCandle(ICandleDataSet data,
225222
if (e != null) {
226223
valuePoints[j] = e.getX();
227224
valuePoints[j + 1] = e.getHigh() * phaseY;
228-
}else{
225+
} else {
229226
valuePoints[j] = 0;
230227
valuePoints[j + 1] = 0;
231228
}
@@ -357,6 +354,7 @@ public void rectValuesToPixel(List<RectF> rects) {
357354
}
358355

359356
protected Matrix mPixelsToValueMatrixBuffer = new Matrix();
357+
360358
/**
361359
* Transforms the given array of touch positions (pixels) (x, y, x, y, ...)
362360
* into values on the chart.
@@ -397,12 +395,12 @@ public void pixelsToValue(float[] pixels) {
397395
*/
398396
public MPPointD getValuesByTouchPoint(float x, float y) {
399397

400-
MPPointD result = MPPointD.getInstance(0,0);
401-
getValuesByTouchPoint(x,y,result);
398+
MPPointD result = MPPointD.getInstance(0, 0);
399+
getValuesByTouchPoint(x, y, result);
402400
return result;
403401
}
404402

405-
public void getValuesByTouchPoint(float x, float y, MPPointD outputPoint){
403+
public void getValuesByTouchPoint(float x, float y, MPPointD outputPoint) {
406404

407405
ptsBuffer[0] = x;
408406
ptsBuffer[1] = y;
Collapse file

‎MPChartLib/src/main/java/com/github/mikephil/charting/utils/TransformerHorizontalBarChart.java‎

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/utils/TransformerHorizontalBarChart.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public TransformerHorizontalBarChart(ViewPortHandler viewPortHandler) {
1515
/**
1616
* Prepares the matrix that contains all offsets.
1717
*
18-
* @param chart
18+
* @param inverted
1919
*/
2020
public void prepareMatrixOffset(boolean inverted) {
2121

Collapse file

‎MPChartLib/src/main/java/com/github/mikephil/charting/utils/Utils.java‎

Copy file name to clipboardExpand all lines: MPChartLib/src/main/java/com/github/mikephil/charting/utils/Utils.java
-27Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import android.content.res.Resources;
77
import android.graphics.Canvas;
88
import android.graphics.Paint;
9-
import android.graphics.PointF;
109
import android.graphics.Rect;
1110
import android.os.Build;
1211
import android.text.Layout;
@@ -728,30 +727,4 @@ public static FSize getSizeOfRotatedRectangleByRadians(float rectangleWidth, flo
728727
public static int getSDKInt() {
729728
return android.os.Build.VERSION.SDK_INT;
730729
}
731-
732-
/**
733-
* Calculates the granularity (minimum axis interval) based on axis range and labelcount.
734-
* Default granularity is 1/10th of interval.
735-
*
736-
* @param range
737-
* @param labelCount
738-
* @return
739-
*/
740-
public static double granularity(float range, int labelCount) {
741-
742-
// Find out how much spacing (in y value space) between axis values
743-
double rawInterval = range / labelCount;
744-
double interval = Utils.roundToNextSignificant(rawInterval);
745-
746-
// Normalize interval
747-
double intervalMagnitude = Utils.roundToNextSignificant(Math.pow(10, (int) Math.log10
748-
(interval)));
749-
int intervalSigDigit = (int) (interval / intervalMagnitude);
750-
751-
if (intervalSigDigit > 5) {
752-
interval = Math.floor(10 * intervalMagnitude);
753-
}
754-
755-
return interval * 0.1; // granularity is 1/10th of interval
756-
}
757730
}

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.