{"action":"created","issue":{"url":"https://api.github.com/repos/CartoDB/deep-insights.js/issues/93","labels_url":"https://api.github.com/repos/CartoDB/deep-insights.js/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/deep-insights.js/issues/93/comments","events_url":"https://api.github.com/repos/CartoDB/deep-insights.js/issues/93/events","html_url":"https://github.com/CartoDB/deep-insights.js/pull/93","id":129841086,"number":93,"title":"Widgets public API","user":{"login":"viddo","id":978461,"avatar_url":"https://avatars.githubusercontent.com/u/978461?v=3","gravatar_id":"","url":"https://api.github.com/users/viddo","html_url":"https://github.com/viddo","followers_url":"https://api.github.com/users/viddo/followers","following_url":"https://api.github.com/users/viddo/following{/other_user}","gists_url":"https://api.github.com/users/viddo/gists{/gist_id}","starred_url":"https://api.github.com/users/viddo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viddo/subscriptions","organizations_url":"https://api.github.com/users/viddo/orgs","repos_url":"https://api.github.com/users/viddo/repos","events_url":"https://api.github.com/users/viddo/events{/privacy}","received_events_url":"https://api.github.com/users/viddo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-01-29T18:05:58Z","updated_at":"2016-02-01T09:54:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CartoDB/deep-insights.js/pulls/93","html_url":"https://github.com/CartoDB/deep-insights.js/pull/93","diff_url":"https://github.com/CartoDB/deep-insights.js/pull/93.diff","patch_url":"https://github.com/CartoDB/deep-insights.js/pull/93.patch"},"body":"Resolves #90 \r\n\r\nAssuming one has created a `dashboard` (`dashboard = cdb.deepInsights.createDashboard('#selector', vizJSON)`)\r\n\r\nFrom there the public API is:\r\n\r\n```js\r\n// to access an existing widget:\r\nwidgetModel = dashboard.widgets.get('some-id') // returns a widget model object\r\n\r\n// To add a new widget (each has their own arguments, see changeset for details):\r\nwidgetModel = dashboard.widgets.newCategoryModel();\r\nwidgetModel = dashboard.widgets.newHistogramModel();\r\nwidgetModel = dashboard.widgets.newFormulaModel();\r\nwidgetModel = dashboard.widgets.newTimeSeriesModel();\r\n\r\n// To remove a widget (internally cleans up owned objects and removes widget view)\r\nwidgetModel.remove();\r\n```\r\n\r\n@xavijam @javierarce can you pair-review? :bow: since you're the first users of this\r\ncc @javisantana @alonsogarciapablo FYI"},"comment":{"url":"https://api.github.com/repos/CartoDB/deep-insights.js/issues/comments/177882959","html_url":"https://github.com/CartoDB/deep-insights.js/pull/93#issuecomment-177882959","issue_url":"https://api.github.com/repos/CartoDB/deep-insights.js/issues/93","id":177882959,"user":{"login":"xavijam","id":132146,"avatar_url":"https://avatars.githubusercontent.com/u/132146?v=3","gravatar_id":"","url":"https://api.github.com/users/xavijam","html_url":"https://github.com/xavijam","followers_url":"https://api.github.com/users/xavijam/followers","following_url":"https://api.github.com/users/xavijam/following{/other_user}","gists_url":"https://api.github.com/users/xavijam/gists{/gist_id}","starred_url":"https://api.github.com/users/xavijam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xavijam/subscriptions","organizations_url":"https://api.github.com/users/xavijam/orgs","repos_url":"https://api.github.com/users/xavijam/repos","events_url":"https://api.github.com/users/xavijam/events{/privacy}","received_events_url":"https://api.github.com/users/xavijam/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T09:54:05Z","updated_at":"2016-02-01T09:54:05Z","body":"Ok, so IMHO, we should merge it :+1:."}}