diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java index 204dc1fe64..e8af4cacdb 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java @@ -93,7 +93,7 @@ protected void onCreate(Bundle savedInstanceState) { xAxis.setCenterAxisLabels(true); xAxis.setValueFormatter(new IAxisValueFormatter() { @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return String.valueOf((int) value); } }); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java index 7d6bd44896..008e3e570b 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java @@ -87,7 +87,7 @@ protected void onCreate(Bundle savedInstanceState) { xAxis.setValueFormatter(new IAxisValueFormatter() { @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return data.get(Math.min(Math.max((int) value, 0), data.size()-1)).xAxisValue; } }); @@ -166,7 +166,7 @@ public ValueFormatter() { } @Override - public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { + public String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return mFormat.format(value); } } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java index e4d8fb2e3b..7acbe20cf1 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java @@ -81,7 +81,7 @@ protected void onCreate(Bundle savedInstanceState) { xAxis.setGranularity(1f); xAxis.setValueFormatter(new IAxisValueFormatter() { @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return mMonths[(int) value % mMonths.length]; } }); @@ -95,7 +95,7 @@ public String getFormattedValue(float value, AxisBase axis) { data.setData(generateCandleData()); data.setValueTypeface(mTfLight); - xAxis.setAxisMaximum(data.getXMax() + 0.25f); + xAxis.setAxisMaximum(data.getXMax() + 0.25d); mChart.setData(data); mChart.invalidate(); @@ -136,7 +136,7 @@ private BarData generateBarData() { entries1.add(new BarEntry(0, getRandom(25, 25))); // stacked - entries2.add(new BarEntry(0, new float[]{getRandom(13, 12), getRandom(13, 12)})); + entries2.add(new BarEntry(0, new double[]{getRandom(13, 12), getRandom(13, 12)})); } BarDataSet set1 = new BarDataSet(entries1, "Bar 1"); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java index 4a278c398e..b759c3d48a 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/CubicLineChartActivity.java @@ -296,7 +296,7 @@ private void setData(int count, float range) { set1.setDrawHorizontalHighlightIndicator(false); set1.setFillFormatter(new IFillFormatter() { @Override - public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { + public double getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { return -10; } }); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java index 9109d5d29c..3b46faf838 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java @@ -111,7 +111,7 @@ private void setData(int count, float range) { set1.setDrawCircleHole(false); set1.setFillFormatter(new IFillFormatter() { @Override - public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { + public double getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { return mChart.getAxisLeft().getAxisMinimum(); } }); @@ -130,7 +130,7 @@ public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProv set2.setHighLightColor(Color.rgb(244, 117, 117)); set2.setFillFormatter(new IFillFormatter() { @Override - public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { + public double getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { return mChart.getAxisLeft().getAxisMaximum(); } }); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java index 6bf96f02a7..fe8cd08abd 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java @@ -95,7 +95,7 @@ protected void onCreate(Bundle savedInstanceState) { private SimpleDateFormat mFormat = new SimpleDateFormat("dd MMM HH:mm"); @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { long millis = TimeUnit.HOURS.toMillis((long) value); return mFormat.format(new Date(millis)); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java index d354886f6e..4d2f0cce09 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivity.java @@ -74,7 +74,7 @@ protected void onCreate(Bundle savedInstanceState) { private String[] mActivities = new String[]{"Burger", "Steak", "Salad", "Pasta", "Pizza"}; @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return mActivities[(int) value % mActivities.length]; } }); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java index 9951060177..6c48e98a0c 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java @@ -203,7 +203,7 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { yVals1.add(new BarEntry( i, - new float[]{val1, val2, val3}, + new double[]{val1, val2, val3}, getResources().getDrawable(R.drawable.star))); } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java index c1d64a106b..2708eb7456 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java @@ -82,7 +82,7 @@ protected void onCreate(Bundle savedInstanceState) { private DecimalFormat format = new DecimalFormat("###"); @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return format.format(value) + "-" + format.format(value + 10); } }); @@ -98,18 +98,18 @@ public String getFormattedValue(float value, AxisBase axis) { // IMPORTANT: When using negative values in stacked bars, always make sure the negative values are in the array first ArrayList yValues = new ArrayList(); - yValues.add(new BarEntry(5, new float[]{ -10, 10 })); - yValues.add(new BarEntry(15, new float[]{ -12, 13 })); - yValues.add(new BarEntry(25, new float[]{ -15, 15 })); - yValues.add(new BarEntry(35, new float[]{ -17, 17 })); - yValues.add(new BarEntry(45, new float[]{ -19, 20 })); - yValues.add(new BarEntry(45, new float[]{ -19, 20 }, getResources().getDrawable(R.drawable.star))); - yValues.add(new BarEntry(55, new float[]{ -19, 19 })); - yValues.add(new BarEntry(65, new float[]{ -16, 16 })); - yValues.add(new BarEntry(75, new float[]{ -13, 14 })); - yValues.add(new BarEntry(85, new float[]{ -10, 11 })); - yValues.add(new BarEntry(95, new float[]{ -5, 6 })); - yValues.add(new BarEntry(105, new float[]{ -1, 2 })); + yValues.add(new BarEntry(5, new double[]{ -10, 10 })); + yValues.add(new BarEntry(15, new double[]{ -12, 13 })); + yValues.add(new BarEntry(25, new double[]{ -15, 15 })); + yValues.add(new BarEntry(35, new double[]{ -17, 17 })); + yValues.add(new BarEntry(45, new double[]{ -19, 20 })); + yValues.add(new BarEntry(45, new double[]{ -19, 20 }, getResources().getDrawable(R.drawable.star))); + yValues.add(new BarEntry(55, new double[]{ -19, 19 })); + yValues.add(new BarEntry(65, new double[]{ -16, 16 })); + yValues.add(new BarEntry(75, new double[]{ -13, 14 })); + yValues.add(new BarEntry(85, new double[]{ -10, 11 })); + yValues.add(new BarEntry(95, new double[]{ -5, 6 })); + yValues.add(new BarEntry(105, new double[]{ -1, 2 })); BarDataSet set = new BarDataSet(yValues, "Age Distribution"); set.setDrawIcons(false); @@ -244,13 +244,13 @@ public CustomFormatter() { // data @Override - public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { + public String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return mFormat.format(Math.abs(value)) + "m"; } // YAxis @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return mFormat.format(Math.abs(value)) + "m"; } } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/DayAxisValueFormatter.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/DayAxisValueFormatter.java index b8bc1a41c2..ce6048ce40 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/DayAxisValueFormatter.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/DayAxisValueFormatter.java @@ -21,7 +21,7 @@ public DayAxisValueFormatter(BarLineChartBase chart) { } @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { int days = (int) value; diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyAxisValueFormatter.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyAxisValueFormatter.java index e8456675a9..604584c2eb 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyAxisValueFormatter.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyAxisValueFormatter.java @@ -15,7 +15,7 @@ public MyAxisValueFormatter() { } @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return mFormat.format(value) + " $"; } } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyCustomXAxisValueFormatter.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyCustomXAxisValueFormatter.java index c66e5d4569..62c495bd46 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyCustomXAxisValueFormatter.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyCustomXAxisValueFormatter.java @@ -22,7 +22,7 @@ public MyCustomXAxisValueFormatter(ViewPortHandler viewPortHandler) { } @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { //Log.i("TRANS", "x: " + viewPortHandler.getTransX() + ", y: " + viewPortHandler.getTransY()); diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyFillFormatter.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyFillFormatter.java index e4b94c331f..86beebe4f1 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyFillFormatter.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyFillFormatter.java @@ -17,7 +17,7 @@ public MyFillFormatter(float fillpos) { } @Override - public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { + public double getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { // your logic could be here return mFillPos; } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyValueFormatter.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyValueFormatter.java index cbf5fd56c8..aade7cfd07 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyValueFormatter.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyValueFormatter.java @@ -16,7 +16,7 @@ public MyValueFormatter() { } @Override - public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { + public String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return mFormat.format(value) + " $"; } } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/YearXAxisFormatter.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/YearXAxisFormatter.java index 34d76c25eb..8905bdfe01 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/YearXAxisFormatter.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/YearXAxisFormatter.java @@ -19,9 +19,9 @@ public YearXAxisFormatter() { } @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { - float percent = value / axis.mAxisRange; + double percent = value / axis.mAxisRange; return mMonths[(int) (mMonths.length * percent)]; } } diff --git a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java index f223be6093..625e9afb52 100644 --- a/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java +++ b/MPChartExample/src/com/xxmassdeveloper/mpchartexample/realm/RealmWikiExample.java @@ -87,7 +87,7 @@ private void setData() { IAxisValueFormatter formatter = new IAxisValueFormatter() { @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return results.get((int) value).getPlayerName(); } }; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/BarBuffer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/BarBuffer.java index 136a231445..454639f182 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/BarBuffer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/BarBuffer.java @@ -32,12 +32,12 @@ public void setInverted(boolean inverted) { this.mInverted = inverted; } - protected void addBar(float left, float top, float right, float bottom) { + protected void addBar(double left, double top, double right, double bottom) { - buffer[index++] = left; - buffer[index++] = top; - buffer[index++] = right; - buffer[index++] = bottom; + buffer[index++] = (float)left; + buffer[index++] = (float)top; + buffer[index++] = (float)right; + buffer[index++] = (float)bottom; } @Override @@ -53,15 +53,15 @@ public void feed(IBarDataSet data) { if(e == null) continue; - float x = e.getX(); - float y = e.getY(); - float[] vals = e.getYVals(); + double x = e.getX(); + double y = e.getY(); + double[] vals = e.getYVals(); if (!mContainsStacks || vals == null) { - float left = x - barWidthHalf; - float right = x + barWidthHalf; - float bottom, top; + double left = x - barWidthHalf; + double right = x + barWidthHalf; + double bottom, top; if (mInverted) { bottom = y >= 0 ? y : 0; @@ -81,14 +81,14 @@ public void feed(IBarDataSet data) { } else { - float posY = 0f; + double posY = 0d; float negY = -e.getNegativeSum(); - float yStart = 0f; + double yStart = 0d; // fill the stack for (int k = 0; k < vals.length; k++) { - float value = vals[k]; + double value = vals[k]; if (value == 0.0f && (posY == 0.0f || negY == 0.0f)) { // Take care of the situation of a 0.0 value, which overlaps a non-zero bar @@ -104,9 +104,9 @@ public void feed(IBarDataSet data) { negY += Math.abs(value); } - float left = x - barWidthHalf; - float right = x + barWidthHalf; - float bottom, top; + double left = x - barWidthHalf; + double right = x + barWidthHalf; + double bottom, top; if (mInverted) { bottom = y >= yStart ? y : yStart; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/HorizontalBarBuffer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/HorizontalBarBuffer.java index 6b63bc30ea..f502c6e550 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/HorizontalBarBuffer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/buffer/HorizontalBarBuffer.java @@ -23,9 +23,9 @@ public void feed(IBarDataSet data) { if(e == null) continue; - float x = e.getX(); - float y = e.getY(); - float[] vals = e.getYVals(); + float x = e.getFloatX(); + float y = e.getFloatY(); + double[] vals = e.getYVals(); if (!mContainsStacks || vals == null) { @@ -57,7 +57,7 @@ public void feed(IBarDataSet data) { // fill the stack for (int k = 0; k < vals.length; k++) { - float value = vals[k]; + float value = (float)vals[k]; if (value >= 0f) { y = posY; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarChart.java index 2ba15c9118..6ed04b1ed4 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarChart.java @@ -136,8 +136,8 @@ public void getBarBounds(BarEntry e, RectF outputRect) { return; } - float y = e.getY(); - float x = e.getX(); + float y = e.getFloatY(); + float x = e.getFloatX(); float barWidth = mData.getBarWidth(); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java index 0b0219e445..309f76d93f 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/BarLineChartBase.java @@ -939,7 +939,7 @@ public void centerViewTo(float xValue, float yValue, AxisDependency axis) { * @param duration the duration of the animation in milliseconds */ @TargetApi(11) - public void centerViewToAnimated(float xValue, float yValue, AxisDependency axis, long duration) { + public void centerViewToAnimated(double xValue, double yValue, AxisDependency axis, long duration) { if (android.os.Build.VERSION.SDK_INT >= 11) { @@ -949,7 +949,7 @@ public void centerViewToAnimated(float xValue, float yValue, AxisDependency axis float xInView = getXAxis().mAxisRange / mViewPortHandler.getScaleX(); Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler, - xValue - xInView / 2f, yValue + yInView / 2f, + xValue - xInView / 2d, yValue + yInView / 2d, getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration); addViewportJob(job); @@ -1053,8 +1053,8 @@ public MPPointF getPosition(Entry e, AxisDependency axis) { if (e == null) return null; - mGetPositionBuffer[0] = e.getX(); - mGetPositionBuffer[1] = e.getY(); + mGetPositionBuffer[0] = e.getFloatX(); + mGetPositionBuffer[1] = e.getFloatY(); getTransformer(axis).pointValuesToPixel(mGetPositionBuffer); @@ -1563,12 +1563,12 @@ public void setRendererRightYAxis(YAxisRenderer rendererRightYAxis) { } @Override - public float getYChartMax() { + public double getYChartMax() { return Math.max(mAxisLeft.mAxisMaximum, mAxisRight.mAxisMaximum); } @Override - public float getYChartMin() { + public double getYChartMin() { return Math.min(mAxisLeft.mAxisMinimum, mAxisRight.mAxisMinimum); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java index 35ec2ec1e0..bd7dbcc9c8 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java @@ -372,9 +372,9 @@ public boolean isEmpty() { * Calculates the required number of digits for the values that might be * drawn in the chart (if enabled), and creates the default-value-formatter */ - protected void setupDefaultFormatter(float min, float max) { + protected void setupDefaultFormatter(double min, double max) { - float reference = 0f; + double reference = 0d; if (mData == null || mData.getEntryCount() < 2) { @@ -1052,7 +1052,7 @@ public OnChartGestureListener getOnChartGestureListener() { * * @return */ - public float getYMax() { + public double getYMax() { return mData.getYMax(); } @@ -1061,17 +1061,17 @@ public float getYMax() { * * @return */ - public float getYMin() { + public double getYMin() { return mData.getYMin(); } @Override - public float getXChartMax() { + public double getXChartMax() { return mXAxis.mAxisMaximum; } @Override - public float getXChartMin() { + public double getXChartMin() { return mXAxis.mAxisMinimum; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/HorizontalBarChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/HorizontalBarChart.java index e4ec309d9f..d54934f551 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/HorizontalBarChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/HorizontalBarChart.java @@ -149,8 +149,8 @@ public void getBarBounds(BarEntry e, RectF outputRect) { return; } - float y = e.getY(); - float x = e.getX(); + float y = e.getFloatY(); + float x = e.getFloatX(); float barWidth = mData.getBarWidth(); @@ -181,8 +181,8 @@ public MPPointF getPosition(Entry e, AxisDependency axis) { return null; float[] vals = mGetPositionBuffer; - vals[0] = e.getY(); - vals[1] = e.getX(); + vals[0] = e.getFloatY(); + vals[1] = e.getFloatX(); getTransformer(axis).pointValuesToPixel(vals); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java index 660fd29bdc..adabf15b1e 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieChart.java @@ -188,7 +188,7 @@ protected float[] getMarkerPosition(Highlight highlight) { int entryIndex = (int) highlight.getX(); // offset needed to center the drawn text in the slice - float offset = mDrawAngles[entryIndex] / 2; + double offset = mDrawAngles[entryIndex] / 2; // calculate the text position float x = (float) (r @@ -224,7 +224,7 @@ private void calcAngles() { } } - float yValueSum = mData.getYValueSum(); + double yValueSum = mData.getYValueSum(); List dataSets = mData.getDataSets(); @@ -277,7 +277,7 @@ public boolean needsHighlight(int index) { * @param value * @return */ - private float calcAngle(float value) { + private double calcAngle(double value) { return calcAngle(value, mData.getYValueSum()); } @@ -288,8 +288,8 @@ private float calcAngle(float value) { * @param yValueSum * @return */ - private float calcAngle(float value, float yValueSum) { - return value / yValueSum * mMaxAngle; + private float calcAngle(double value, double yValueSum) { + return (float)(value / yValueSum * mMaxAngle); } /** diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieRadarChartBase.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieRadarChartBase.java index 618de18a34..a95ecef75c 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieRadarChartBase.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/PieRadarChartBase.java @@ -454,13 +454,13 @@ public float getDiameter() { protected abstract float getRequiredBaseOffset(); @Override - public float getYChartMax() { + public double getYChartMax() { // TODO Auto-generated method stub return 0; } @Override - public float getYChartMin() { + public double getYChartMin() { // TODO Auto-generated method stub return 0; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/RadarChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/RadarChart.java index 3c9aec0dde..7bc85367a8 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/charts/RadarChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/charts/RadarChart.java @@ -164,9 +164,9 @@ protected void onDraw(Canvas canvas) { * * @return */ - public float getFactor() { + public double getFactor() { RectF content = mViewPortHandler.getContentRect(); - return Math.min(content.width() / 2f, content.height() / 2f) / mYAxis.mAxisRange; + return Math.min(content.width() / 2d, content.height() / 2d) / mYAxis.mAxisRange; } /** @@ -339,14 +339,14 @@ public float getRadius() { /** * Returns the maximum value this chart can display on it's y-axis. */ - public float getYChartMax() { + public double getYChartMax() { return mYAxis.mAxisMaximum; } /** * Returns the minimum value this chart can display on it's y-axis. */ - public float getYChartMin() { + public double getYChartMin() { return mYAxis.mAxisMinimum; } @@ -355,7 +355,7 @@ public float getYChartMin() { * * @return */ - public float getYRange() { + public double getYRange() { return mYAxis.mAxisRange; } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java b/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java index 3c8028c24b..522990c567 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/components/AxisBase.java @@ -35,12 +35,12 @@ public abstract class AxisBase extends ComponentBase { /** * the actual array of entries */ - public float[] mEntries = new float[]{}; + public double[] mEntries = new double[]{}; /** * axis label entries only used for centered labels */ - public float[] mCenteredEntries = new float[]{}; + public double[] mCenteredEntries = new double[]{}; /** * the number of entries the legend contains @@ -140,12 +140,12 @@ public abstract class AxisBase extends ComponentBase { /** * don't touch this direclty, use setter */ - public float mAxisMaximum = 0f; + public double mAxisMaximum = 0d; /** * don't touch this directly, use setter */ - public float mAxisMinimum = 0f; + public double mAxisMinimum = 0d; /** * the total range of values this axis covers @@ -628,11 +628,11 @@ public DashPathEffect getAxisLineDashPathEffect() { * ###### BELOW CODE RELATED TO CUSTOM AXIS VALUES ###### */ - public float getAxisMaximum() { + public double getAxisMaximum() { return mAxisMaximum; } - public float getAxisMinimum() { + public double getAxisMinimum() { return mAxisMinimum; } @@ -684,7 +684,7 @@ public boolean isAxisMinCustom() { public void setAxisMinimum(float min) { mCustomAxisMin = true; mAxisMinimum = min; - this.mAxisRange = Math.abs(mAxisMaximum - min); + this.mAxisRange = (float)Math.abs(mAxisMaximum - min); } /** @@ -704,10 +704,10 @@ public void setAxisMinValue(float min) { * * @param max */ - public void setAxisMaximum(float max) { + public void setAxisMaximum(double max) { mCustomAxisMax = true; mAxisMaximum = max; - this.mAxisRange = Math.abs(max - mAxisMinimum); + this.mAxisRange = (float)Math.abs(max - mAxisMinimum); } /** @@ -727,14 +727,14 @@ public void setAxisMaxValue(float max) { * @param dataMin the min value according to chart data * @param dataMax the max value according to chart data */ - public void calculate(float dataMin, float dataMax) { + public void calculate(double dataMin, double dataMax) { // if custom, use value as is, else use data value - float min = mCustomAxisMin ? mAxisMinimum : (dataMin - mSpaceMin); - float max = mCustomAxisMax ? mAxisMaximum : (dataMax + mSpaceMax); + double min = mCustomAxisMin ? mAxisMinimum : (dataMin - mSpaceMin); + double max = mCustomAxisMax ? mAxisMaximum : (dataMax + mSpaceMax); // temporary range (before calculations) - float range = Math.abs(max - min); + double range = Math.abs(max - min); // in case all values are equal if (range == 0f) { @@ -746,7 +746,7 @@ public void calculate(float dataMin, float dataMax) { this.mAxisMaximum = max; // actual range - this.mAxisRange = Math.abs(max - min); + this.mAxisRange = (float)Math.abs(max - min); } /** diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/components/YAxis.java b/MPChartLib/src/main/java/com/github/mikephil/charting/components/YAxis.java index 2381dbf868..06b3775171 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/components/YAxis.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/components/YAxis.java @@ -397,10 +397,10 @@ public void setUseAutoScaleMaxRestriction( boolean isEnabled ) { @Override - public void calculate(float dataMin, float dataMax) { + public void calculate(double dataMin, double dataMax) { - float min = dataMin; - float max = dataMax; + double min = dataMin; + double max = dataMax; // if custom, use value as is, else use data value if( mCustomAxisMin ) { @@ -420,21 +420,21 @@ public void calculate(float dataMin, float dataMax) { } // temporary range (before calculations) - float range = Math.abs(max - min); + double range = Math.abs(max - min); // in case all values are equal - if (range == 0f) { - max = max + 1f; - min = min - 1f; + if (range == 0d) { + max = max + 1d; + min = min - 1d; } - float bottomSpace = range / 100f * getSpaceBottom(); + double bottomSpace = range / 100d * getSpaceBottom(); this.mAxisMinimum = (min - bottomSpace); - - float topSpace = range / 100f * getSpaceTop(); + + double topSpace = range / 100d * getSpaceTop(); this.mAxisMaximum = (max + topSpace); // calc actual range - this.mAxisRange = Math.abs(this.mAxisMaximum - this.mAxisMinimum); + this.mAxisRange = (float)Math.abs(this.mAxisMaximum - this.mAxisMinimum); } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java index 496f4046f8..dd43d63be4 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarDataSet.java @@ -81,7 +81,7 @@ private void calcEntryCountIncludingStacks(List yVals) { for (int i = 0; i < yVals.size(); i++) { - float[] vals = yVals.get(i).getYVals(); + double[] vals = yVals.get(i).getYVals(); if (vals == null) mEntryCountStacks++; @@ -98,7 +98,7 @@ private void calcStackSize(List yVals) { for (int i = 0; i < yVals.size(); i++) { - float[] vals = yVals.get(i).getYVals(); + double[] vals = yVals.get(i).getYVals(); if (vals != null && vals.length > mStackSize) mStackSize = vals.length; @@ -108,7 +108,7 @@ private void calcStackSize(List yVals) { @Override protected void calcMinMax(BarEntry e) { - if (e != null && !Float.isNaN(e.getY())) { + if (e != null && !Double.isNaN(e.getY())) { if (e.getYVals() == null) { diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarEntry.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarEntry.java index 365ef51a2d..7ed0b93b52 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarEntry.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BarEntry.java @@ -16,7 +16,7 @@ public class BarEntry extends Entry { /** * the values the stacked barchart holds */ - private float[] mYVals; + private double[] mYVals; /** * the ranges for the individual stack values - automatically calculated @@ -39,7 +39,7 @@ public class BarEntry extends Entry { * @param x * @param y */ - public BarEntry(float x, float y) { + public BarEntry(double x, double y) { super(x, y); } @@ -50,7 +50,7 @@ public BarEntry(float x, float y) { * @param y * @param data - Spot for additional data this Entry represents. */ - public BarEntry(float x, float y, Object data) { + public BarEntry(double x, double y, Object data) { super(x, y, data); } @@ -61,7 +61,7 @@ public BarEntry(float x, float y, Object data) { * @param y * @param icon - icon image */ - public BarEntry(float x, float y, Drawable icon) { + public BarEntry(double x, double y, Drawable icon) { super(x, y, icon); } @@ -73,7 +73,7 @@ public BarEntry(float x, float y, Drawable icon) { * @param icon - icon image * @param data - Spot for additional data this Entry represents. */ - public BarEntry(float x, float y, Drawable icon, Object data) { + public BarEntry(double x, double y, Drawable icon, Object data) { super(x, y, icon, data); } @@ -83,7 +83,7 @@ public BarEntry(float x, float y, Drawable icon, Object data) { * @param x * @param vals - the stack values, use at least 2 */ - public BarEntry(float x, float[] vals) { + public BarEntry(double x, double[] vals) { super(x, calcSum(vals)); this.mYVals = vals; @@ -98,7 +98,7 @@ public BarEntry(float x, float[] vals) { * @param vals - the stack values, use at least 2 * @param data - Spot for additional data this Entry represents. */ - public BarEntry(float x, float[] vals, Object data) { + public BarEntry(double x, double[] vals, Object data) { super(x, calcSum(vals), data); this.mYVals = vals; @@ -113,7 +113,7 @@ public BarEntry(float x, float[] vals, Object data) { * @param vals - the stack values, use at least 2 * @param icon - icon image */ - public BarEntry(float x, float[] vals, Drawable icon) { + public BarEntry(float x, double[] vals, Drawable icon) { super(x, calcSum(vals), icon); this.mYVals = vals; @@ -129,7 +129,7 @@ public BarEntry(float x, float[] vals, Drawable icon) { * @param icon - icon image * @param data - Spot for additional data this Entry represents. */ - public BarEntry(float x, float[] vals, Drawable icon, Object data) { + public BarEntry(double x, double[] vals, Drawable icon, Object data) { super(x, calcSum(vals), icon, data); this.mYVals = vals; @@ -153,7 +153,7 @@ public BarEntry copy() { * * @return */ - public float[] getYVals() { + public double[] getYVals() { return mYVals; } @@ -162,7 +162,7 @@ public float[] getYVals() { * * @param vals */ - public void setVals(float[] vals) { + public void setVals(double[] vals) { setY(calcSum(vals)); mYVals = vals; calcPosNegSum(); @@ -175,7 +175,7 @@ public void setVals(float[] vals) { * @return */ @Override - public float getY() { + public double getY() { return super.getY(); } @@ -250,11 +250,11 @@ private void calcPosNegSum() { float sumNeg = 0f; float sumPos = 0f; - for (float f : mYVals) { - if (f <= 0f) - sumNeg += Math.abs(f); + for (double d : mYVals) { + if (d <= 0) + sumNeg += Math.abs(d); else - sumPos += f; + sumPos += d; } mNegativeSum = sumNeg; @@ -267,22 +267,22 @@ private void calcPosNegSum() { * @param vals * @return */ - private static float calcSum(float[] vals) { + private static double calcSum(double[] vals) { if (vals == null) return 0f; - float sum = 0f; + double sum = 0d; - for (float f : vals) - sum += f; + for (double d : vals) + sum += d; return sum; } protected void calcRanges() { - float[] values = getYVals(); + double[] values = getYVals(); if (values == null || values.length == 0) return; @@ -294,7 +294,7 @@ protected void calcRanges() { for (int i = 0; i < mRanges.length; i++) { - float value = values[i]; + double value = values[i]; if (value < 0) { mRanges[i] = new Range(negRemain, negRemain - value); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseEntry.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseEntry.java index eb1ada84d8..cf0700b247 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseEntry.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BaseEntry.java @@ -8,7 +8,7 @@ public abstract class BaseEntry { /** the y value */ - private float y = 0f; + private double y = 0d; /** optional spot for additional data this Entry represents */ private Object mData = null; @@ -20,21 +20,21 @@ public BaseEntry() { } - public BaseEntry(float y) { + public BaseEntry(double y) { this.y = y; } - public BaseEntry(float y, Object data) { + public BaseEntry(double y, Object data) { this(y); this.mData = data; } - public BaseEntry(float y, Drawable icon) { + public BaseEntry(double y, Drawable icon) { this(y); this.mIcon = icon; } - public BaseEntry(float y, Drawable icon, Object data) { + public BaseEntry(double y, Drawable icon, Object data) { this(y); this.mIcon = icon; this.mData = data; @@ -45,10 +45,19 @@ public BaseEntry(float y, Drawable icon, Object data) { * * @return */ - public float getY() { + public double getY() { return y; } + /** + * Returns the y value of this Entry. + * + * @return + */ + public float getFloatY() { + return (float)y; + } + /** * Sets the icon drawable * @@ -72,7 +81,7 @@ public Drawable getIcon() { * * @param y */ - public void setY(float y) { + public void setY(double y) { this.y = y; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleEntry.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleEntry.java index 35d8330aaa..79a389c217 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleEntry.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/BubbleEntry.java @@ -24,7 +24,7 @@ public class BubbleEntry extends Entry { * @param y The value on the y-axis. * @param size The size of the bubble. */ - public BubbleEntry(float x, float y, float size) { + public BubbleEntry(double x, double y, float size) { super(x, y); this.mSize = size; } @@ -37,7 +37,7 @@ public BubbleEntry(float x, float y, float size) { * @param size The size of the bubble. * @param data Spot for additional data this Entry represents. */ - public BubbleEntry(float x, float y, float size, Object data) { + public BubbleEntry(double x, double y, float size, Object data) { super(x, y, data); this.mSize = size; } @@ -50,7 +50,7 @@ public BubbleEntry(float x, float y, float size, Object data) { * @param size The size of the bubble. * @param icon Icon image */ - public BubbleEntry(float x, float y, float size, Drawable icon) { + public BubbleEntry(double x, double y, float size, Drawable icon) { super(x, y, icon); this.mSize = size; } @@ -64,7 +64,7 @@ public BubbleEntry(float x, float y, float size, Drawable icon) { * @param icon Icon image * @param data Spot for additional data this Entry represents. */ - public BubbleEntry(float x, float y, float size, Drawable icon, Object data) { + public BubbleEntry(double x, double y, float size, Drawable icon, Object data) { super(x, y, icon, data); this.mSize = size; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleEntry.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleEntry.java index 5a049957a2..f44e136093 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleEntry.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CandleEntry.java @@ -33,7 +33,7 @@ public class CandleEntry extends Entry { * @param open The open value * @param close The close value */ - public CandleEntry(float x, float shadowH, float shadowL, float open, float close) { + public CandleEntry(double x, float shadowH, float shadowL, float open, float close) { super(x, (shadowH + shadowL) / 2f); this.mShadowHigh = shadowH; @@ -52,7 +52,7 @@ public CandleEntry(float x, float shadowH, float shadowL, float open, float clos * @param close * @param data Spot for additional data this Entry represents */ - public CandleEntry(float x, float shadowH, float shadowL, float open, float close, + public CandleEntry(double x, float shadowH, float shadowL, float open, float close, Object data) { super(x, (shadowH + shadowL) / 2f, data); @@ -72,7 +72,7 @@ public CandleEntry(float x, float shadowH, float shadowL, float open, float clos * @param close * @param icon Icon image */ - public CandleEntry(float x, float shadowH, float shadowL, float open, float close, + public CandleEntry(double x, float shadowH, float shadowL, float open, float close, Drawable icon) { super(x, (shadowH + shadowL) / 2f, icon); @@ -93,7 +93,7 @@ public CandleEntry(float x, float shadowH, float shadowL, float open, float clos * @param icon Icon image * @param data Spot for additional data this Entry represents */ - public CandleEntry(float x, float shadowH, float shadowL, float open, float close, + public CandleEntry(double x, float shadowH, float shadowL, float open, float close, Drawable icon, Object data) { super(x, (shadowH + shadowL) / 2f, icon, data); @@ -127,7 +127,7 @@ public float getBodyRange() { * low) */ @Override - public float getY() { + public double getY() { return super.getY(); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java index 60d89f4753..242df937ef 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/ChartData.java @@ -23,31 +23,31 @@ public abstract class ChartData> { /** * maximum y-value in the value array across all axes */ - protected float mYMax = -Float.MAX_VALUE; + protected double mYMax = -Float.MAX_VALUE; /** * the minimum y-value in the value array across all axes */ - protected float mYMin = Float.MAX_VALUE; + protected double mYMin = Float.MAX_VALUE; /** * maximum x-value in the value array */ - protected float mXMax = -Float.MAX_VALUE; + protected double mXMax = -Float.MAX_VALUE; /** * minimum x-value in the value array */ - protected float mXMin = Float.MAX_VALUE; + protected double mXMin = Float.MAX_VALUE; - protected float mLeftAxisMax = -Float.MAX_VALUE; + protected double mLeftAxisMax = -Float.MAX_VALUE; - protected float mLeftAxisMin = Float.MAX_VALUE; + protected double mLeftAxisMin = Float.MAX_VALUE; - protected float mRightAxisMax = -Float.MAX_VALUE; + protected double mRightAxisMax = -Float.MAX_VALUE; - protected float mRightAxisMin = Float.MAX_VALUE; + protected double mRightAxisMin = Float.MAX_VALUE; /** * array that holds all DataSets the ChartData object represents @@ -203,7 +203,7 @@ public int getDataSetCount() { * * @return */ - public float getYMin() { + public double getYMin() { return mYMin; } @@ -213,7 +213,7 @@ public float getYMin() { * @param axis * @return */ - public float getYMin(AxisDependency axis) { + public double getYMin(AxisDependency axis) { if (axis == AxisDependency.LEFT) { if (mLeftAxisMin == Float.MAX_VALUE) { @@ -233,7 +233,7 @@ public float getYMin(AxisDependency axis) { * * @return */ - public float getYMax() { + public double getYMax() { return mYMax; } @@ -243,7 +243,7 @@ public float getYMax() { * @param axis * @return */ - public float getYMax(AxisDependency axis) { + public double getYMax(AxisDependency axis) { if (axis == AxisDependency.LEFT) { if (mLeftAxisMax == -Float.MAX_VALUE) { @@ -263,7 +263,7 @@ public float getYMax(AxisDependency axis) { * * @return */ - public float getXMin() { + public double getXMin() { return mXMin; } @@ -272,7 +272,7 @@ public float getXMin() { * * @return */ - public float getXMax() { + public double getXMax() { return mXMax; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java index 39625b30f9..d88f5030b0 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java @@ -192,7 +192,7 @@ public Entry getEntryForHighlight(Highlight highlight) { .getEntriesForXValue(highlight.getX()); for (Entry entry : entries) if (entry.getY() == highlight.getY() || - Float.isNaN(highlight.getY())) + Double.isNaN(highlight.getY())) return entry; return null; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java index 3c69d9c58f..8ca81b4ded 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/DataSet.java @@ -22,22 +22,22 @@ public abstract class DataSet extends BaseDataSet { /** * maximum y-value in the value array */ - protected float mYMax = -Float.MAX_VALUE; + protected double mYMax = -Float.MAX_VALUE; /** * minimum y-value in the value array */ - protected float mYMin = Float.MAX_VALUE; + protected double mYMin = Float.MAX_VALUE; /** * maximum x-value in the value array */ - protected float mXMax = -Float.MAX_VALUE; + protected double mXMax = -Float.MAX_VALUE; /** * minimum x-value in the value array */ - protected float mXMin = Float.MAX_VALUE; + protected double mXMin = Float.MAX_VALUE; /** @@ -189,22 +189,22 @@ public String toSimpleString() { } @Override - public float getYMin() { + public double getYMin() { return mYMin; } @Override - public float getYMax() { + public double getYMax() { return mYMax; } @Override - public float getXMin() { + public double getXMin() { return mXMin; } @Override - public float getXMax() { + public double getXMax() { return mXMax; } @@ -276,7 +276,7 @@ public int getEntryIndex(Entry e) { } @Override - public T getEntryForXValue(float xValue, float closestToY, Rounding rounding) { + public T getEntryForXValue(double xValue, double closestToY, Rounding rounding) { int index = getEntryIndex(xValue, closestToY, rounding); if (index > -1) @@ -285,7 +285,7 @@ public T getEntryForXValue(float xValue, float closestToY, Rounding rounding) { } @Override - public T getEntryForXValue(float xValue, float closestToY) { + public T getEntryForXValue(double xValue, double closestToY) { return getEntryForXValue(xValue, closestToY, Rounding.CLOSEST); } @@ -295,7 +295,7 @@ public T getEntryForIndex(int index) { } @Override - public int getEntryIndex(float xValue, float closestToY, Rounding rounding) { + public int getEntryIndex(double xValue, double closestToY, Rounding rounding) { if (mValues == null || mValues.isEmpty()) return -1; @@ -307,7 +307,7 @@ public int getEntryIndex(float xValue, float closestToY, Rounding rounding) { while (low < high) { int m = (low + high) / 2; - final float d1 = mValues.get(m).getX() - xValue, + final double d1 = mValues.get(m).getX() - xValue, d2 = mValues.get(m + 1).getX() - xValue, ad1 = Math.abs(d1), ad2 = Math.abs(d2); @@ -335,7 +335,7 @@ public int getEntryIndex(float xValue, float closestToY, Rounding rounding) { } if (closest != -1) { - float closestXValue = mValues.get(closest).getX(); + double closestXValue = mValues.get(closest).getX(); if (rounding == Rounding.UP) { // If rounding up, and found x-value is lower than specified x, and we can go upper... if (closestXValue < xValue && closest < mValues.size() - 1) { @@ -349,11 +349,11 @@ public int getEntryIndex(float xValue, float closestToY, Rounding rounding) { } // Search by closest to y-value - if (!Float.isNaN(closestToY)) { + if (!Double.isNaN(closestToY)) { while (closest > 0 && mValues.get(closest - 1).getX() == closestXValue) closest -= 1; - float closestYValue = mValues.get(closest).getY(); + double closestYValue = mValues.get(closest).getY(); int closestYIndex = closest; while (true) { @@ -380,7 +380,7 @@ public int getEntryIndex(float xValue, float closestToY, Rounding rounding) { } @Override - public List getEntriesForXValue(float xValue) { + public List getEntriesForXValue(double xValue) { List entries = new ArrayList(); @@ -422,7 +422,7 @@ public List getEntriesForXValue(float xValue) { /** * Determines how to round DataSet index values for - * {@link DataSet#getEntryIndex(float, float, Rounding)} DataSet.getEntryIndex()} + * {@link DataSet#getEntryIndex(double, double, Rounding)} DataSet.getEntryIndex()} * when an exact x-index is not found. */ public enum Rounding { diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/Entry.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/Entry.java index b7a887990d..2d14f82dc7 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/Entry.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/Entry.java @@ -17,7 +17,7 @@ public class Entry extends BaseEntry implements Parcelable { /** the x value */ - private float x = 0f; + private double x = 0d; public Entry() { @@ -29,7 +29,7 @@ public Entry() { * @param x the x value * @param y the y value (the actual value of the entry) */ - public Entry(float x, float y) { + public Entry(double x, double y) { super(y); this.x = x; } @@ -41,7 +41,7 @@ public Entry(float x, float y) { * @param y the y value (the actual value of the entry) * @param data Spot for additional data this Entry represents. */ - public Entry(float x, float y, Object data) { + public Entry(double x, double y, Object data) { super(y, data); this.x = x; } @@ -53,7 +53,7 @@ public Entry(float x, float y, Object data) { * @param y the y value (the actual value of the entry) * @param icon icon image */ - public Entry(float x, float y, Drawable icon) { + public Entry(double x, double y, Drawable icon) { super(y, icon); this.x = x; } @@ -66,26 +66,35 @@ public Entry(float x, float y, Drawable icon) { * @param icon icon image * @param data Spot for additional data this Entry represents. */ - public Entry(float x, float y, Drawable icon, Object data) { + public Entry(double x, double y, Drawable icon, Object data) { super(y, icon, data); this.x = x; } /** * Returns the x-value of this Entry object. - * + * * @return */ - public float getX() { + public double getX() { return x; } + /** + * Returns the x-value of this Entry object. + * + * @return + */ + public float getFloatX() { + return (float)x; + } + /** * Sets the x-value of this Entry object. * * @param x */ - public void setX(float x) { + public void setX(double x) { this.x = x; } @@ -139,8 +148,8 @@ public int describeContents() { @Override public void writeToParcel(Parcel dest, int flags) { - dest.writeFloat(this.x); - dest.writeFloat(this.getY()); + dest.writeDouble(this.x); + dest.writeDouble(this.getY()); if (getData() != null) { if (getData() instanceof Parcelable) { dest.writeInt(1); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieData.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieData.java index db7972a3fb..154012b5ab 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieData.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieData.java @@ -73,9 +73,9 @@ public Entry getEntryForHighlight(Highlight highlight) { * * @return */ - public float getYValueSum() { + public double getYValueSum() { - float sum = 0; + double sum = 0; for (int i = 0; i < getDataSet().getEntryCount(); i++) sum += getDataSet().getEntryForIndex(i).getY(); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieEntry.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieEntry.java index 65741ef1da..924febc756 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieEntry.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/PieEntry.java @@ -12,39 +12,39 @@ public class PieEntry extends Entry { private String label; - public PieEntry(float value) { - super(0f, value); + public PieEntry(double value) { + super(0d, value); } - public PieEntry(float value, Object data) { - super(0f, value, data); + public PieEntry(double value, Object data) { + super(0, value, data); } - public PieEntry(float value, Drawable icon) { - super(0f, value, icon); + public PieEntry(double value, Drawable icon) { + super(0, value, icon); } - public PieEntry(float value, Drawable icon, Object data) { - super(0f, value, icon, data); + public PieEntry(double value, Drawable icon, Object data) { + super(0, value, icon, data); } - public PieEntry(float value, String label) { - super(0f, value); + public PieEntry(double value, String label) { + super(0d, value); this.label = label; } - public PieEntry(float value, String label, Object data) { - super(0f, value, data); + public PieEntry(double value, String label, Object data) { + super(0d, value, data); this.label = label; } - public PieEntry(float value, String label, Drawable icon) { - super(0f, value, icon); + public PieEntry(double value, String label, Drawable icon) { + super(0d, value, icon); this.label = label; } - public PieEntry(float value, String label, Drawable icon, Object data) { - super(0f, value, icon, data); + public PieEntry(double value, String label, Drawable icon, Object data) { + super(0d, value, icon, data); this.label = label; } @@ -53,7 +53,7 @@ public PieEntry(float value, String label, Drawable icon, Object data) { * * @return */ - public float getValue() { + public double getValue() { return getY(); } @@ -67,14 +67,14 @@ public void setLabel(String label) { @Deprecated @Override - public void setX(float x) { + public void setX(double x) { super.setX(x); Log.i("DEPRECATED", "Pie entries do not have x values"); } @Deprecated @Override - public float getX() { + public double getX() { Log.i("DEPRECATED", "Pie entries do not have x values"); return super.getX(); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarEntry.java b/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarEntry.java index 02fdce7d32..09deaf829c 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarEntry.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/data/RadarEntry.java @@ -8,12 +8,12 @@ @SuppressLint("ParcelCreator") public class RadarEntry extends Entry { - public RadarEntry(float value) { - super(0f, value); + public RadarEntry(double value) { + super(0d, value); } - public RadarEntry(float value, Object data) { - super(0f, value, data); + public RadarEntry(double value, Object data) { + super(0d, value, data); } /** @@ -21,7 +21,7 @@ public RadarEntry(float value, Object data) { * * @return */ - public float getValue() { + public double getValue() { return getY(); } @@ -32,13 +32,13 @@ public RadarEntry copy() { @Deprecated @Override - public void setX(float x) { + public void setX(double x) { super.setX(x); } @Deprecated @Override - public float getX() { + public double getX() { return super.getX(); } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultAxisValueFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultAxisValueFormatter.java index 552c150e69..e2a1f97ce6 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultAxisValueFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultAxisValueFormatter.java @@ -40,7 +40,7 @@ public DefaultAxisValueFormatter(int digits) { } @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { // avoid memory allocations here (for performance) return mFormat.format(value); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultFillFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultFillFormatter.java index 851faeb333..554f54b792 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultFillFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultFillFormatter.java @@ -14,26 +14,26 @@ public class DefaultFillFormatter implements IFillFormatter { @Override - public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { + public double getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) { - float fillMin = 0f; - float chartMaxY = dataProvider.getYChartMax(); - float chartMinY = dataProvider.getYChartMin(); + double fillMin = 0d; + double chartMaxY = dataProvider.getYChartMax(); + double chartMinY = dataProvider.getYChartMin(); LineData data = dataProvider.getLineData(); if (dataSet.getYMax() > 0 && dataSet.getYMin() < 0) { - fillMin = 0f; + fillMin = 0d; } else { - float max, min; + double max, min; if (data.getYMax() > 0) - max = 0f; + max = 0d; else max = chartMaxY; if (data.getYMin() < 0) - min = 0f; + min = 0d; else min = chartMinY; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultValueFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultValueFormatter.java index e2fea4b079..e71904adb9 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultValueFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/DefaultValueFormatter.java @@ -52,7 +52,7 @@ public void setup(int digits) { } @Override - public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { + public String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { // put more logic here ... // avoid memory allocations here (for performance reasons) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IAxisValueFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IAxisValueFormatter.java index 51939b5432..d05c8ca3d0 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IAxisValueFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IAxisValueFormatter.java @@ -19,5 +19,5 @@ public interface IAxisValueFormatter * @param axis the axis the value belongs to * @return */ - String getFormattedValue(float value, AxisBase axis); + String getFormattedValue(double value, AxisBase axis); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IFillFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IFillFormatter.java index e096cc6528..de7e5cf021 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IFillFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IFillFormatter.java @@ -20,5 +20,5 @@ public interface IFillFormatter * @param dataProvider * @return */ - float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider); + double getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IValueFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IValueFormatter.java index 75d2363f26..c327841152 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IValueFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IValueFormatter.java @@ -25,5 +25,5 @@ public interface IValueFormatter * @param viewPortHandler provides information about the current chart state (scale, translation, ...) * @return the formatted label ready for being drawn */ - String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler); + String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IndexAxisValueFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IndexAxisValueFormatter.java index 07349a6a0e..31e41489a8 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IndexAxisValueFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/IndexAxisValueFormatter.java @@ -44,8 +44,8 @@ public IndexAxisValueFormatter(Collection values) { setValues(values.toArray(new String[values.size()])); } - public String getFormattedValue(float value, AxisBase axis) { - int index = Math.round(value); + public String getFormattedValue(double value, AxisBase axis) { + int index = (int)Math.round(value); if (index < 0 || index >= mValueCount || index != (int)value) return ""; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/LargeValueFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/LargeValueFormatter.java index 211401ad8a..aa8604ac38 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/LargeValueFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/LargeValueFormatter.java @@ -43,13 +43,13 @@ public LargeValueFormatter(String appendix) { // IValueFormatter @Override - public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { + public String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return makePretty(value) + mText; } // IAxisValueFormatter @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return makePretty(value) + mText; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java index de8a10255a..ea35d5352a 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java @@ -33,13 +33,13 @@ public PercentFormatter(DecimalFormat format) { // IValueFormatter @Override - public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { + public String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return mFormat.format(value) + " %"; } // IAxisValueFormatter @Override - public String getFormattedValue(float value, AxisBase axis) { + public String getFormattedValue(double value, AxisBase axis) { return mFormat.format(value) + " %"; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/StackedValueFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/StackedValueFormatter.java index 0e8351634f..6cc197b0e7 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/StackedValueFormatter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/StackedValueFormatter.java @@ -49,12 +49,12 @@ public StackedValueFormatter(boolean drawWholeStack, String appendix, int decima } @Override - public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { + public String getFormattedValue(double value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { if (!mDrawWholeStack && entry instanceof BarEntry) { BarEntry barEntry = (BarEntry) entry; - float[] vals = barEntry.getYVals(); + double[] vals = barEntry.getYVals(); if (vals != null) { diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java index 032698d5e5..792a342787 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Highlight.java @@ -13,12 +13,12 @@ public class Highlight { /** * the x-value of the highlighted value */ - private float mX = Float.NaN; + private double mX = Double.NaN; /** * the y-value of the highlighted value */ - private float mY = Float.NaN; + private double mY = Double.NaN; /** * the x-pixel of the highlight @@ -78,7 +78,7 @@ public Highlight(float x, int dataSetIndex, int stackIndex) { * @param y the y-value of the highlighted value * @param dataSetIndex the index of the DataSet the highlighted value belongs to */ - public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, YAxis.AxisDependency axis) { + public Highlight(double x, double y, float xPx, float yPx, int dataSetIndex, YAxis.AxisDependency axis) { this.mX = x; this.mY = y; this.mXPx = xPx; @@ -96,7 +96,7 @@ public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, YAxis * @param stackIndex references which value of a stacked-bar entry has been * selected */ - public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, int stackIndex, YAxis.AxisDependency axis) { + public Highlight(double x, double y, float xPx, float yPx, int dataSetIndex, int stackIndex, YAxis.AxisDependency axis) { this(x, y, xPx, yPx, dataSetIndex, axis); this.mStackIndex = stackIndex; } @@ -106,7 +106,7 @@ public Highlight(float x, float y, float xPx, float yPx, int dataSetIndex, int s * * @return */ - public float getX() { + public double getX() { return mX; } @@ -115,7 +115,7 @@ public float getX() { * * @return */ - public float getY() { + public double getY() { return mY; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/RadarHighlighter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/RadarHighlighter.java index 3c4f6d03ac..ff39f0af70 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/RadarHighlighter.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/RadarHighlighter.java @@ -22,16 +22,16 @@ protected Highlight getClosestHighlight(int index, float x, float y) { List highlights = getHighlightsAtIndex(index); - float distanceToCenter = mChart.distanceToCenter(x, y) / mChart.getFactor(); + double distanceToCenter = mChart.distanceToCenter(x, y) / mChart.getFactor(); Highlight closest = null; - float distance = Float.MAX_VALUE; + double distance = Float.MAX_VALUE; for (int i = 0; i < highlights.size(); i++) { Highlight high = highlights.get(i); - float cdistance = Math.abs(high.getY() - distanceToCenter); + double cdistance = Math.abs(high.getY() - distanceToCenter); if (cdistance < distance) { closest = high; distance = cdistance; @@ -56,7 +56,7 @@ protected List getHighlightsAtIndex(int index) { float phaseX = mChart.getAnimator().getPhaseX(); float phaseY = mChart.getAnimator().getPhaseY(); float sliceangle = mChart.getSliceAngle(); - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); MPPointF pOut = MPPointF.getInstance(0,0); for (int i = 0; i < mChart.getData().getDataSetCount(); i++) { @@ -65,7 +65,7 @@ protected List getHighlightsAtIndex(int index) { final Entry entry = dataSet.getEntryForIndex(index); - float y = (entry.getY() - mChart.getYChartMin()); + double y = (entry.getY() - mChart.getYChartMin()); Utils.getPosition( mChart.getCenterOffsets(), y * factor * phaseY, diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Range.java b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Range.java index 96dd592b8f..2ba9e5e9f0 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Range.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/highlight/Range.java @@ -6,10 +6,10 @@ */ public final class Range { - public float from; - public float to; + public double from; + public double to; - public Range(float from, float to) { + public Range(double from, double to) { this.from = from; this.to = to; } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/ChartInterface.java b/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/ChartInterface.java index 219b46bd82..169c5247ae 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/ChartInterface.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/dataprovider/ChartInterface.java @@ -19,14 +19,14 @@ public interface ChartInterface { * * @return */ - float getXChartMin(); + double getXChartMin(); /** * Returns the maximum x value of the chart, regardless of zoom or translation. * * @return */ - float getXChartMax(); + double getXChartMax(); float getXRange(); @@ -35,14 +35,14 @@ public interface ChartInterface { * * @return */ - float getYChartMin(); + double getYChartMin(); /** * Returns the maximum y value of the chart, regardless of zoom or translation. * * @return */ - float getYChartMax(); + double getYChartMax(); /** * Returns the maximum distance in scren dp a touch can be away from an entry to cause it to get highlighted. diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IDataSet.java b/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IDataSet.java index f64db706e0..2b5daeeba2 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IDataSet.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/IDataSet.java @@ -26,28 +26,28 @@ public interface IDataSet { * * @return */ - float getYMin(); + double getYMin(); /** * returns the maximum y-value this DataSet holds * * @return */ - float getYMax(); + double getYMax(); /** * returns the minimum x-value this DataSet holds * * @return */ - float getXMin(); + double getXMin(); /** * returns the maximum x-value this DataSet holds * * @return */ - float getXMax(); + double getXMax(); /** * Returns the number of y-values this DataSet represents -> the size of the y-values array @@ -87,7 +87,7 @@ public interface IDataSet { * * */ - T getEntryForXValue(float xValue, float closestToY, DataSet.Rounding rounding); + T getEntryForXValue(double xValue, double closestToY, DataSet.Rounding rounding); /** * Returns the first Entry object found at the given x-value with binary @@ -102,7 +102,7 @@ public interface IDataSet { * @param closestToY If there are multiple y-values for the specified x-value, * @return */ - T getEntryForXValue(float xValue, float closestToY); + T getEntryForXValue(double xValue, double closestToY); /** * Returns all Entry objects found at the given x-value with binary @@ -113,7 +113,7 @@ public interface IDataSet { * @param xValue * @return */ - List getEntriesForXValue(float xValue); + List getEntriesForXValue(double xValue); /** * Returns the Entry object found at the given index (NOT xIndex) in the values array. @@ -137,7 +137,7 @@ public interface IDataSet { * if there is no Entry matching the provided x-value * @return */ - int getEntryIndex(float xValue, float closestToY, DataSet.Rounding rounding); + int getEntryIndex(double xValue, double closestToY, DataSet.Rounding rounding); /** * Returns the position of the provided entry in the DataSets Entry array. diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedMoveViewJob.java b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedMoveViewJob.java index 8f953a06aa..d7f82bd9dd 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedMoveViewJob.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedMoveViewJob.java @@ -21,7 +21,7 @@ public class AnimatedMoveViewJob extends AnimatedViewPortJob { pool.setReplenishPercentage(0.5f); } - public static AnimatedMoveViewJob getInstance(ViewPortHandler viewPortHandler, float xValue, float yValue, Transformer trans, View v, float xOrigin, float yOrigin, long duration){ + public static AnimatedMoveViewJob getInstance(ViewPortHandler viewPortHandler, double xValue, double yValue, Transformer trans, View v, float xOrigin, float yOrigin, long duration){ AnimatedMoveViewJob result = pool.get(); result.mViewPortHandler = viewPortHandler; result.xValue = xValue; @@ -47,8 +47,8 @@ public AnimatedMoveViewJob(ViewPortHandler viewPortHandler, float xValue, float @Override public void onAnimationUpdate(ValueAnimator animation) { - pts[0] = xOrigin + (xValue - xOrigin) * phase; - pts[1] = yOrigin + (yValue - yOrigin) * phase; + pts[0] = xOrigin + ((float)xValue - xOrigin) * phase; + pts[1] = yOrigin + ((float)yValue - yOrigin) * phase; mTrans.pointValuesToPixel(pts); mViewPortHandler.centerViewPort(pts, view); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedZoomJob.java b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedZoomJob.java index e5e4c417d3..ae5eee1a14 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedZoomJob.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/AnimatedZoomJob.java @@ -24,7 +24,7 @@ public class AnimatedZoomJob extends AnimatedViewPortJob implements Animator.Ani pool = ObjectPool.create(8, new AnimatedZoomJob(null,null,null,null,0,0,0,0,0,0,0,0,0,0)); } - public static AnimatedZoomJob getInstance(ViewPortHandler viewPortHandler, View v, Transformer trans, YAxis axis, float xAxisRange, float scaleX, float scaleY, float xOrigin, float yOrigin, float zoomCenterX, float zoomCenterY, float zoomOriginX, float zoomOriginY, long duration) { + public static AnimatedZoomJob getInstance(ViewPortHandler viewPortHandler, View v, Transformer trans, YAxis axis, double xAxisRange, float scaleX, float scaleY, float xOrigin, float yOrigin, float zoomCenterX, float zoomCenterY, float zoomOriginX, float zoomOriginY, long duration) { AnimatedZoomJob result = pool.get(); result.mViewPortHandler = viewPortHandler; result.xValue = scaleX; @@ -48,7 +48,7 @@ public static AnimatedZoomJob getInstance(ViewPortHandler viewPortHandler, View protected YAxis yAxis; - protected float xAxisRange; + protected double xAxisRange; @SuppressLint("NewApi") public AnimatedZoomJob(ViewPortHandler viewPortHandler, View v, Transformer trans, YAxis axis, float xAxisRange, float scaleX, float scaleY, float xOrigin, float yOrigin, float zoomCenterX, float zoomCenterY, float zoomOriginX, float zoomOriginY, long duration) { @@ -67,15 +67,15 @@ public AnimatedZoomJob(ViewPortHandler viewPortHandler, View v, Transformer tran @Override public void onAnimationUpdate(ValueAnimator animation) { - float scaleX = xOrigin + (xValue - xOrigin) * phase; - float scaleY = yOrigin + (yValue - yOrigin) * phase; + double scaleX = xOrigin + (xValue - xOrigin) * phase; + double scaleY = yOrigin + (yValue - yOrigin) * phase; Matrix save = mOnAnimationUpdateMatrixBuffer; mViewPortHandler.setZoom(scaleX, scaleY, save); mViewPortHandler.refresh(save, view, false); - float valsInView = yAxis.mAxisRange / mViewPortHandler.getScaleY(); - float xsInView = xAxisRange / mViewPortHandler.getScaleX(); + float valsInView = (float)yAxis.mAxisRange / mViewPortHandler.getScaleY(); + float xsInView = (float)xAxisRange / mViewPortHandler.getScaleX(); pts[0] = zoomOriginX + ((zoomCenterX - xsInView / 2f) - zoomOriginX) * phase; pts[1] = zoomOriginY + ((zoomCenterY + valsInView / 2f) - zoomOriginY) * phase; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/MoveViewJob.java b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/MoveViewJob.java index 46b56b1347..800c5eec67 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/MoveViewJob.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/MoveViewJob.java @@ -33,15 +33,15 @@ public static void recycleInstance(MoveViewJob instance){ pool.recycle(instance); } - public MoveViewJob(ViewPortHandler viewPortHandler, float xValue, float yValue, Transformer trans, View v) { + public MoveViewJob(ViewPortHandler viewPortHandler, double xValue, double yValue, Transformer trans, View v) { super(viewPortHandler, xValue, yValue, trans, v); } @Override public void run() { - pts[0] = xValue; - pts[1] = yValue; + pts[0] = (float)xValue; + pts[1] = (float)yValue; mTrans.pointValuesToPixel(pts); mViewPortHandler.centerViewPort(pts, view); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ViewPortJob.java b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ViewPortJob.java index c424e4b87a..55a32e41e7 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ViewPortJob.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ViewPortJob.java @@ -21,12 +21,12 @@ public abstract class ViewPortJob extends ObjectPool.Poolable implements Runnabl protected float[] pts = new float[2]; protected ViewPortHandler mViewPortHandler; - protected float xValue = 0f; - protected float yValue = 0f; + protected double xValue = 0d; + protected double yValue = 0d; protected Transformer mTrans; protected View view; - public ViewPortJob(ViewPortHandler viewPortHandler, float xValue, float yValue, + public ViewPortJob(ViewPortHandler viewPortHandler, double xValue, double yValue, Transformer trans, View v) { this.mViewPortHandler = viewPortHandler; @@ -37,11 +37,11 @@ public ViewPortJob(ViewPortHandler viewPortHandler, float xValue, float yValue, } - public float getXValue() { + public double getXValue() { return xValue; } - public float getYValue() { + public double getYValue() { return yValue; } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ZoomJob.java b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ZoomJob.java index c39586ca87..672da10dff 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ZoomJob.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/jobs/ZoomJob.java @@ -66,8 +66,8 @@ public void run() { float yValsInView = ((BarLineChartBase) view).getAxis(axisDependency).mAxisRange / mViewPortHandler.getScaleY(); float xValsInView = ((BarLineChartBase) view).getXAxis().mAxisRange / mViewPortHandler.getScaleX(); - pts[0] = xValue - xValsInView / 2f; - pts[1] = yValue + yValsInView / 2f; + pts[0] = (float)xValue - xValsInView / 2f; + pts[1] = (float)yValue + yValsInView / 2f; mTrans.pointValuesToPixel(pts); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/AxisRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/AxisRenderer.java index 90528a1359..46cb58308a 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/AxisRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/AxisRenderer.java @@ -115,7 +115,7 @@ public Transformer getTransformer() { * @param min - the minimum value in the data object for this axis * @param max - the maximum value in the data object for this axis */ - public void computeAxis(float min, float max, boolean inverted) { + public void computeAxis(double min, double max, boolean inverted) { // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) @@ -146,17 +146,17 @@ public void computeAxis(float min, float max, boolean inverted) { * * @return */ - protected void computeAxisValues(float min, float max) { + protected void computeAxisValues(double min, double max) { - float yMin = min; - float yMax = max; + double yMin = min; + double yMax = max; int labelCount = mAxis.getLabelCount(); double range = Math.abs(yMax - yMin); if (labelCount == 0 || range <= 0 || Double.isInfinite(range)) { - mAxis.mEntries = new float[]{}; - mAxis.mCenteredEntries = new float[]{}; + mAxis.mEntries = new double[]{}; + mAxis.mCenteredEntries = new double[]{}; mAxis.mEntryCount = 0; return; } @@ -189,10 +189,10 @@ protected void computeAxisValues(float min, float max) { if (mAxis.mEntries.length < labelCount) { // Ensure stops contains at least numStops elements. - mAxis.mEntries = new float[labelCount]; + mAxis.mEntries = new double[labelCount]; } - float v = min; + double v = min; for (int i = 0; i < labelCount; i++) { mAxis.mEntries[i] = v; @@ -224,7 +224,7 @@ protected void computeAxisValues(float min, float max) { if (mAxis.mEntries.length < n) { // Ensure stops contains at least numStops elements. - mAxis.mEntries = new float[n]; + mAxis.mEntries = new double[n]; } for (f = first, i = 0; i < n; f += interval, ++i) { @@ -246,7 +246,7 @@ protected void computeAxisValues(float min, float max) { if (mAxis.isCenterAxisLabelsEnabled()) { if (mAxis.mCenteredEntries.length < n) { - mAxis.mCenteredEntries = new float[n]; + mAxis.mCenteredEntries = new double[n]; } float offset = (float)interval / 2f; diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BarChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BarChartRenderer.java index d3f71af02c..5569f7b804 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BarChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BarChartRenderer.java @@ -114,7 +114,7 @@ protected void drawDataSet(Canvas c, IBarDataSet dataSet, int index) { BarEntry e = dataSet.getEntryForIndex(i); - x = e.getX(); + x = e.getFloatX(); mBarShadowRectBuffer.left = x - barWidthHalf; mBarShadowRectBuffer.right = x + barWidthHalf; @@ -201,12 +201,12 @@ protected void drawDataSet(Canvas c, IBarDataSet dataSet, int index) { } } - protected void prepareBarHighlight(float x, float y1, float y2, float barWidthHalf, Transformer trans) { + protected void prepareBarHighlight(double x, double y1, double y2, float barWidthHalf, Transformer trans) { - float left = x - barWidthHalf; - float right = x + barWidthHalf; - float top = y1; - float bottom = y2; + float left = (float)x - barWidthHalf; + float right = (float)x + barWidthHalf; + float top = (float)y1; + float bottom = (float)y2; mBarRect.set(left, top, right, bottom); @@ -273,7 +273,7 @@ public void drawValues(Canvas c) { continue; BarEntry entry = dataSet.getEntryForIndex(j / 4); - float val = entry.getY(); + double val = entry.getY(); if (dataSet.isDrawValuesEnabled()) { drawValue(c, dataSet.getValueFormatter(), val, entry, i, x, @@ -317,7 +317,7 @@ public void drawValues(Canvas c) { BarEntry entry = dataSet.getEntryForIndex(index); - float[] vals = entry.getYVals(); + double[] vals = entry.getYVals(); float x = (buffer.buffer[bufferIndex] + buffer.buffer[bufferIndex + 2]) / 2f; int color = dataSet.getValueTextColor(index); @@ -371,7 +371,7 @@ public void drawValues(Canvas c) { for (int k = 0, idx = 0; k < transformed.length; k += 2, idx++) { - float value = vals[idx]; + float value = (float)vals[idx]; float y; if (value == 0.0f && (posY == 0.0f || negY == 0.0f)) { @@ -392,7 +392,7 @@ public void drawValues(Canvas c) { for (int k = 0; k < transformed.length; k += 2) { - final float val = vals[k / 2]; + final double val = vals[k / 2]; final boolean drawBelow = (val == 0.0f && negY == 0.0f && posY > 0.0f) || val < 0.0f; @@ -466,8 +466,8 @@ public void drawHighlighted(Canvas c, Highlight[] indices) { boolean isStack = (high.getStackIndex() >= 0 && e.isStacked()) ? true : false; - final float y1; - final float y2; + final double y1; + final double y2; if (isStack) { diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BubbleChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BubbleChartRenderer.java index 17bba048b9..fbee9d1208 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BubbleChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/BubbleChartRenderer.java @@ -89,8 +89,8 @@ protected void drawDataSet(Canvas c, IBubbleDataSet dataSet) { final BubbleEntry entry = dataSet.getEntryForIndex(j); - pointBuffer[0] = entry.getX(); - pointBuffer[1] = (entry.getY()) * phaseY; + pointBuffer[0] = entry.getFloatX(); + pointBuffer[1] = (entry.getFloatY()) * phaseY; trans.pointValuesToPixel(pointBuffer); float shapeHalf = getShapeSize(entry.getSize(), dataSet.getMaxSize(), referenceSize, normalizeSize) / 2f; @@ -235,8 +235,8 @@ public void drawHighlighted(Canvas c, Highlight[] indices) { mViewPortHandler.contentBottom() - mViewPortHandler.contentTop()); final float referenceSize = Math.min(maxBubbleHeight, maxBubbleWidth); - pointBuffer[0] = entry.getX(); - pointBuffer[1] = (entry.getY()) * phaseY; + pointBuffer[0] = entry.getFloatX(); + pointBuffer[1] = (entry.getFloatY()) * phaseY; trans.pointValuesToPixel(pointBuffer); high.setDraw(pointBuffer[0], pointBuffer[1]); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CandleStickChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CandleStickChartRenderer.java index e4c06fe46c..705565e2d5 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CandleStickChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/CandleStickChartRenderer.java @@ -75,7 +75,7 @@ protected void drawDataSet(Canvas c, ICandleDataSet dataSet) { if (e == null) continue; - final float xPos = e.getX(); + final float xPos = e.getFloatX(); final float open = e.getOpen(); final float close = e.getClose(); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/DataRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/DataRenderer.java index e8e5446f4d..193ee01252 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/DataRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/DataRenderer.java @@ -147,7 +147,7 @@ protected void applyValueTextStyle(IDataSet set) { * @param y position * @param color */ - public void drawValue(Canvas c, IValueFormatter formatter, float value, Entry entry, int dataSetIndex, float x, float y, int color) { + public void drawValue(Canvas c, IValueFormatter formatter, double value, Entry entry, int dataSetIndex, float x, float y, int color) { mValuePaint.setColor(color); c.drawText(formatter.getFormattedValue(value, entry, dataSetIndex, mViewPortHandler), x, y, mValuePaint); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/HorizontalBarChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/HorizontalBarChartRenderer.java index a1e1650865..47d1d3153f 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/HorizontalBarChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/HorizontalBarChartRenderer.java @@ -81,7 +81,7 @@ protected void drawDataSet(Canvas c, IBarDataSet dataSet, int index) { BarEntry e = dataSet.getEntryForIndex(i); - x = e.getX(); + x = e.getFloatX(); mBarShadowRectBuffer.top = x - barWidthHalf; mBarShadowRectBuffer.bottom = x + barWidthHalf; @@ -195,7 +195,7 @@ public void drawValues(Canvas c) { continue; BarEntry entry = dataSet.getEntryForIndex(j / 4); - float val = entry.getY(); + double val = entry.getY(); String formattedValue = formatter.getFormattedValue(val, entry, i, mViewPortHandler); // calculate the correct offset depending on the draw position of the value @@ -249,7 +249,7 @@ public void drawValues(Canvas c) { BarEntry entry = dataSet.getEntryForIndex(index); int color = dataSet.getValueTextColor(index); - float[] vals = entry.getYVals(); + double[] vals = entry.getYVals(); // we still draw stacked bars, but there is one // non-stacked @@ -265,7 +265,7 @@ public void drawValues(Canvas c) { if (!mViewPortHandler.isInBoundsBottom(buffer.buffer[bufferIndex + 1])) continue; - float val = entry.getY(); + double val = entry.getY(); String formattedValue = formatter.getFormattedValue(val, entry, i, mViewPortHandler); @@ -315,12 +315,12 @@ public void drawValues(Canvas c) { for (int k = 0, idx = 0; k < transformed.length; k += 2, idx++) { - float value = vals[idx]; + double value = vals[idx]; float y; if (value == 0.0f && (posY == 0.0f || negY == 0.0f)) { // Take care of the situation of a 0.0 value, which overlaps a non-zero bar - y = value; + y = (float)value; } else if (value >= 0.0f) { posY += value; y = posY; @@ -336,7 +336,7 @@ public void drawValues(Canvas c) { for (int k = 0; k < transformed.length; k += 2) { - final float val = vals[k / 2]; + final double val = vals[k / 2]; String formattedValue = formatter.getFormattedValue(val, entry, i, mViewPortHandler); @@ -402,12 +402,12 @@ protected void drawValue(Canvas c, String valueText, float x, float y, int color } @Override - protected void prepareBarHighlight(float x, float y1, float y2, float barWidthHalf, Transformer trans) { + protected void prepareBarHighlight(double x, double y1, double y2, float barWidthHalf, Transformer trans) { - float top = x - barWidthHalf; - float bottom = x + barWidthHalf; - float left = y1; - float right = y2; + float top = (float)x - barWidthHalf; + float bottom = (float)x + barWidthHalf; + float left = (float)y1; + float right = (float)y2; mBarRect.set(left, top, right, bottom); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java index a0e1777569..c7f5b4053a 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/LineChartRenderer.java @@ -146,20 +146,20 @@ protected void drawHorizontalBezier(ILineDataSet dataSet) { Entry cur = prev; // let the spline start - cubicPath.moveTo(cur.getX(), cur.getY() * phaseY); + cubicPath.moveTo(cur.getFloatX(), cur.getFloatY() * phaseY); for (int j = mXBounds.min + 1; j <= mXBounds.range + mXBounds.min; j++) { prev = cur; cur = dataSet.getEntryForIndex(j); - final float cpx = (prev.getX()) - + (cur.getX() - prev.getX()) / 2.0f; + final float cpx = (prev.getFloatX()) + + (cur.getFloatX() - prev.getFloatX()) / 2.0f; cubicPath.cubicTo( - cpx, prev.getY() * phaseY, - cpx, cur.getY() * phaseY, - cur.getX(), cur.getY() * phaseY); + cpx, prev.getFloatY() * phaseY, + cpx, cur.getFloatY() * phaseY, + cur.getFloatX(), cur.getFloatY() * phaseY); } } @@ -220,7 +220,7 @@ protected void drawCubicBezier(ILineDataSet dataSet) { if (cur == null) return; // let the spline start - cubicPath.moveTo(cur.getX(), cur.getY() * phaseY); + cubicPath.moveTo(cur.getFloatX(), cur.getFloatY() * phaseY); for (int j = mXBounds.min + 1; j <= mXBounds.range + mXBounds.min; j++) { @@ -231,14 +231,14 @@ protected void drawCubicBezier(ILineDataSet dataSet) { nextIndex = j + 1 < dataSet.getEntryCount() ? j + 1 : j; next = dataSet.getEntryForIndex(nextIndex); - prevDx = (cur.getX() - prevPrev.getX()) * intensity; - prevDy = (cur.getY() - prevPrev.getY()) * intensity; - curDx = (next.getX() - prev.getX()) * intensity; - curDy = (next.getY() - prev.getY()) * intensity; + prevDx = (cur.getFloatX() - prevPrev.getFloatX()) * intensity; + prevDy = (cur.getFloatY() - prevPrev.getFloatY()) * intensity; + curDx = (next.getFloatX() - prev.getFloatX()) * intensity; + curDy = (next.getFloatY() - prev.getFloatY()) * intensity; - cubicPath.cubicTo(prev.getX() + prevDx, (prev.getY() + prevDy) * phaseY, - cur.getX() - curDx, - (cur.getY() - curDy) * phaseY, cur.getX(), cur.getY() * phaseY); + cubicPath.cubicTo(prev.getFloatX() + prevDx, (prev.getFloatY() + prevDy) * phaseY, + cur.getFloatX() - curDx, + (cur.getFloatY() - curDy) * phaseY, cur.getFloatX(), cur.getFloatY() * phaseY); } } @@ -264,11 +264,11 @@ protected void drawCubicBezier(ILineDataSet dataSet) { protected void drawCubicFill(Canvas c, ILineDataSet dataSet, Path spline, Transformer trans, XBounds bounds) { - float fillMin = dataSet.getFillFormatter() + float fillMin = (float)dataSet.getFillFormatter() .getFillLinePosition(dataSet, mChart); - spline.lineTo(dataSet.getEntryForIndex(bounds.min + bounds.range).getX(), fillMin); - spline.lineTo(dataSet.getEntryForIndex(bounds.min).getX(), fillMin); + spline.lineTo(dataSet.getEntryForIndex(bounds.min + bounds.range).getFloatX(), fillMin); + spline.lineTo(dataSet.getEntryForIndex(bounds.min).getFloatX(), fillMin); spline.close(); trans.pathValueToPixel(spline); @@ -331,8 +331,8 @@ protected void drawLinear(Canvas c, ILineDataSet dataSet) { Entry e = dataSet.getEntryForIndex(j); if (e == null) continue; - mLineBuffer[0] = e.getX(); - mLineBuffer[1] = e.getY() * phaseY; + mLineBuffer[0] = e.getFloatX(); + mLineBuffer[1] = e.getFloatY() * phaseY; if (j < mXBounds.max) { @@ -341,15 +341,15 @@ protected void drawLinear(Canvas c, ILineDataSet dataSet) { if (e == null) break; if (isDrawSteppedEnabled) { - mLineBuffer[2] = e.getX(); + mLineBuffer[2] = e.getFloatX(); mLineBuffer[3] = mLineBuffer[1]; mLineBuffer[4] = mLineBuffer[2]; mLineBuffer[5] = mLineBuffer[3]; - mLineBuffer[6] = e.getX(); - mLineBuffer[7] = e.getY() * phaseY; + mLineBuffer[6] = e.getFloatX(); + mLineBuffer[7] = e.getFloatY() * phaseY; } else { - mLineBuffer[2] = e.getX(); - mLineBuffer[3] = e.getY() * phaseY; + mLineBuffer[2] = e.getFloatX(); + mLineBuffer[3] = e.getFloatY() * phaseY; } } else { @@ -394,18 +394,18 @@ protected void drawLinear(Canvas c, ILineDataSet dataSet) { if (e1 == null || e2 == null) continue; - mLineBuffer[j++] = e1.getX(); - mLineBuffer[j++] = e1.getY() * phaseY; + mLineBuffer[j++] = e1.getFloatX(); + mLineBuffer[j++] = e1.getFloatY() * phaseY; if (isDrawSteppedEnabled) { - mLineBuffer[j++] = e2.getX(); - mLineBuffer[j++] = e1.getY() * phaseY; - mLineBuffer[j++] = e2.getX(); - mLineBuffer[j++] = e1.getY() * phaseY; + mLineBuffer[j++] = e2.getFloatX(); + mLineBuffer[j++] = e1.getFloatY() * phaseY; + mLineBuffer[j++] = e2.getFloatX(); + mLineBuffer[j++] = e1.getFloatY() * phaseY; } - mLineBuffer[j++] = e2.getX(); - mLineBuffer[j++] = e2.getY() * phaseY; + mLineBuffer[j++] = e2.getFloatX(); + mLineBuffer[j++] = e2.getFloatY() * phaseY; } if (j > 0) { @@ -483,7 +483,7 @@ protected void drawLinearFill(Canvas c, ILineDataSet dataSet, Transformer trans, */ private void generateFilledPath(final ILineDataSet dataSet, final int startIndex, final int endIndex, final Path outputPath) { - final float fillMin = dataSet.getFillFormatter().getFillLinePosition(dataSet, mChart); + final float fillMin = (float)dataSet.getFillFormatter().getFillLinePosition(dataSet, mChart); final float phaseY = mAnimator.getPhaseY(); final boolean isDrawSteppedEnabled = dataSet.getMode() == LineDataSet.Mode.STEPPED; @@ -492,8 +492,8 @@ private void generateFilledPath(final ILineDataSet dataSet, final int startIndex final Entry entry = dataSet.getEntryForIndex(startIndex); - filled.moveTo(entry.getX(), fillMin); - filled.lineTo(entry.getX(), entry.getY() * phaseY); + filled.moveTo(entry.getFloatX(), fillMin); + filled.lineTo(entry.getFloatX(), entry.getFloatY() * phaseY); // create a new path Entry currentEntry = null; @@ -503,17 +503,17 @@ private void generateFilledPath(final ILineDataSet dataSet, final int startIndex currentEntry = dataSet.getEntryForIndex(x); if (isDrawSteppedEnabled && previousEntry != null) { - filled.lineTo(currentEntry.getX(), previousEntry.getY() * phaseY); + filled.lineTo(currentEntry.getFloatX(), previousEntry.getFloatY() * phaseY); } - filled.lineTo(currentEntry.getX(), currentEntry.getY() * phaseY); + filled.lineTo(currentEntry.getFloatX(), currentEntry.getFloatY() * phaseY); previousEntry = currentEntry; } // close up if (currentEntry != null) { - filled.lineTo(currentEntry.getX(), fillMin); + filled.lineTo(currentEntry.getFloatX(), fillMin); } filled.close(); @@ -662,8 +662,8 @@ protected void drawCircles(Canvas c) { if (e == null) break; - mCirclesBuffer[0] = e.getX(); - mCirclesBuffer[1] = e.getY() * phaseY; + mCirclesBuffer[0] = e.getFloatX(); + mCirclesBuffer[1] = e.getFloatY() * phaseY; trans.pointValuesToPixel(mCirclesBuffer); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java index 8c37a0b83d..65263bccb6 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java @@ -206,7 +206,7 @@ protected float getSliceSpace(IPieDataSet dataSet) { return dataSet.getSliceSpace(); float spaceSizeRatio = dataSet.getSliceSpace() / mViewPortHandler.getSmallestContentExtension(); - float minValueRatio = dataSet.getYMin() / mChart.getData().getYValueSum() * 2; + float minValueRatio = (float)(dataSet.getYMin() / mChart.getData().getYValueSum() * 2); float sliceSpace = spaceSizeRatio > minValueRatio ? 0f : dataSet.getSliceSpace(); @@ -409,7 +409,7 @@ public void drawValues(Canvas c) { PieData data = mChart.getData(); List dataSets = data.getDataSets(); - float yValueSum = data.getYValueSum(); + double yValueSum = data.getYValueSum(); boolean drawEntryLabels = mChart.isDrawEntryLabelsEnabled(); @@ -470,8 +470,8 @@ public void drawValues(Canvas c) { final float transformedAngle = rotationAngle + angle * phaseY; - float value = mChart.isUsePercentValuesEnabled() ? entry.getY() - / yValueSum * 100f : entry.getY(); + double value = mChart.isUsePercentValuesEnabled() ? entry.getY() + / yValueSum * 100d : entry.getY(); final float sliceXBase = (float) Math.cos(transformedAngle * Utils.FDEG2RAD); final float sliceYBase = (float) Math.sin(transformedAngle * Utils.FDEG2RAD); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/RadarChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/RadarChartRenderer.java index dbf0e8f807..950aca8f88 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/RadarChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/RadarChartRenderer.java @@ -86,7 +86,7 @@ protected void drawDataSet(Canvas c, IRadarDataSet dataSet, int mostEntries) { // calculate the factor that is needed for transforming the value to // pixels - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); MPPointF center = mChart.getCenterOffsets(); MPPointF pOut = MPPointF.getInstance(0,0); @@ -156,7 +156,7 @@ public void drawValues(Canvas c) { // calculate the factor that is needed for transforming the value to // pixels - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); MPPointF center = mChart.getCenterOffsets(); MPPointF pOut = MPPointF.getInstance(0,0); @@ -242,7 +242,7 @@ protected void drawWeb(Canvas c) { // calculate the factor that is needed for transforming the value to // pixels - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); float rotationangle = mChart.getRotationAngle(); MPPointF center = mChart.getCenterOffsets(); @@ -281,7 +281,7 @@ protected void drawWeb(Canvas c) { for (int i = 0; i < mChart.getData().getEntryCount(); i++) { - float r = (mChart.getYAxis().mEntries[j] - mChart.getYChartMin()) * factor; + double r = (mChart.getYAxis().mEntries[j] - mChart.getYChartMin()) * factor; Utils.getPosition(center, r, sliceangle * i + rotationangle, p1out); Utils.getPosition(center, r, sliceangle * (i + 1) + rotationangle, p2out); @@ -302,7 +302,7 @@ public void drawHighlighted(Canvas c, Highlight[] indices) { // calculate the factor that is needed for transforming the value to // pixels - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); MPPointF center = mChart.getCenterOffsets(); MPPointF pOut = MPPointF.getInstance(0,0); @@ -321,7 +321,7 @@ public void drawHighlighted(Canvas c, Highlight[] indices) { if (!isInBoundsX(e, set)) continue; - float y = (e.getY() - mChart.getYChartMin()); + double y = (e.getY() - mChart.getYChartMin()); Utils.getPosition(center, y * factor * mAnimator.getPhaseY(), diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/ScatterChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/ScatterChartRenderer.java index 36a38a53c5..378709eab9 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/ScatterChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/ScatterChartRenderer.java @@ -69,8 +69,8 @@ protected void drawDataSet(Canvas c, IScatterDataSet dataSet) { Entry e = dataSet.getEntryForIndex(i); - mPixelBuffer[0] = e.getX(); - mPixelBuffer[1] = e.getY() * phaseY; + mPixelBuffer[0] = e.getFloatX(); + mPixelBuffer[1] = e.getFloatY() * phaseY; trans.pointValuesToPixel(mPixelBuffer); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java index 8adb56c73a..91091c8b3d 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRenderer.java @@ -41,7 +41,7 @@ protected void setupGridPaint() { } @Override - public void computeAxis(float min, float max, boolean inverted) { + public void computeAxis(double min, double max, boolean inverted) { // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) @@ -68,7 +68,7 @@ public void computeAxis(float min, float max, boolean inverted) { } @Override - protected void computeAxisValues(float min, float max) { + protected void computeAxisValues(double min, double max) { super.computeAxisValues(min, max); computeSize(); @@ -188,9 +188,9 @@ protected void drawLabels(Canvas c, float pos, MPPointF anchor) { // only fill x values if (centeringEnabled) { - positions[i] = mXAxis.mCenteredEntries[i / 2]; + positions[i] = (float)mXAxis.mCenteredEntries[i / 2]; } else { - positions[i] = mXAxis.mEntries[i / 2]; + positions[i] = (float)mXAxis.mEntries[i / 2]; } } @@ -247,8 +247,8 @@ public void renderGridLines(Canvas c) { float[] positions = mRenderGridLinesBuffer; for (int i = 0; i < positions.length; i += 2) { - positions[i] = mXAxis.mEntries[i / 2]; - positions[i + 1] = mXAxis.mEntries[i / 2]; + positions[i] = (float)mXAxis.mEntries[i / 2]; + positions[i + 1] = (float)mXAxis.mEntries[i / 2]; } mTrans.pointValuesToPixel(positions); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererHorizontalBarChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererHorizontalBarChart.java index 86047cf1b8..83403ac74b 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererHorizontalBarChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererHorizontalBarChart.java @@ -32,7 +32,7 @@ public XAxisRendererHorizontalBarChart(ViewPortHandler viewPortHandler, XAxis xA } @Override - public void computeAxis(float min, float max, boolean inverted) { + public void computeAxis(double min, double max, boolean inverted) { // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) @@ -43,12 +43,12 @@ public void computeAxis(float min, float max, boolean inverted) { if (inverted) { - min = (float) p2.y; - max = (float) p1.y; + min = p2.y; + max = p1.y; } else { - min = (float) p1.y; - max = (float) p2.y; + min = p1.y; + max = p2.y; } MPPointD.recycleInstance(p1); @@ -142,9 +142,9 @@ protected void drawLabels(Canvas c, float pos, MPPointF anchor) { // only fill x values if (centeringEnabled) { - positions[i + 1] = mXAxis.mCenteredEntries[i / 2]; + positions[i + 1] = (float)mXAxis.mCenteredEntries[i / 2]; } else { - positions[i + 1] = mXAxis.mEntries[i / 2]; + positions[i + 1] = (float)mXAxis.mEntries[i / 2]; } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererRadarChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererRadarChart.java index 956e8c7d5c..e636360c27 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererRadarChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/XAxisRendererRadarChart.java @@ -37,7 +37,7 @@ public void renderAxisLabels(Canvas c) { // calculate the factor that is needed for transforming the value to // pixels - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); MPPointF center = mChart.getCenterOffsets(); MPPointF pOut = MPPointF.getInstance(0,0); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java index a2bf679777..6a9490ffe5 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRenderer.java @@ -205,7 +205,7 @@ protected float[] getTransformedPositions() { for (int i = 0; i < positions.length; i += 2) { // only fill y values, x values are not needed for y-labels - positions[i + 1] = mYAxis.mEntries[i / 2]; + positions[i + 1] = (float)mYAxis.mEntries[i / 2]; } mTrans.pointValuesToPixel(positions); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererHorizontalBarChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererHorizontalBarChart.java index 71275b03c3..7a5a5d6eec 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererHorizontalBarChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererHorizontalBarChart.java @@ -34,7 +34,7 @@ public YAxisRendererHorizontalBarChart(ViewPortHandler viewPortHandler, YAxis yA * @param yMax - the maximum y-value in the data object for this axis */ @Override - public void computeAxis(float yMin, float yMax, boolean inverted) { + public void computeAxis(double yMin, double yMax, boolean inverted) { // calculate the starting and entry point of the y-labels (depending on // zoom / contentrect bounds) @@ -160,7 +160,7 @@ protected float[] getTransformedPositions() { for (int i = 0; i < positions.length; i += 2) { // only fill x values, y values are not needed for x-labels - positions[i] = mYAxis.mEntries[i / 2]; + positions[i] = (float)mYAxis.mEntries[i / 2]; } mTrans.pointValuesToPixel(positions); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererRadarChart.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererRadarChart.java index ee7392e928..0eae5330aa 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererRadarChart.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/YAxisRendererRadarChart.java @@ -24,17 +24,17 @@ public YAxisRendererRadarChart(ViewPortHandler viewPortHandler, YAxis yAxis, Rad } @Override - protected void computeAxisValues(float min, float max) { + protected void computeAxisValues(double min, double max) { - float yMin = min; - float yMax = max; + double yMin = min; + double yMax = max; int labelCount = mAxis.getLabelCount(); double range = Math.abs(yMax - yMin); if (labelCount == 0 || range <= 0 || Double.isInfinite(range)) { - mAxis.mEntries = new float[]{}; - mAxis.mCenteredEntries = new float[]{}; + mAxis.mEntries = new double[]{}; + mAxis.mCenteredEntries = new double[]{}; mAxis.mEntryCount = 0; return; } @@ -68,10 +68,10 @@ protected void computeAxisValues(float min, float max) { if (mAxis.mEntries.length < labelCount) { // Ensure stops contains at least numStops elements. - mAxis.mEntries = new float[labelCount]; + mAxis.mEntries = new double[labelCount]; } - float v = min; + double v = min; for (int i = 0; i < labelCount; i++) { mAxis.mEntries[i] = v; @@ -105,7 +105,7 @@ protected void computeAxisValues(float min, float max) { if (mAxis.mEntries.length < n) { // Ensure stops contains at least numStops elements. - mAxis.mEntries = new float[n]; + mAxis.mEntries = new double[n]; } for (f = first, i = 0; i < n; f += interval, ++i) { @@ -113,7 +113,7 @@ protected void computeAxisValues(float min, float max) { if (f == 0.0) // Fix for negative zero case (Where value == -0.0, and 0.0 == -0.0) f = 0.0; - mAxis.mEntries[i] = (float) f; + mAxis.mEntries[i] = f; } } @@ -127,10 +127,10 @@ protected void computeAxisValues(float min, float max) { if (centeringEnabled) { if (mAxis.mCenteredEntries.length < n) { - mAxis.mCenteredEntries = new float[n]; + mAxis.mCenteredEntries = new double[n]; } - float offset = (mAxis.mEntries[1] - mAxis.mEntries[0]) / 2f; + double offset = (mAxis.mEntries[1] - mAxis.mEntries[0]) / 2d; for (int i = 0; i < n; i++) { mAxis.mCenteredEntries[i] = mAxis.mEntries[i] + offset; @@ -139,7 +139,7 @@ protected void computeAxisValues(float min, float max) { mAxis.mAxisMinimum = mAxis.mEntries[0]; mAxis.mAxisMaximum = mAxis.mEntries[n-1]; - mAxis.mAxisRange = Math.abs(mAxis.mAxisMaximum - mAxis.mAxisMinimum); + mAxis.mAxisRange = (float)Math.abs(mAxis.mAxisMaximum - mAxis.mAxisMinimum); } @Override @@ -154,7 +154,7 @@ public void renderAxisLabels(Canvas c) { MPPointF center = mChart.getCenterOffsets(); MPPointF pOut = MPPointF.getInstance(0,0); - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); final int from = mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1; final int to = mYAxis.isDrawTopYLabelEntryEnabled() @@ -163,7 +163,7 @@ public void renderAxisLabels(Canvas c) { for (int j = from; j < to; j++) { - float r = (mYAxis.mEntries[j] - mYAxis.mAxisMinimum) * factor; + double r = (mYAxis.mEntries[j] - mYAxis.mAxisMinimum) * factor; Utils.getPosition(center, r, mChart.getRotationAngle(), pOut); @@ -188,7 +188,7 @@ public void renderLimitLines(Canvas c) { // calculate the factor that is needed for transforming the value to // pixels - float factor = mChart.getFactor(); + double factor = mChart.getFactor(); MPPointF center = mChart.getCenterOffsets(); MPPointF pOut = MPPointF.getInstance(0,0); @@ -203,7 +203,7 @@ public void renderLimitLines(Canvas c) { mLimitLinePaint.setPathEffect(l.getDashPathEffect()); mLimitLinePaint.setStrokeWidth(l.getLineWidth()); - float r = (l.getLimit() - mChart.getYChartMin()) * factor; + double r = (l.getLimit() - mChart.getYChartMin()) * factor; Path limitPath = mRenderLimitLinesPathBuffer; limitPath.reset(); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/EntryXComparator.java b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/EntryXComparator.java index 8f59c12d07..57be089337 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/EntryXComparator.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/EntryXComparator.java @@ -11,11 +11,11 @@ public class EntryXComparator implements Comparator { @Override public int compare(Entry entry1, Entry entry2) { - float diff = entry1.getX() - entry2.getX(); + double diff = entry1.getX() - entry2.getX(); - if (diff == 0f) return 0; + if (diff == 0d) return 0; else { - if (diff > 0f) return 1; + if (diff > 0d) return 1; else return -1; } } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java index 5aff51ff84..59a8f383d0 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java @@ -55,10 +55,10 @@ public static List loadEntriesFromFile(String path) { entries.add(new Entry(Float.parseFloat(split[0]), Integer.parseInt(split[1]))); } else { - float[] vals = new float[split.length - 1]; + double[] vals = new double[split.length - 1]; for (int i = 0; i < vals.length; i++) { - vals[i] = Float.parseFloat(split[i]); + vals[i] = Double.parseDouble(split[i]); } entries.add(new BarEntry(Integer.parseInt(split[split.length - 1]), vals)); @@ -125,10 +125,10 @@ public static List loadEntriesFromAssets(AssetManager am, String path) { entries.add(new Entry(Float.parseFloat(split[1]), Float.parseFloat(split[0]))); } else { - float[] vals = new float[split.length - 1]; + double[] vals = new double[split.length - 1]; for (int i = 0; i < vals.length; i++) { - vals[i] = Float.parseFloat(split[i]); + vals[i] = Double.parseDouble(split[i]); } entries.add(new BarEntry(Integer.parseInt(split[split.length - 1]), vals)); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Transformer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Transformer.java index 0496bd0673..db82d7f41c 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Transformer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Transformer.java @@ -47,7 +47,7 @@ public Transformer(ViewPortHandler viewPortHandler) { * @param deltaY * @param yChartMin */ - public void prepareMatrixValuePx(float xChartMin, float deltaX, float deltaY, float yChartMin) { + public void prepareMatrixValuePx(double xChartMin, double deltaX, double deltaY, double yChartMin) { float scaleX = (float) ((mViewPortHandler.contentWidth()) / deltaX); float scaleY = (float) ((mViewPortHandler.contentHeight()) / deltaY); @@ -61,7 +61,7 @@ public void prepareMatrixValuePx(float xChartMin, float deltaX, float deltaY, fl // setup all matrices mMatrixValueToPx.reset(); - mMatrixValueToPx.postTranslate(-xChartMin, -yChartMin); + mMatrixValueToPx.postTranslate((float)-xChartMin, (float)-yChartMin); mMatrixValueToPx.postScale(scaleX, -scaleY); } @@ -110,8 +110,8 @@ public float[] generateTransformedValuesScatter(IScatterDataSet data, float phas Entry e = data.getEntryForIndex(j / 2 + from); if (e != null) { - valuePoints[j] = e.getX(); - valuePoints[j + 1] = e.getY() * phaseY; + valuePoints[j] = e.getFloatX(); + valuePoints[j + 1] = e.getFloatY() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; @@ -146,8 +146,8 @@ public float[] generateTransformedValuesBubble(IBubbleDataSet data, float phaseY Entry e = data.getEntryForIndex(j / 2 + from); if (e != null) { - valuePoints[j] = e.getX(); - valuePoints[j + 1] = e.getY() * phaseY; + valuePoints[j] = e.getFloatX(); + valuePoints[j + 1] = e.getFloatY() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; @@ -184,8 +184,8 @@ public float[] generateTransformedValuesLine(ILineDataSet data, Entry e = data.getEntryForIndex(j / 2 + min); if (e != null) { - valuePoints[j] = e.getX(); - valuePoints[j + 1] = e.getY() * phaseY; + valuePoints[j] = e.getFloatX(); + valuePoints[j + 1] = e.getFloatY() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; @@ -221,7 +221,7 @@ public float[] generateTransformedValuesCandle(ICandleDataSet data, CandleEntry e = data.getEntryForIndex(j / 2 + from); if (e != null) { - valuePoints[j] = e.getX(); + valuePoints[j] = e.getFloatX(); valuePoints[j + 1] = e.getHigh() * phaseY; } else { valuePoints[j] = 0; @@ -420,10 +420,10 @@ public void getValuesByTouchPoint(float x, float y, MPPointD outputPoint) { * @param y * @return */ - public MPPointD getPixelForValues(float x, float y) { + public MPPointD getPixelForValues(double x, double y) { - ptsBuffer[0] = x; - ptsBuffer[1] = y; + ptsBuffer[0] = (float)x; + ptsBuffer[1] = (float)y; pointValuesToPixel(ptsBuffer); diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Utils.java b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Utils.java index c302673919..14507c556a 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Utils.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/Utils.java @@ -252,7 +252,7 @@ public static IValueFormatter getDefaultValueFormatter() * @param separateThousands set this to true to separate thousands values * @return */ - public static String formatNumber(float number, int digitCount, boolean separateThousands) { + public static String formatNumber(double number, int digitCount, boolean separateThousands) { return formatNumber(number, digitCount, separateThousands, '.'); } @@ -266,7 +266,7 @@ public static String formatNumber(float number, int digitCount, boolean separate * @param separateChar a caracter to be paced between the "thousands" * @return */ - public static String formatNumber(float number, int digitCount, boolean separateThousands, + public static String formatNumber(double number, int digitCount, boolean separateThousands, char separateChar) { char[] out = new char[35]; @@ -372,11 +372,11 @@ public static float roundToNextSignificant(double number) { * @param number * @return */ - public static int getDecimals(float number) { + public static int getDecimals(double number) { - float i = roundToNextSignificant(number); + double i = roundToNextSignificant(number); - if (Float.isInfinite(i)) + if (Double.isInfinite(i)) return 0; return (int) Math.ceil(-Math.log10(i)) + 2; @@ -462,7 +462,7 @@ public static MPPointF getPosition(MPPointF center, float dist, float angle) { return p; } - public static void getPosition(MPPointF center, float dist, float angle, MPPointF outputPoint){ + public static void getPosition(MPPointF center, double dist, double angle, MPPointF outputPoint){ outputPoint.x = (float) (center.x + dist * Math.cos(Math.toRadians(angle))); outputPoint.y = (float) (center.y + dist * Math.sin(Math.toRadians(angle))); } diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ViewPortHandler.java b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ViewPortHandler.java index 71b4b9bf79..8086fabef6 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ViewPortHandler.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/ViewPortHandler.java @@ -289,10 +289,10 @@ public Matrix setZoom(float scaleX, float scaleY) { return save; } - public void setZoom(float scaleX, float scaleY, Matrix outputMatrix) { + public void setZoom(double scaleX, double scaleY, Matrix outputMatrix) { outputMatrix.reset(); outputMatrix.set(mMatrixTouch); - outputMatrix.setScale(scaleX, scaleY); + outputMatrix.setScale((float)scaleX, (float)scaleY); } /**