All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.tablesaw.plotly.components.Config Maven / Gradle / Ivy

package tech.tablesaw.plotly.components;

import java.util.HashMap;
import java.util.Map;

public class Config extends Component {

  private final Boolean displayModeBar;
  private final Boolean responsive;

  private Config(Builder builder) {
    this.displayModeBar = builder.displayModeBar;
    this.responsive = builder.responsive;
  }

  public static Builder builder() {
    return new Builder();
  }

  @Override
  public String asJavascript() {
    return "var config = " + asJSON();
  }

  @Override
  protected Map getJSONContext() {
    return getContext();
  }

  @Override
  protected Map getContext() {
    Map context = new HashMap<>();
    context.put("displayModeBar", displayModeBar);
    context.put("responsive", responsive);
    return context;
  }

  public static class Builder {

    Boolean displayModeBar;
    Boolean responsive;

    private Builder() {}

    public Builder displayModeBar(boolean displayModeBar) {
      this.displayModeBar = displayModeBar;
      return this;
    }

    public Builder responsive(boolean responsive) {
      this.responsive = responsive;
      return this;
    }

    public Config build() {
      return new Config(this);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy