You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently libraries like react-metrics-graphics need to manually specify the properties that they want to support. It would be great if metrics graphics exported such a list itself along with a few other pieces of useful metadata, like their type, for use by such libraries.
Probably the place to start here would be to take this existing defaults list and make it into a library export, adding type information:
The data_graphic method could then process the parameters passed in against this list, warning if a particular property was not specified or was specified with the wrong type.
For processing/handling type information, I am tempted to suggest using the prop-types library (used by react). It's pretty tiny:
After this is done, we could potentially also use this list to generate documentation, eliminating the need for the current manually maintained list of options:
I submit a PR (#893) just now with a simple list of options. I just simply merged the key of the default option objects in all the charts into an array. This does not be used to verify the type of option or generate a document, but it is enough for us to make a component for React or Vue easily.
If we want to use the list for generating documents, we should define a format for setting the type, description, default value, etc. Because the prop list format of React and Vue are not the same, so if we need to make a component with the validation field function, we should use some code to automatically convert to the format required by the framework.
Currently libraries like react-metrics-graphics need to manually specify the properties that they want to support. It would be great if metrics graphics exported such a list itself along with a few other pieces of useful metadata, like their type, for use by such libraries.
Probably the place to start here would be to take this existing defaults list and make it into a library export, adding type information:
metrics-graphics/src/js/common/data_graphic.js
Line 18 in 8263f26
The
data_graphic
method could then process the parameters passed in against this list, warning if a particular property was not specified or was specified with the wrong type.For processing/handling type information, I am tempted to suggest using the prop-types library (used by react). It's pretty tiny:
https://github.com/facebook/prop-types/
After this is done, we could potentially also use this list to generate documentation, eliminating the need for the current manually maintained list of options:
https://github.com/metricsgraphics/metrics-graphics/wiki/List-of-Options
The text was updated successfully, but these errors were encountered: