public void updateDataSetOptions(DataSetClass dataSet, ReadableMap map) {
    if (map.hasKey("values")) {
      ReadableArray valueArray = map.getArray("values");
      for (int j = 0; j < valueArray.size(); j++) {
        Entry entry;
        try {
          entry = entryConstructor.newInstance((float) valueArray.getDouble(j), j);
        } catch (Exception e) {
          throw new Error("Entry failed to instantiate");
        }

        dataSet.addEntry(entry);
      }
    }

    if (map.hasKey("colors")) {
      ReadableArray colorsArray = map.getArray("colors");
      ArrayList<Integer> colors = new ArrayList<>();

      for (int c = 0; c < colorsArray.size(); c++) {
        colors.add(Color.parseColor(colorsArray.getString(c)));
      }

      dataSet.setColors(colors);
    }

    if (map.hasKey("drawValues")) {
      dataSet.setDrawValues(map.getBoolean("drawValues"));
    }

    // TODO: add other properties to dataSet here

  }
  /**
   * Show a {@link PopupMenu}.
   *
   * @param reactTag the tag of the anchor view (the PopupMenu is displayed next to this view); this
   *     needs to be the tag of a native view (shadow views can not be anchors)
   * @param items the menu items as an array of strings
   * @param success will be called with the position of the selected item as the first argument, or
   *     no arguments if the menu is dismissed
   */
  public void showPopupMenu(int reactTag, ReadableArray items, Callback success) {
    UiThreadUtil.assertOnUiThread();
    View anchor = mTagsToViews.get(reactTag);
    if (anchor == null) {
      throw new JSApplicationIllegalArgumentException("Could not find view with tag " + reactTag);
    }
    PopupMenu popupMenu = new PopupMenu(getReactContextForView(reactTag), anchor);

    Menu menu = popupMenu.getMenu();
    for (int i = 0; i < items.size(); i++) {
      menu.add(Menu.NONE, Menu.NONE, i, items.getString(i));
    }

    PopupMenuCallbackHandler handler = new PopupMenuCallbackHandler(success);
    popupMenu.setOnMenuItemClickListener(handler);
    popupMenu.setOnDismissListener(handler);

    popupMenu.show();
  }
  @ReactProp(name = "data")
  public void setData(ChartClass chart, ReadableMap map) {
    ChartData chartData;
    try {
      chartData = chartDataConstructor.newInstance();
    } catch (Exception e) {
      throw new RuntimeException("ChartData failed to instantiate");
    }

    if (map.hasKey("xValues")) {
      ReadableArray xValuesArray = map.getArray("xValues");
      for (int k = 0; k < xValuesArray.size(); k++) {
        chartData.addXValue(xValuesArray.getString(k));
      }
    }

    if (map.hasKey("dataSets")) {
      ReadableArray dataSetsArray = map.getArray("dataSets");
      for (int i = 0; i < dataSetsArray.size(); i++) {

        ReadableMap dataSetMap = dataSetsArray.getMap(i);
        DataSetClass dataSet;

        try {
          dataSet =
              (DataSetClass)
                  this.dataSetConstructor.newInstance(new ArrayList<>(), "Data Set " + i);
        } catch (Exception e) {
          throw new RuntimeException("DataSet failed to instantiate");
        }

        updateDataSetOptions(dataSet, dataSetMap);
        chartData.addDataSet(dataSet);
      }

      chart.notifyDataSetChanged();
    }

    // TODO: add other properties to data here

    chart.setData(chartData);
    chart.invalidate();
  }
  public ShowOptions(@Nullable ReadableMap options) {
    if (options == null) {
      return;
    }

    if (options.hasKey(CLOSABLE_KEY)) {
      closable = options.getBoolean(CLOSABLE_KEY);
      Log.d(TAG, CLOSABLE_KEY + closable);
    }

    if (options.hasKey(USE_MAGIC_LINK_KEY)) {
      useMagicLink = options.getBoolean(USE_MAGIC_LINK_KEY);
      Log.d(TAG, USE_MAGIC_LINK_KEY + useMagicLink);
    }

    if (options.hasKey(AUTH_PARAMS_KEY)) {
      ReadableMap reactMap = options.getMap(AUTH_PARAMS_KEY);
      authParams = OptionsHelper.convertReadableMapToMap(reactMap);
      Log.d(TAG, AUTH_PARAMS_KEY + authParams);
    }

    if (options.hasKey(CONNECTIONS_KEY)) {
      ReadableArray connections = options.getArray(CONNECTIONS_KEY);
      List<String> list = new ArrayList<>(connections.size());
      for (int i = 0; i < connections.size(); i++) {
        String connectionName = connections.getString(i);
        switch (connectionName) {
          case LockReactModule.CONNECTION_EMAIL:
            connectionType = LockReactModule.CONNECTION_EMAIL;
            break;
          case LockReactModule.CONNECTION_SMS:
            connectionType = LockReactModule.CONNECTION_SMS;
            break;
        }
        list.add(connectionName);
      }
      this.connections = new String[list.size()];
      this.connections = list.toArray(this.connections);
      Log.d(TAG, CONNECTIONS_KEY + list);
    }
  }