Coder Social home page Coder Social logo

Comments (5)

jbkunst avatar jbkunst commented on June 22, 2024

Hi @majerus! Thanks for try/test the package.

First of all. In the future, can you style/format the code? It's easy, just ``` at the begginig and at the end. So it's easy for who read your code.

Ok. You can specify the margins with hc_chart and enabled the exporting with hc_exporting (by default is false).

Can you try this code and tell me if it help you?

mtcars %>%
  group_by(cyl) %>%
  summarise(ave_mpg = mean(mpg)) -> tmp

hc <- highchart() %>% 
  hc_add_theme(hc_theme_chalk()) %>% 
  hc_chart(margin = c(50, 100, 150, 200)) %>% 
  hc_title(text = "Example", style = list(color = "#F3F2F2")) %>% 
  hc_subtitle(text = paste("Example Date", Sys.Date()-1),
              style = list(color = "#F3F2F2", fontWeight = "bold")) %>% 
  hc_xAxis(categories = tmp$cyl) %>% 
  hc_add_series(name = "mpg", type = "column", color = "#002878", showInLegend = FALSE, 
                dataLabels = list(align = "center", enabled = TRUE, format = "", color = "#F3F2F2"),
                data = tmp$ave_mpg) %>% 
  hc_tooltip(crosshairs = TRUE, shared = TRUE, valueSuffix = "") %>% 
  hc_yAxis(title = "mpg", minorGridLineWidth = 0, gridLineWidth = 0, labels = list(format = ""), max = max(tmp$ave_mpg))

# without Download Menu
hc

# with Download Menu
hc %>% hc_exporting(enabled = TRUE)

from highcharter.

majerus avatar majerus commented on June 22, 2024

Thank you and sorry for forgetting to format the code.

This is close to what I am hoping to figure out. Is it possible to remove the padding around the graph as well? In the link I shared there is no white-space padding around the graph. Is that possible in the R implementation?

Thanks for the quick response. Again, this is impressive work.

Rich

from highcharter.

jbkunst avatar jbkunst commented on June 22, 2024

Do you ask who to remove the padding when you use saveWidget, right?. htmlwidget have a template which add some padding to the resulting html. When you have your html you can edit and add other script tag after all the script tags and add:

<script>
$(document).ready(function () {
    $("div").css("top", 0).css("left", 0).css("right", 0).css("bottom", 0)
});
</script>

This will remove all the padding for all the divs and will be no more white space ;)!

Before:

image

After:

image

I hope this is what you need XD.

from highcharter.

majerus avatar majerus commented on June 22, 2024

Thanks. I was able to tweak the html manually to accomplish this. I am
hoping to find a way to do this within the r-script because the actual
script sends a query, runs an analysis and produces this a graph daily.

Rich

On Wed, Feb 10, 2016 at 2:56 PM, Joshua Kunst [email protected]
wrote:

Do you ask who to remove the padding when you use saveWidget, right?.
htmlwidget have a template which add some padding to the resulting html.
When you have your html you can edit and add other script tag after all the
script tags and add:

<script> $(document).ready(function () { $("div").css("top", 0).css("left", 0).css("right", 0).css("bottom", 0) }); </script>

This will remove all the padding for all the divs and will be no more
white space ;)!

Before:

[image: image]
https://cloud.githubusercontent.com/assets/56481/12959825/068571ac-d017-11e5-835e-68b1cb37f264.png

After:

[image: image]
https://cloud.githubusercontent.com/assets/56481/12959839/14ddd974-d017-11e5-9465-d2a244069f42.png

I hope this is what you need XD.


Reply to this email directly or view it on GitHub
#39 (comment).

Rich Majerus
richmajerus.com

from highcharter.

jbkunst avatar jbkunst commented on June 22, 2024

I guess you can code this functionality ;)!

I'm closing the issue.

from highcharter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.