From 0586f6101bf9f0845616e1cf3eccbe970a3e3b44 Mon Sep 17 00:00:00 2001 From: xwartz Date: Fri, 9 Dec 2016 12:04:34 +0800 Subject: [PATCH 1/3] Add axisDependency for dataSet --- .../react_native_mpchart/MPLineChartManager.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java index 844d23d..c1bb3d8 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java @@ -21,6 +21,7 @@ import com.github.mikephil.charting.data.LineData; import com.github.mikephil.charting.data.LineDataSet; import com.github.mikephil.charting.utils.ColorTemplate; +import com.github.mikephil.charting.components.YAxis.AxisDependency; import java.util.ArrayList; import java.util.Random; @@ -83,7 +84,7 @@ public void setData(LineChart chart,ReadableMap rm){ if(config.hasKey("lineWidth")) dataSet.setLineWidth((float) config.getDouble("lineWidth")); if(config.hasKey("drawValues")) dataSet.setDrawValues(config.getBoolean("drawValues")); if(config.hasKey("valueTextColor")) dataSet.setValueTextColor(Color.parseColor(config.getString("valueTextColor"))); - + // Text Size for bar value if(config.hasKey("valueTextSize")) dataSet.setValueTextSize((float)config.getDouble("valueTextSize")); @@ -122,6 +123,13 @@ public void setData(LineChart chart,ReadableMap rm){ if (config.hasKey("fillColor")) dataSet.setFillColor(Color.parseColor(config.getString("fillColor"))); if (config.hasKey("fillAlpha")) dataSet.setFillAlpha((int)(255 * config.getDouble("fillAlpha"))); if (config.hasKey("bezier")) dataSet.setDrawCubic(config.getBoolean("bezier")); + if (config.hasKey("axisDependency")) { + AxisDependency axisDependency = AxisDependency.LEFT; + if (config.getString("axisDependency").equalsIgnoreCase("RIGHT")) { + axisDependency = AxisDependency.RIGHT; + } + dataSet.setAxisDependency(axisDependency); + } chartData.addDataSet(dataSet); } From a632eda0acb712a4538d9ed83cb123d1369332ee Mon Sep 17 00:00:00 2001 From: xwartz Date: Fri, 9 Dec 2016 12:51:19 +0800 Subject: [PATCH 2/3] Fix unresolve error on iOS --- BarChart.android.js => BarChart.js | 0 CandleStickChart.android.js => CandleStickChart.js | 0 CombinedChart.android.js => CombinedChart.js | 0 HorizontalBarChart.android.js => HorizontalBarChart.js | 0 LineChart.android.js => LineChart.js | 0 PieChart.android.js => PieChart.js | 0 RadarChart.android.js => RadarChart.js | 0 index.android.js => index.js | 0 package.json | 2 +- 9 files changed, 1 insertion(+), 1 deletion(-) rename BarChart.android.js => BarChart.js (100%) rename CandleStickChart.android.js => CandleStickChart.js (100%) rename CombinedChart.android.js => CombinedChart.js (100%) rename HorizontalBarChart.android.js => HorizontalBarChart.js (100%) rename LineChart.android.js => LineChart.js (100%) rename PieChart.android.js => PieChart.js (100%) rename RadarChart.android.js => RadarChart.js (100%) rename index.android.js => index.js (100%) diff --git a/BarChart.android.js b/BarChart.js similarity index 100% rename from BarChart.android.js rename to BarChart.js diff --git a/CandleStickChart.android.js b/CandleStickChart.js similarity index 100% rename from CandleStickChart.android.js rename to CandleStickChart.js diff --git a/CombinedChart.android.js b/CombinedChart.js similarity index 100% rename from CombinedChart.android.js rename to CombinedChart.js diff --git a/HorizontalBarChart.android.js b/HorizontalBarChart.js similarity index 100% rename from HorizontalBarChart.android.js rename to HorizontalBarChart.js diff --git a/LineChart.android.js b/LineChart.js similarity index 100% rename from LineChart.android.js rename to LineChart.js diff --git a/PieChart.android.js b/PieChart.js similarity index 100% rename from PieChart.android.js rename to PieChart.js diff --git a/RadarChart.android.js b/RadarChart.js similarity index 100% rename from RadarChart.android.js rename to RadarChart.js diff --git a/index.android.js b/index.js similarity index 100% rename from index.android.js rename to index.js diff --git a/package.json b/package.json index 2a46a1e..6723f68 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-native-chart-android", "version": "1.0.6", "description": "react-native-mpchart provide modules to add chart to android,all charts are come from mpandroidchart library.", - "main": "index.android.js", + "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, From 0dace0e883616290503c78ee485624f48eff9e40 Mon Sep 17 00:00:00 2001 From: xwartz Date: Fri, 9 Dec 2016 13:36:39 +0800 Subject: [PATCH 3/3] Fix import path --- index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 8358d03..5252c31 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,10 @@ -import BarChart from './BarChart.android'; -import HorizontalBarChart from './HorizontalBarChart.android'; -import LineChart from './LineChart.android'; -import CandleStickChart from './CandleStickChart.android'; -import CombinedChart from './CombinedChart.android'; -import PieChart from './PieChart.android'; -import RadarChart from './RadarChart.android'; +import BarChart from './BarChart'; +import HorizontalBarChart from './HorizontalBarChart'; +import LineChart from './LineChart'; +import CandleStickChart from './CandleStickChart'; +import CombinedChart from './CombinedChart'; +import PieChart from './PieChart'; +import RadarChart from './RadarChart'; export { BarChart,