hrbrmstr / taucharts

:bar_chart: An R htmlwidget interface to the TauCharts javascript library
http://rpubs.com/hrbrmstr/taucharts
Other
65 stars 12 forks source link

CSS Rules not local to a single graphic #39

Closed jeremiahpslewis closed 9 years ago

jeremiahpslewis commented 9 years ago

When a css rule is added to a single graphic, e.g. tau_add_css_rule(".axis_rooty:not(.facet-axis) .tick:nth-child(2n+2) text {opacity: 0;}"), the rule takes effect for all graphics on the .Rmd HTML page. It's probably a good idea to nest all rules within a chart id, so that different themes can be applied to different graphics.

hrbrmstr commented 9 years ago

the {{ID}} helper (check the function help) doesn't target each specifically?

On Wed, Aug 12, 2015 at 3:08 PM, jlewis91 notifications@github.com wrote:

When a css rule is added to a single graphic, e.g. tau_add_css_rule(".axis_rooty:not(.facet-axis) .tick:nth-child(2n+2) text {opacity: 0;}"), the rule takes effect for all graphics on the .Rmd HTML page. It's probably a good idea to nest all rules within a chart id, so that different themes can be applied to different graphics.

— Reply to this email directly or view it on GitHub https://github.com/hrbrmstr/taucharts/issues/39.

jeremiahpslewis commented 9 years ago

Thanks. Sorry, missed that in the documentation. What do you think about throwing a message when {{ID}} is not part of a css rule? It doesn't seem like a great idea to use a html widget to inject page-wide css.

jeremiahpslewis commented 9 years ago

if(!grepl(css_grep, css)) {message("CSS Rules without {{ID}} are applied to entire document.")}

hrbrmstr commented 9 years ago

I think that could be arranged :-)

On Wed, Aug 12, 2015 at 3:32 PM, jlewis91 notifications@github.com wrote:

if(!grepl(css_grep, css)) {message("CSS Rules without {{ID}} are applied to entire document.")}

— Reply to this email directly or view it on GitHub https://github.com/hrbrmstr/taucharts/issues/39#issuecomment-130420626.

jeremiahpslewis commented 9 years ago

Thanks! Looks great.