From 6830338a85b04e9c0b7c1b15948d9d387905b61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20Kwiecie=C5=84?= Date: Fri, 10 Feb 2017 13:13:59 +0100 Subject: [PATCH 1/2] made entry, dataset, chartdata & highlight serializable --- .../mikephil/charting/data/ChartData.java | 3 ++- .../mikephil/charting/data/DataSet.java | 3 ++- .../github/mikephil/charting/data/Entry.java | 22 +++++++++++-------- .../charting/highlight/Highlight.java | 4 +++- 4 files changed, 20 insertions(+), 12 deletions(-) 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 bfc5ed7016..fa6dc27573 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 @@ -9,6 +9,7 @@ import com.github.mikephil.charting.highlight.Highlight; import com.github.mikephil.charting.interfaces.datasets.IDataSet; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -18,7 +19,7 @@ * * @author Philipp Jahoda */ -public abstract class ChartData> { +public abstract class ChartData> implements Serializable { /** * maximum y-value in the value array across all axes 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 1817fbe3f7..56fb0d924f 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 @@ -1,6 +1,7 @@ package com.github.mikephil.charting.data; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -12,7 +13,7 @@ * * @author Philipp Jahoda */ -public abstract class DataSet extends BaseDataSet { +public abstract class DataSet extends BaseDataSet implements Serializable { /** * the entries that this DataSet represents / holds together 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..045201ea82 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 @@ -8,15 +8,19 @@ import com.github.mikephil.charting.utils.Utils; +import java.io.Serializable; + /** * Class representing one entry in the chart. Might contain multiple values. * Might only contain a single value depending on the used constructor. - * + * * @author Philipp Jahoda */ -public class Entry extends BaseEntry implements Parcelable { +public class Entry extends BaseEntry implements Parcelable, Serializable { - /** the x value */ + /** + * the x value + */ private float x = 0f; public Entry() { @@ -37,8 +41,8 @@ public Entry(float x, float y) { /** * A Entry represents one single entry in the chart. * - * @param x the x value - * @param y the y value (the actual value of the entry) + * @param x the x value + * @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) { @@ -73,7 +77,7 @@ public Entry(float x, float y, Drawable icon, Object data) { /** * Returns the x-value of this Entry object. - * + * * @return */ public float getX() { @@ -82,7 +86,7 @@ public float getX() { /** * Sets the x-value of this Entry object. - * + * * @param x */ public void setX(float x) { @@ -91,7 +95,7 @@ public void setX(float x) { /** * returns an exact copy of the entry - * + * * @return */ public Entry copy() { @@ -103,7 +107,7 @@ public Entry copy() { * Compares value, xIndex and data of the entries. Returns true if entries * are equal in those points, false if not. Does not check by hash-code like * it's done by the "equals" method. - * + * * @param e * @return */ 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 62307cbeaf..f61b13ba0c 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 @@ -3,12 +3,14 @@ import com.github.mikephil.charting.components.YAxis; +import java.io.Serializable; + /** * Contains information needed to determine the highlighted value. * * @author Philipp Jahoda */ -public class Highlight { +public class Highlight implements Serializable { /** * the x-value of the highlighted value From afd52f2039662976c3ac3fbe03763871297aa7cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20Kwiecie=C5=84?= Date: Tue, 21 Mar 2017 10:07:37 +0100 Subject: [PATCH 2/2] extended serializable --- .../mikephil/charting/formatter/DefaultFillFormatter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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..fc893584d6 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 @@ -5,13 +5,14 @@ import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider; import com.github.mikephil.charting.interfaces.datasets.ILineDataSet; +import java.io.Serializable; + /** * Default formatter that calculates the position of the filled line. * * @author Philipp Jahoda */ -public class DefaultFillFormatter implements IFillFormatter -{ +public class DefaultFillFormatter implements IFillFormatter, Serializable { @Override public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {