{"action":"created","issue":{"url":"https://api.github.com/repos/metricsgraphics/metrics-graphics/issues/875","repository_url":"https://api.github.com/repos/metricsgraphics/metrics-graphics","labels_url":"https://api.github.com/repos/metricsgraphics/metrics-graphics/issues/875/labels{/name}","comments_url":"https://api.github.com/repos/metricsgraphics/metrics-graphics/issues/875/comments","events_url":"https://api.github.com/repos/metricsgraphics/metrics-graphics/issues/875/events","html_url":"https://github.com/metricsgraphics/metrics-graphics/issues/875","id":337235200,"node_id":"MDU6SXNzdWUzMzcyMzUyMDA=","number":875,"title":"Make the list of options programmatically accessible","user":{"login":"wlach","id":20569,"node_id":"MDQ6VXNlcjIwNTY5","avatar_url":"https://avatars3.githubusercontent.com/u/20569?v=4","gravatar_id":"","url":"https://api.github.com/users/wlach","html_url":"https://github.com/wlach","followers_url":"https://api.github.com/users/wlach/followers","following_url":"https://api.github.com/users/wlach/following{/other_user}","gists_url":"https://api.github.com/users/wlach/gists{/gist_id}","starred_url":"https://api.github.com/users/wlach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlach/subscriptions","organizations_url":"https://api.github.com/users/wlach/orgs","repos_url":"https://api.github.com/users/wlach/repos","events_url":"https://api.github.com/users/wlach/events{/privacy}","received_events_url":"https://api.github.com/users/wlach/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-30T18:48:22Z","updated_at":"2018-07-26T08:43:02Z","closed_at":null,"author_association":"COLLABORATOR","body":"Currently libraries like [react-metrics-graphics](https://github.com/metricsgraphics/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.\r\n\r\nProbably the place to start here would be to take this existing defaults list and make it into a library export, adding type information:\r\n\r\nhttps://github.com/metricsgraphics/metrics-graphics/blob/8263f26c3a3ad4d07c5aa87d3d22cc494723cce3/src/js/common/data_graphic.js#L18\r\n\r\nThe `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.\r\n\r\nFor processing/handling type information, I am tempted to suggest using the prop-types library (used by react). It's pretty tiny:\r\n\r\nhttps://github.com/facebook/prop-types/\r\n\r\nAfter this is done, we could potentially also use this list to generate documentation, eliminating the need for the current manually maintained list of options:\r\n\r\nhttps://github.com/metricsgraphics/metrics-graphics/wiki/List-of-Options"},"comment":{"url":"https://api.github.com/repos/metricsgraphics/metrics-graphics/issues/comments/408023687","html_url":"https://github.com/metricsgraphics/metrics-graphics/issues/875#issuecomment-408023687","issue_url":"https://api.github.com/repos/metricsgraphics/metrics-graphics/issues/875","id":408023687,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODAyMzY4Nw==","user":{"login":"cnwangjie","id":7459652,"node_id":"MDQ6VXNlcjc0NTk2NTI=","avatar_url":"https://avatars3.githubusercontent.com/u/7459652?v=4","gravatar_id":"","url":"https://api.github.com/users/cnwangjie","html_url":"https://github.com/cnwangjie","followers_url":"https://api.github.com/users/cnwangjie/followers","following_url":"https://api.github.com/users/cnwangjie/following{/other_user}","gists_url":"https://api.github.com/users/cnwangjie/gists{/gist_id}","starred_url":"https://api.github.com/users/cnwangjie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnwangjie/subscriptions","organizations_url":"https://api.github.com/users/cnwangjie/orgs","repos_url":"https://api.github.com/users/cnwangjie/repos","events_url":"https://api.github.com/users/cnwangjie/events{/privacy}","received_events_url":"https://api.github.com/users/cnwangjie/received_events","type":"User","site_admin":false},"created_at":"2018-07-26T08:43:01Z","updated_at":"2018-07-26T08:43:01Z","author_association":"COLLABORATOR","body":"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.\r\n\r\nIf 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.\r\n\r\n@wlach What do you think about it?"}}
{"actor":{"display_login":"cnwangjie"}}