While using the Plotly.js interface to define data for plotly charts I was forced to implement all properties by the interface. It would be better for the developer if they were only required by the interface to specify required parameters. By default, plotly will use default values if a property is unspecified and this behavior should be preserved.
Please submit a PR
@lukewaters Do you mean toImage and downloadImage?
@taoqf I specifically ran into this issue when I was using Plotly.ScatterData for some charts. The interface is great in that it allows me to view the settings that are available for configuration, but I am also forced to configure many properties that normally allow me to use defaults.
One example is text, this property is not required for a chart that doesn't define text for a scatter plot, but by strongly typing my series as ScatterData I am required to provide a value.
@lukewaters . try use Plotly.Data instead of Plotly.ScatterData.
@taoqf Plotly.Data makes this better, there are still some missing attributes in the interface but that's a different issue. I'm wondering though what the motivation was for not making Plotly.ScatterData not a Partial interface
type attribute of Plotly.Data only accept "bar" | "scatter" | "scattergl".. what about pie ? All configs related to pie chart are missing
@testica Please submit a PR
@lukewaters, the motivation behind it is Plotly.plot() expects the Plotly.Data type. You can wrap ScatterData in Partial<..> if you'd like to define a variable of that type without implementing the whole interface.
Overtime I hope this Data type expends to support more than ScatterData, and becomes a union type to support the additional data types.
@testica this is a community maintained type definition. We've been pretty quick to pull in contributions 馃槃
I'm thankful there's any type definitions at all, but this issue makes integrating Plotly into an Angular app a PITA, espcially when I don't know what the defaults are unless I want to start reading through a lot of source code. Any alternative solutions? For now I'm sticking with declare var Plotly: any;,
Most helpful comment
@testica Please submit a PR