Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mapping for valueTextColors #62

Merged
merged 1 commit into from
Jan 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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