Skip to content

Commit

Permalink
Add mapping for valueTextColors
Browse files Browse the repository at this point in the history
  • Loading branch information
lammertw committed Nov 29, 2016
1 parent 9036190 commit c550db6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ public void setData(BarChart chart,ReadableMap rm){
entries.add(be);*/
BarDataSet dataSet=new BarDataSet(entries,label);
ReadableMap config= map.getMap("config");

if(config.hasKey("valueTextColors")){
ReadableArray colorsArray = config.getArray("valueTextColors");
ArrayList<Integer> colors = new ArrayList<>();
for(int c = 0; c < colorsArray.size(); c++){
colors.add(Color.parseColor(colorsArray.getString(c)));
}
dataSet.setValueTextColors(colors);
}else
if(config.hasKey("valueTextColor")) dataSet.setValueTextColor(Color.parseColor(config.getString("valueTextColor")));

// Text Size for bar value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ public void setData(LineChart chart,ReadableMap rm){
if(config.hasKey("drawCircles")) dataSet.setDrawCircles(config.getBoolean("drawCircles"));
if(config.hasKey("circleSize")) dataSet.setCircleSize((float) config.getDouble("circleSize"));
if(config.hasKey("lineWidth")) dataSet.setLineWidth((float) config.getDouble("lineWidth"));
if(config.hasKey("valueTextColors")){
ReadableArray colorsArray = config.getArray("valueTextColors");
ArrayList<Integer> colors = new ArrayList<>();
for(int c = 0; c < colorsArray.size(); c++){
colors.add(Color.parseColor(colorsArray.getString(c)));
}
dataSet.setValueTextColors(colors);
}else
if(config.hasKey("drawValues")) dataSet.setDrawValues(config.getBoolean("drawValues"));
if(config.hasKey("valueTextColor")) dataSet.setValueTextColor(Color.parseColor(config.getString("valueTextColor")));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ public void setData(PieChart chart,ReadableMap rm){
dataSet.setColors(colors);
}
if(config.hasKey("drawValues")) dataSet.setDrawValues(config.getBoolean("drawValues"));
if(config.hasKey("valueTextColors")){
ReadableArray colorsArray = config.getArray("valueTextColors");
ArrayList<Integer> colors = new ArrayList<>();
for(int c = 0; c < colorsArray.size(); c++){
colors.add(Color.parseColor(colorsArray.getString(c)));
}
dataSet.setValueTextColors(colors);
}else
if(config.hasKey("valueTextColor")) dataSet.setValueTextColor(Color.parseColor(config.getString("valueTextColor")));
dataSet.setSliceSpace(3f);
pieData.addDataSet(dataSet);
Expand Down

0 comments on commit c550db6

Please sign in to comment.