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/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); } diff --git a/index.android.js b/index.android.js deleted file mode 100644 index 8358d03..0000000 --- a/index.android.js +++ /dev/null @@ -1,17 +0,0 @@ -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'; - -export { - BarChart, - HorizontalBarChart, - LineChart, - CandleStickChart, - CombinedChart, - PieChart, - RadarChart -} diff --git a/index.js b/index.js new file mode 100644 index 0000000..5252c31 --- /dev/null +++ b/index.js @@ -0,0 +1,17 @@ +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, + HorizontalBarChart, + LineChart, + CandleStickChart, + CombinedChart, + PieChart, + RadarChart +} 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" },