{"action":"created","issue":{"url":"https://api.github.com/repos/twosigma/beaker-notebook/issues/4902","repository_url":"https://api.github.com/repos/twosigma/beaker-notebook","labels_url":"https://api.github.com/repos/twosigma/beaker-notebook/issues/4902/labels{/name}","comments_url":"https://api.github.com/repos/twosigma/beaker-notebook/issues/4902/comments","events_url":"https://api.github.com/repos/twosigma/beaker-notebook/issues/4902/events","html_url":"https://github.com/twosigma/beaker-notebook/pull/4902","id":187237383,"number":4902,"title":"Enhanced plot styling","user":{"login":"ssadedin","id":138868,"avatar_url":"https://avatars.githubusercontent.com/u/138868?v=3","gravatar_id":"","url":"https://api.github.com/users/ssadedin","html_url":"https://github.com/ssadedin","followers_url":"https://api.github.com/users/ssadedin/followers","following_url":"https://api.github.com/users/ssadedin/following{/other_user}","gists_url":"https://api.github.com/users/ssadedin/gists{/gist_id}","starred_url":"https://api.github.com/users/ssadedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssadedin/subscriptions","organizations_url":"https://api.github.com/users/ssadedin/orgs","repos_url":"https://api.github.com/users/ssadedin/repos","events_url":"https://api.github.com/users/ssadedin/events{/privacy}","received_events_url":"https://api.github.com/users/ssadedin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-04T02:05:47Z","updated_at":"2016-11-10T13:59:56Z","closed_at":"2016-11-10T13:47:23Z","pull_request":{"url":"https://api.github.com/repos/twosigma/beaker-notebook/pulls/4902","html_url":"https://github.com/twosigma/beaker-notebook/pull/4902","diff_url":"https://github.com/twosigma/beaker-notebook/pull/4902.diff","patch_url":"https://github.com/twosigma/beaker-notebook/pull/4902.patch"},"body":"This change lets the user style plot elements directly using CSS.\r\n\r\nNote: this is an updated version of https://github.com/twosigma/beaker-notebook/pull/4895 and supercedes it.\r\n\r\nThere are two levels of styling this allows - the \"normal\" level and \"advanced\".\r\n\r\n## Normal Level Styling\r\n\r\nThe normal level offers three new plot properties for setting styles:\r\n\r\n * labelStyle (and also labelXStyle and labelYStyle)\r\n * titleStyle\r\n * gridLineStyle\r\n\r\nThese can be set to any CSS styles applicable to the relevant plot elements. For example, `font-style: bold` or `font-size: 32px`, etc.\r\n\r\nExample code:\r\n\r\n```groovy\r\nr = new Random()\r\nnew Plot(title: \"Random Gaussian Points\",\r\n         labelStyle: \"font-size:32px; font-weight: bold; font-family: courier; fill: green;\",\r\n         gridLineStyle:  \"stroke: purple; stroke-width: 3;\",\r\n         titleStyle: \"color: green;\"\r\n        ) \\\r\n  << new Points(\r\n                x: (1..1000).collect { r.nextGaussian() * 10.0d },\r\n                y: (1..1000).collect { r.nextGaussian() * 20.0d }\r\n               )\r\n```\r\n\r\n**Result**:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/138868/19992043/fe59931a-a210-11e6-8064-8aa445f52ae1.png)\r\n\r\n## Advanced level styling\r\n\r\nThis level injects complete CSS style blocks into the code with minimal support to scope the styles to the plot at hand. Using this feature is not recommended because the styles can escape and affect other elements of the page or other plots if not used carefully. However I left this in as it does allow a level of flexibility that can help in situations where no other solution will do.\r\n\r\nExample code:\r\n\r\n```groovy\r\nr = new Random()\r\nnew Plot(title: \"Random Gaussian Points\",\r\n         customStyles: [\r\n           \".plot-label { font-size:32px; font-weight: bold; font-family: courier; fill: green;}\",\r\n           \".plot-gridline { stroke: purple; stroke-width: 3; }\",\r\n         ]\r\n        ) \\\r\n  << new Points(\r\n                x: (1..1000).collect { r.nextGaussian() * 10.0d },\r\n                y: (1..1000).collect { r.nextGaussian() * 20.0d }\r\n               )\r\n```\r\n\r\n\r\nResult:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/138868/19949451/1f93c116-a128-11e6-80e0-2a9aea152fd0.png)\r\n"},"comment":{"url":"https://api.github.com/repos/twosigma/beaker-notebook/issues/comments/259696530","html_url":"https://github.com/twosigma/beaker-notebook/pull/4902#issuecomment-259696530","issue_url":"https://api.github.com/repos/twosigma/beaker-notebook/issues/4902","id":259696530,"user":{"login":"scottdraves","id":963093,"avatar_url":"https://avatars.githubusercontent.com/u/963093?v=3","gravatar_id":"","url":"https://api.github.com/users/scottdraves","html_url":"https://github.com/scottdraves","followers_url":"https://api.github.com/users/scottdraves/followers","following_url":"https://api.github.com/users/scottdraves/following{/other_user}","gists_url":"https://api.github.com/users/scottdraves/gists{/gist_id}","starred_url":"https://api.github.com/users/scottdraves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottdraves/subscriptions","organizations_url":"https://api.github.com/users/scottdraves/orgs","repos_url":"https://api.github.com/users/scottdraves/repos","events_url":"https://api.github.com/users/scottdraves/events{/privacy}","received_events_url":"https://api.github.com/users/scottdraves/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T13:59:56Z","updated_at":"2016-11-10T13:59:56Z","body":"thanks!"}}
{"actor":{"display_login":"scottdraves"}}