Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

Commit

Permalink
Validating zoom props and fixed method name
Browse files Browse the repository at this point in the history
  • Loading branch information
cesardeazevedo authored and mskec committed Dec 4, 2016
1 parent b84328f commit 7bc0f32
Showing 1 changed file with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,24 @@ public void setDoubleTapToZoomEnabled(BarLineChartBase chart, boolean enabled) {
}

@ReactProp(name = "zoom")
public void setDoubleTapToZoomEnabled(BarLineChartBase chart, ReadableMap propMap) {
YAxis.AxisDependency axisDependency = YAxis.AxisDependency.LEFT;
if (propMap.hasKey("axisDependency") &&
propMap.getString("axisDependency").equalsIgnoreCase("RIGHT")) {
axisDependency = YAxis.AxisDependency.RIGHT;
public void setZoom(BarLineChartBase chart, ReadableMap propMap) {
if (BridgeUtils.validate(propMap, ReadableType.Number, "scaleX") &&
BridgeUtils.validate(propMap, ReadableType.Number, "scaleY") &&
BridgeUtils.validate(propMap, ReadableType.Number, "xValue") &&
BridgeUtils.validate(propMap, ReadableType.Number, "yValue")) {

YAxis.AxisDependency axisDependency = YAxis.AxisDependency.LEFT;
if (propMap.hasKey("axisDependency") &&
propMap.getString("axisDependency").equalsIgnoreCase("RIGHT")) {
axisDependency = YAxis.AxisDependency.RIGHT;
}
chart.zoom(
(float) propMap.getDouble("scaleX"),
(float) propMap.getDouble("scaleY"),
(float) propMap.getDouble("xValue"),
(float) propMap.getDouble("yValue"),
axisDependency
);
}
chart.zoom(
(float)propMap.getDouble("scaleX"),
(float)propMap.getDouble("scaleY"),
(float)propMap.getDouble("xValue"),
(float)propMap.getDouble("yValue"),
axisDependency
);
}
}

0 comments on commit 7bc0f32

Please sign in to comment.