From d9b01943a2a16f06655af2ff34a397c1c1d47989 Mon Sep 17 00:00:00 2001 From: azaleas Date: Mon, 7 Nov 2016 20:42:39 +0400 Subject: [PATCH 1/3] Added support for valueTextSize for Bar Chart --- .../cn/mandata/react_native_mpchart/MPBarChartManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java index 904e2a1..fbc6b88 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java @@ -68,6 +68,11 @@ public void setData(BarChart chart,ReadableMap rm){ BarDataSet dataSet=new BarDataSet(entries,label); ReadableMap config= map.getMap("config"); 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")); + if(config.hasKey("drawValues")) dataSet.setDrawValues(config.getBoolean("drawValues")); if(config.hasKey("colors")){ ReadableArray colorsArray = config.getArray("colors"); From a600a5b5c139b5e49cc6d8f0ea73c04917b846cb Mon Sep 17 00:00:00 2001 From: azaleas Date: Tue, 8 Nov 2016 10:04:15 +0400 Subject: [PATCH 2/3] Added support for valueTextSize for Line Chart --- .../cn/mandata/react_native_mpchart/MPLineChartManager.java | 5 +++++ 1 file changed, 5 insertions(+) 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 aaf9666..844d23d 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 @@ -83,6 +83,11 @@ 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")); + if (config.hasKey("drawCircleHole")) dataSet.setDrawCircleHole(config.getBoolean("drawCircleHole")); if(config.hasKey("drawValues")) dataSet.setDrawValues(config.getBoolean("drawValues")); if(config.hasKey("drawStepped")) dataSet.setDrawStepped(config.getBoolean("drawStepped")); From 1dad16d73ed4c64d16b06b459ae526d54f31e16c Mon Sep 17 00:00:00 2001 From: azaleas Date: Tue, 8 Nov 2016 12:08:08 +0400 Subject: [PATCH 3/3] fixed padding and offset options for length==4 --- .../react_native_mpchart/MPBarLineChartManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java index b06e851..769c73e 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java @@ -301,8 +301,8 @@ public void setPadding(BarLineChartBase chart,String v){ }else if(padding.length==4){ int pad1=(Integer.parseInt(padding[0])); int pad2=(Integer.parseInt(padding[1])); - int pad3=(Integer.parseInt(padding[0])); - int pad4=(Integer.parseInt(padding[1])); + int pad3=(Integer.parseInt(padding[2])); + int pad4=(Integer.parseInt(padding[3])); chart.setPadding(pad4,pad1,pad2,pad3); } } @@ -319,8 +319,8 @@ public void setExtraOffsets(BarLineChartBase chart, String v){ } else if(offsets.length == 4) { int offset1 = (Integer.parseInt(offsets[0])); int offset2 = (Integer.parseInt(offsets[1])); - int offset3 = (Integer.parseInt(offsets[0])); - int offset4 = (Integer.parseInt(offsets[1])); + int offset3 = (Integer.parseInt(offsets[2])); + int offset4 = (Integer.parseInt(offsets[3])); chart.setExtraOffsets(offset4, offset1, offset2, offset3); } }