jtablesaw / tablesaw

Java dataframe and visualization library
https://jtablesaw.github.io/tablesaw/
Apache License 2.0
3.54k stars 643 forks source link

Plot.ly Axis margin and setting layout and trace properties #596

Open digitalseas opened 5 years ago

digitalseas commented 5 years ago

Thank you for creating such a great tool.

I am trying to set the margin of xAxis as auto, but could not find this in the tablesaw api. Maybe I am missing something (see sample JS below).

Because Plot.ly has been constantly adding new properties, a more direct way to set the layout/trace properties might be useful. For example:

Layout.builder() .set("autosize", "true") .set("width", 500) .set(yAxis().builder().set("automargin", "true").build() ) .build();

This not only will enable flexible property injection to the graph components, but also will allow developers to directly use existing Plot.ly docuents and examples as a reference without searching a corresponding Java method.

2019-08-15 02_15_54-JavaScript Graphing Library Setting D3 js-based Graph Size _ Examples _ Plotly

lwhite1 commented 5 years ago

I don't have much time to look into this presently, but I see that Layout has a property called Margin and that has:

  /**
   * Determines whether or not a layout width or height that has been left undefined by the user is
   * initialized on each re-layout. Note that, regardless of this attribute, an undefined layout
   * width or height is always initialized on the first call to plot.
   */
  private final boolean autoSize;

Is it possible that this is what you're looking for?

Also, I notice that you say "autosize" in the java code and "automargin" in the javascript. Could you clarify?

lwhite1 commented 5 years ago

Hi @digitalseas, I'm not sure if you saw my earlier reply. Is this still an issue for you?

digitalseas commented 5 years ago

Hi Larry, Thank you for the reply. I tried but I still don't see the Plot.ly automargin property on Axis works on the java wrapper.