hrbrmstr / metricsgraphics

:chart_with_upwards_trend: htmlwidget interface to the MetricsGraphics.js D3 chart library
http://hrbrmstr.github.io/metricsgraphics/
Other
132 stars 35 forks source link

Adjust Chart Font Sizes in Shiny #40

Open phillc73 opened 8 years ago

phillc73 commented 8 years ago

I'm struggling to understand how to adjust chart font sizes for a metricsgraphics chart in Shiny. I've read the documentation, examined the functions and tried StackOverflow without finding a solution for this one.

Below are two examples of the same chart, generated with the same code.

In RStudio:

rsf-rstudio

In the Shiny app:

rsscatter

As you can see the axis labels, marker and baseline font sizes are different. The ones in RStudio are OK, the ones in Shiny a bit small.

I've tried adjusting chart dimensions and padding, but neither made a difference.

Example code:

  rsScatter %>%
    mjs_plot(x=FBRV, y=RSF, left = 20, bottom = 20, top = 10) %>%
    mjs_point(color_accessor=FBRr, 
              size_accessor=BFOdds, 
              least_squares=TRUE,
              size_range=c(3, 50),
              color_type="category",
              point_size=1,
              color_range=rev(brewer.pal(n=9, name="Greens"))) %>%
    mjs_labs(x="FBR V%", y="RSF") %>%
    mjs_add_baseline(1.25, "RSF 1.25") %>%
    mjs_add_marker(0, "FBR V: 0%") %>%
    mjs_add_mouseover("function(d, i) {
               $('#rsf svg .mg-active-datapoint')
                   .text(d.point.COURSE + ' ' + d.point.TIME + ': ' + d.point.HORSE + ' | FBRr: ' + d.point.FBRr + ' | FBR: ' + d.point.FBR + ' | FBR V: ' + d.point.FBRV + '%' + ' | RSF: ' + d.point.RSF +' | BF Odds: ' + d.point.BFOdds);
                }")
hrbrmstr commented 8 years ago

can you dput(rsScatter) as well? (TIA)

phillc73 commented 8 years ago

How about an rds file of today's actual rsScatter data? I thought that might be most useful for debugging. (Sorry, it's zipped. GitHub doesn't allow direct rds file uploads) rsScatter.zip

Also should have mentioned, I'm using RStudio Version 0.99.484