Skip to content

Commit

Permalink
Merge pull request #59 from azaleas/fix/extraOffsets
Browse files Browse the repository at this point in the history
Fix extra offsets and chart padding for length == 4
  • Loading branch information
hongyin163 authored Nov 8, 2016
2 parents a62f894 + 1dad16d commit 3becf20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 3becf20

Please sign in to comment.