From fda479e63ee1f62c15917032a99b2ea3f398ba56 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Mon, 22 Dec 2025 08:57:08 +0100 Subject: [PATCH 1/3] Cleanup FileUtils --- .../mikephil/charting/utils/FileUtils.java | 178 ------------------ .../github/mikephil/charting/utils/Utils.java | 96 ---------- 2 files changed, 274 deletions(-) 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 81af7c6dc..1da494da4 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 @@ -2,17 +2,12 @@ package com.github.mikephil.charting.utils; import android.content.res.AssetManager; -import android.os.Environment; import android.util.Log; import com.github.mikephil.charting.data.BarEntry; import com.github.mikephil.charting.data.Entry; import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; @@ -29,76 +24,6 @@ public class FileUtils { private static final String LOG = "Chart-FileUtils"; - /** - * Loads a an Array of Entries from a textfile from the sd-card. - * - * @param path the name of the file on the sd-card (+ path if needed) - */ - public static List loadEntriesFromFile(String path) { - - File sdcard = Environment.getExternalStorageDirectory(); - - // Get the text file - File file = new File(sdcard, path); - - List entries = new ArrayList<>(); - - try { - @SuppressWarnings("resource") - BufferedReader br = new BufferedReader(new FileReader(file)); - String line; - - while ((line = br.readLine()) != null) { - String[] split = line.split("#"); - - if (split.length <= 2) { - entries.add(new Entry(Float.parseFloat(split[0]), Integer.parseInt(split[1]))); - } else { - - float[] vals = new float[split.length - 1]; - - for (int i = 0; i < vals.length; i++) { - vals[i] = Float.parseFloat(split[i]); - } - - entries.add(new BarEntry(Integer.parseInt(split[split.length - 1]), vals)); - } - } - } catch (IOException e) { - Log.e(LOG, e.toString()); - } - - return entries; - - // File sdcard = Environment.getExternalStorageDirectory(); - // - // // Get the text file - // File file = new File(sdcard, path); - // - // List entries = new ArrayList(); - // String label = ""; - // - // try { - // @SuppressWarnings("resource") - // BufferedReader br = new BufferedReader(new FileReader(file)); - // String line = br.readLine(); - // - // // firstline is the label - // label = line; - // - // while ((line = br.readLine()) != null) { - // String[] split = line.split("#"); - // entries.add(new Entry(Float.parseFloat(split[0]), - // Integer.parseInt(split[1]))); - // } - // } catch (IOException e) { - // Log.e(LOG, e.toString()); - // } - // - // DataSet ds = new DataSet(entries, label); - // return ds; - } - /** * Loads an array of Entries from a textfile from the assets folder. * @@ -137,73 +62,6 @@ public static List loadEntriesFromAssets(AssetManager am, String path) { } return entries; - - // String label = null; - // List entries = new ArrayList(); - // - // BufferedReader reader = null; - // try { - // reader = new BufferedReader( - // new InputStreamReader(am.open(path), "UTF-8")); - // - // // do reading, usually loop until end of file reading - // label = reader.readLine(); - // String line = reader.readLine(); - // - // while (line != null) { - // // process line - // String[] split = line.split("#"); - // entries.add(new Entry(Float.parseFloat(split[0]), - // Integer.parseInt(split[1]))); - // line = reader.readLine(); - // } - // } catch (IOException e) { - // Log.e(LOG, e.toString()); - // - // } finally { - // - // if (reader != null) { - // try { - // reader.close(); - // } catch (IOException e) { - // Log.e(LOG, e.toString()); - // } - // } - // } - // - // DataSet ds = new DataSet(entries, label); - // return ds; - } - - /** - * Saves an Array of Entries to the specified location on the sdcard - */ - public static void saveToSdCard(List entries, String path) { - - File sdcard = Environment.getExternalStorageDirectory(); - - File saved = new File(sdcard, path); - if (!saved.exists()) { - try { - saved.createNewFile(); - } catch (IOException e) { - Log.e(LOG, e.toString()); - } - } - try { - // BufferedWriter for performance, true to set append to file flag - BufferedWriter buf = new BufferedWriter(new FileWriter(saved, true)); - - for (Entry e : entries) { - - buf.append(e.getY() + "#" + e.getX()); - buf.newLine(); - } - - buf.close(); - } catch (IOException e) { - Log.e(LOG, e.toString()); - } } public static List loadBarEntriesFromAssets(AssetManager am, String path) { @@ -229,41 +87,5 @@ public static List loadBarEntriesFromAssets(AssetManager am, String pa } return entries; - - // String label = null; - // ArrayList entries = new ArrayList(); - // - // BufferedReader reader = null; - // try { - // reader = new BufferedReader( - // new InputStreamReader(am.open(path), "UTF-8")); - // - // // do reading, usually loop until end of file reading - // label = reader.readLine(); - // String line = reader.readLine(); - // - // while (line != null) { - // // process line - // String[] split = line.split("#"); - // entries.add(new Entry(Float.parseFloat(split[0]), - // Integer.parseInt(split[1]))); - // line = reader.readLine(); - // } - // } catch (IOException e) { - // Log.e(LOG, e.toString()); - // - // } finally { - // - // if (reader != null) { - // try { - // reader.close(); - // } catch (IOException e) { - // Log.e(LOG, e.toString()); - // } - // } - // } - // - // DataSet ds = new DataSet(entries, label); - // return ds; } } 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 1b5ec3a1b..9a303a4e1 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 @@ -6,8 +6,6 @@ import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.text.StaticLayout; -import android.text.TextPaint; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.ViewConfiguration; @@ -146,23 +144,6 @@ public static IValueFormatter getDefaultValueFormatter() { return mDefaultValueFormatter; } - /** - * rounds the given number to the next significant number - */ - public static float roundToNextSignificant(double number) { - if (Double.isInfinite(number) || - Double.isNaN(number) || - number == 0.0) { - return 0; - } - - final float d = (float) Math.ceil((float) Math.log10(number < 0 ? -number : number)); - final int pw = 1 - (int) d; - final float magnitude = (float) Math.pow(10, pw); - final long shifted = Math.round(number * magnitude); - return shifted / magnitude; - } - /** * Returns a recyclable MPPointF instance. * Calculates the position around a center point, depending on the distance @@ -315,83 +296,6 @@ public static void drawXAxisValue(Canvas canvas, String text, float x, float y, paint.setTextAlign(originalTextAlign); } - public static void drawMultilineText(Canvas canvas, StaticLayout textLayout, - float x, float y, - TextPaint paint, - MPPointF anchor, float angleDegrees) { - - float drawOffsetX = 0.f; - float drawOffsetY = 0.f; - float drawWidth; - float drawHeight; - - final float lineHeight = paint.getFontMetrics(mFontMetricsBuffer); - - drawWidth = textLayout.getWidth(); - drawHeight = textLayout.getLineCount() * lineHeight; - - // Android sometimes has pre-padding - drawOffsetX -= mDrawTextRectBuffer.left; - - // Android does not snap the bounds to line boundaries, - // and draws from bottom to top. - // And we want to normalize it. - drawOffsetY += drawHeight; - - // To have a consistent point of reference, we always draw left-aligned - Paint.Align originalTextAlign = paint.getTextAlign(); - paint.setTextAlign(Paint.Align.LEFT); - - if (angleDegrees != 0.f) { - - // Move the text drawing rect in a way that it always rotates around its center - drawOffsetX -= drawWidth * 0.5f; - drawOffsetY -= drawHeight * 0.5f; - - float translateX = x; - float translateY = y; - - // Move the "outer" rect relative to the anchor, assuming its centered - if (anchor.getX() != 0.5f || anchor.getY() != 0.5f) { - final FSize rotatedSize = getSizeOfRotatedRectangleByDegrees( - drawWidth, - drawHeight, - angleDegrees); - - translateX -= rotatedSize.getWidth() * (anchor.getX() - 0.5f); - translateY -= rotatedSize.getHeight() * (anchor.getY() - 0.5f); - FSize.Companion.recycleInstance(rotatedSize); - } - - canvas.save(); - canvas.translate(translateX, translateY); - canvas.rotate(angleDegrees); - - canvas.translate(drawOffsetX, drawOffsetY); - textLayout.draw(canvas); - - canvas.restore(); - } else { - if (anchor.getX() != 0.f || anchor.getY() != 0.f) { - - drawOffsetX -= drawWidth * anchor.getX(); - drawOffsetY -= drawHeight * anchor.getY(); - } - - drawOffsetX += x; - drawOffsetY += y; - - canvas.save(); - - canvas.translate(drawOffsetX, drawOffsetY); - textLayout.draw(canvas); - - canvas.restore(); - } - - paint.setTextAlign(originalTextAlign); - } - /** * Returns a recyclable FSize instance. * Represents size of a rotated rectangle by degrees. From 7253d1a6666071d226be34cf14a2b0ce5a346005 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Mon, 22 Dec 2025 08:59:26 +0100 Subject: [PATCH 2/3] Kotlin FileUtils --- .../mikephil/charting/utils/FileUtils.java | 91 ------------------- .../mikephil/charting/utils/FileUtils.kt | 74 +++++++++++++++ 2 files changed, 74 insertions(+), 91 deletions(-) delete mode 100644 MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java create mode 100644 MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt 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 deleted file mode 100644 index 1da494da4..000000000 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.java +++ /dev/null @@ -1,91 +0,0 @@ - -package com.github.mikephil.charting.utils; - -import android.content.res.AssetManager; -import android.util.Log; - -import com.github.mikephil.charting.data.BarEntry; -import com.github.mikephil.charting.data.Entry; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - -/** - * Utilities class for interacting with the assets and the devices storage to - * load and save DataSet objects from and to .txt files. - * - * @author Philipp Jahoda - */ -public class FileUtils { - - private static final String LOG = "Chart-FileUtils"; - - /** - * Loads an array of Entries from a textfile from the assets folder. - * - * @param path the name of the file in the assets folder (+ path if needed) - */ - public static List loadEntriesFromAssets(AssetManager am, String path) { - - List entries = new ArrayList<>(); - - try (BufferedReader reader = new BufferedReader( - new InputStreamReader(am.open(path), StandardCharsets.UTF_8))) { - - String line = reader.readLine(); - - while (line != null) { - // process line - String[] split = line.split("#"); - - if (split.length <= 2) { - entries.add(new Entry(Float.parseFloat(split[1]), Float.parseFloat(split[0]))); - } else { - - float[] vals = new float[split.length - 1]; - - for (int i = 0; i < vals.length; i++) { - vals[i] = Float.parseFloat(split[i]); - } - - entries.add(new BarEntry(Integer.parseInt(split[split.length - 1]), vals)); - } - line = reader.readLine(); - } - } catch (IOException e) { - Log.e(LOG, e.toString()); - - } - - return entries; - } - - public static List loadBarEntriesFromAssets(AssetManager am, String path) { - - List entries = new ArrayList<>(); - - try (BufferedReader reader = new BufferedReader( - new InputStreamReader(am.open(path), StandardCharsets.UTF_8))) { - - String line = reader.readLine(); - - while (line != null) { - // process line - String[] split = line.split("#"); - - entries.add(new BarEntry(Float.parseFloat(split[1]), Float.parseFloat(split[0]))); - - line = reader.readLine(); - } - } catch (IOException e) { - Log.e(LOG, e.toString()); - - } - - return entries; - } -} diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt new file mode 100644 index 000000000..fe2e5e5c2 --- /dev/null +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt @@ -0,0 +1,74 @@ +package com.github.mikephil.charting.utils + +import android.content.res.AssetManager +import android.util.Log +import com.github.mikephil.charting.data.BarEntry +import com.github.mikephil.charting.data.Entry +import java.io.BufferedReader +import java.io.IOException +import java.io.InputStreamReader +import java.nio.charset.StandardCharsets + +/** + * Utilities class for interacting with the assets and the devices storage to load and save DataSet objects from and to .txt files. + */ +object FileUtils { + private const val LOG = "Chart-FileUtils" + + /** + * Loads an array of Entries from a textfile from the assets folder. + * + * @param path the name of the file in the assets folder (+ path if needed) + */ + fun loadEntriesFromAssets(am: AssetManager, path: String): MutableList { + val entries: MutableList = ArrayList() + + try { + BufferedReader( + InputStreamReader(am.open(path), StandardCharsets.UTF_8) + ).use { reader -> + var line = reader.readLine() + while (line != null) { + // process line + val split: Array = line.split("#".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + + if (split.size <= 2) { + entries.add(Entry(split[1]!!.toFloat(), split[0]!!.toFloat())) + } else { + val vals = FloatArray(split.size - 1) + + for (i in vals.indices) { + vals[i] = split[i]!!.toFloat() + } + + entries.add(BarEntry(split[split.size - 1]!!.toInt().toFloat(), vals)) + } + line = reader.readLine() + } + } + } catch (e: IOException) { + Log.e(LOG, e.toString()) + } + + return entries + } + + fun loadBarEntriesFromAssets(am: AssetManager, path: String): MutableList { + val entries: MutableList = ArrayList() + + try { + BufferedReader(InputStreamReader(am.open(path), StandardCharsets.UTF_8)).use { reader -> + var line = reader.readLine() + while (line != null) { + val split: Array = line.split("#".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + entries.add(BarEntry(split[1]!!.toFloat(), split[0]!!.toFloat())) + line = reader.readLine() + } + } + } catch (e: IOException) { + Log.e(LOG, e.toString()) + } + + return entries + } +} From 6d2dab2b569d7343814ffc51df59290dd0f227da Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Mon, 22 Dec 2025 09:05:55 +0100 Subject: [PATCH 3/3] As extension function --- .../charting/utils/AssetManagerUtils.kt | 72 ++++++++++++++++++ .../mikephil/charting/utils/FileUtils.kt | 74 ------------------- .../chartexample/BarChartActivitySinus.kt | 4 +- .../chartexample/fragments/SimpleFragment.kt | 14 ++-- 4 files changed, 81 insertions(+), 83 deletions(-) create mode 100644 MPChartLib/src/main/java/com/github/mikephil/charting/utils/AssetManagerUtils.kt delete mode 100644 MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/AssetManagerUtils.kt b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/AssetManagerUtils.kt new file mode 100644 index 000000000..6fcaa77e5 --- /dev/null +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/AssetManagerUtils.kt @@ -0,0 +1,72 @@ +package com.github.mikephil.charting.utils + +import android.content.res.AssetManager +import android.util.Log +import com.github.mikephil.charting.data.BarEntry +import com.github.mikephil.charting.data.Entry +import java.io.BufferedReader +import java.io.IOException +import java.io.InputStreamReader +import java.nio.charset.StandardCharsets + +/** + * Utilities class for interacting with the assets and the devices storage to load and save DataSet objects from and to .txt files. + */ +private const val LOG = "Chart-FileUtils" + +/** + * Loads an array of Entries from a textfile from the assets folder. + * + * @param path the name of the file in the assets folder (+ path if needed) + */ +fun AssetManager.loadEntriesFromAssets(path: String): MutableList { + val entries: MutableList = ArrayList() + + try { + BufferedReader( + InputStreamReader(this.open(path), StandardCharsets.UTF_8) + ).use { reader -> + var line = reader.readLine() + while (line != null) { + // process line + val split: Array = line.split("#".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + + if (split.size <= 2) { + entries.add(Entry(split[1]!!.toFloat(), split[0]!!.toFloat())) + } else { + val vals = FloatArray(split.size - 1) + + for (i in vals.indices) { + vals[i] = split[i]!!.toFloat() + } + + entries.add(BarEntry(split[split.size - 1]!!.toInt().toFloat(), vals)) + } + line = reader.readLine() + } + } + } catch (e: IOException) { + Log.e(LOG, e.toString()) + } + + return entries +} + +fun AssetManager.loadBarEntriesFromAssets(path: String): MutableList { + val entries: MutableList = ArrayList() + + try { + BufferedReader(InputStreamReader(this.open(path), StandardCharsets.UTF_8)).use { reader -> + var line = reader.readLine() + while (line != null) { + val split: Array = line.split("#".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + entries.add(BarEntry(split[1]!!.toFloat(), split[0]!!.toFloat())) + line = reader.readLine() + } + } + } catch (e: IOException) { + Log.e(LOG, e.toString()) + } + + return entries +} diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt b/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt deleted file mode 100644 index fe2e5e5c2..000000000 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/utils/FileUtils.kt +++ /dev/null @@ -1,74 +0,0 @@ -package com.github.mikephil.charting.utils - -import android.content.res.AssetManager -import android.util.Log -import com.github.mikephil.charting.data.BarEntry -import com.github.mikephil.charting.data.Entry -import java.io.BufferedReader -import java.io.IOException -import java.io.InputStreamReader -import java.nio.charset.StandardCharsets - -/** - * Utilities class for interacting with the assets and the devices storage to load and save DataSet objects from and to .txt files. - */ -object FileUtils { - private const val LOG = "Chart-FileUtils" - - /** - * Loads an array of Entries from a textfile from the assets folder. - * - * @param path the name of the file in the assets folder (+ path if needed) - */ - fun loadEntriesFromAssets(am: AssetManager, path: String): MutableList { - val entries: MutableList = ArrayList() - - try { - BufferedReader( - InputStreamReader(am.open(path), StandardCharsets.UTF_8) - ).use { reader -> - var line = reader.readLine() - while (line != null) { - // process line - val split: Array = line.split("#".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - - if (split.size <= 2) { - entries.add(Entry(split[1]!!.toFloat(), split[0]!!.toFloat())) - } else { - val vals = FloatArray(split.size - 1) - - for (i in vals.indices) { - vals[i] = split[i]!!.toFloat() - } - - entries.add(BarEntry(split[split.size - 1]!!.toInt().toFloat(), vals)) - } - line = reader.readLine() - } - } - } catch (e: IOException) { - Log.e(LOG, e.toString()) - } - - return entries - } - - fun loadBarEntriesFromAssets(am: AssetManager, path: String): MutableList { - val entries: MutableList = ArrayList() - - try { - BufferedReader(InputStreamReader(am.open(path), StandardCharsets.UTF_8)).use { reader -> - var line = reader.readLine() - while (line != null) { - val split: Array = line.split("#".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - entries.add(BarEntry(split[1]!!.toFloat(), split[0]!!.toFloat())) - line = reader.readLine() - } - } - } catch (e: IOException) { - Log.e(LOG, e.toString()) - } - - return entries - } -} diff --git a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt index 58cd30fdf..84a3df300 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/BarChartActivitySinus.kt @@ -16,7 +16,7 @@ import com.github.mikephil.charting.components.Legend.LegendForm import com.github.mikephil.charting.data.BarData import com.github.mikephil.charting.data.BarDataSet import com.github.mikephil.charting.data.BarEntry -import com.github.mikephil.charting.utils.FileUtils +import com.github.mikephil.charting.utils.loadBarEntriesFromAssets import info.appdev.chartexample.databinding.ActivityBarchartSinusBinding import info.appdev.chartexample.notimportant.DemoBase @@ -32,7 +32,7 @@ class BarChartActivitySinus : DemoBase(), OnSeekBarChangeListener { val view = binding.root setContentView(view) - dataSinus = FileUtils.loadBarEntriesFromAssets(assets, "sinus_values.txt") + dataSinus = assets.loadBarEntriesFromAssets("sinus_values.txt") binding.chart1.setDrawBarShadow(false) binding.chart1.setDrawValueAboveBar(true) diff --git a/app/src/main/kotlin/info/appdev/chartexample/fragments/SimpleFragment.kt b/app/src/main/kotlin/info/appdev/chartexample/fragments/SimpleFragment.kt index c91ac6377..085124de2 100644 --- a/app/src/main/kotlin/info/appdev/chartexample/fragments/SimpleFragment.kt +++ b/app/src/main/kotlin/info/appdev/chartexample/fragments/SimpleFragment.kt @@ -23,7 +23,7 @@ import com.github.mikephil.charting.interfaces.datasets.IBarDataSet import com.github.mikephil.charting.interfaces.datasets.ILineDataSet import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet import com.github.mikephil.charting.utils.ColorTemplate -import com.github.mikephil.charting.utils.FileUtils +import com.github.mikephil.charting.utils.loadEntriesFromAssets import info.appdev.chartexample.DataTools.Companion.getValues abstract class SimpleFragment : Fragment() { @@ -112,8 +112,8 @@ abstract class SimpleFragment : Fragment() { protected fun generateLineData(): LineData { val sets = ArrayList() - val ds1 = LineDataSet(FileUtils.loadEntriesFromAssets(requireContext().assets, "sine.txt"), "Sine function") - val ds2 = LineDataSet(FileUtils.loadEntriesFromAssets(requireContext().assets, "cosine.txt"), "Cosine function") + val ds1 = LineDataSet(requireContext().assets.loadEntriesFromAssets("sine.txt"), "Sine function") + val ds2 = LineDataSet(requireContext().assets.loadEntriesFromAssets( "cosine.txt"), "Cosine function") ds1.lineWidth = 2f ds2.lineWidth = 2f @@ -137,10 +137,10 @@ abstract class SimpleFragment : Fragment() { get() { val sets = ArrayList() - val ds1 = LineDataSet(FileUtils.loadEntriesFromAssets(requireContext().assets, "n.txt"), "O(n)") - val ds2 = LineDataSet(FileUtils.loadEntriesFromAssets(requireContext().assets, "nlogn.txt"), "O(nlogn)") - val ds3 = LineDataSet(FileUtils.loadEntriesFromAssets(requireContext().assets, "square.txt"), "O(n\u00B2)") - val ds4 = LineDataSet(FileUtils.loadEntriesFromAssets(requireContext().assets, "three.txt"), "O(n\u00B3)") + val ds1 = LineDataSet(requireContext().assets.loadEntriesFromAssets("n.txt"), "O(n)") + val ds2 = LineDataSet(requireContext().assets.loadEntriesFromAssets("nlogn.txt"), "O(nlogn)") + val ds3 = LineDataSet(requireContext().assets.loadEntriesFromAssets("square.txt"), "O(n\u00B2)") + val ds4 = LineDataSet(requireContext().assets.loadEntriesFromAssets("three.txt"), "O(n\u00B3)") ds1.color = ColorTemplate.VORDIPLOM_COLORS[0] ds2.color = ColorTemplate.VORDIPLOM_COLORS[1]