Code Monkey home page Code Monkey logo

Comments (4)

JohnCoene avatar JohnCoene commented on May 22, 2024 2

Reinstall the package.

devtools::install_github("JohnCoene/ehcarts4r")

You can now pass additional options to ..., see official documentation for a full list. FYI that is true for all other echarts4r functions 👍

USArrests %>% 
  e_charts(UrbanPop) %>% 
  e_line(Assault) %>% 
  e_area(Murder, y.index = 1, x.index = 1) %>% 
  e_toolbox(feature = "saveAsImage", title = "Save As Image")

Note e_datazoom is a convenience function so if you want to rename the title for that you will have to go first initialise the toolbox with the dataZoom feature, then use e_datazoom (same for e_brush):

USArrests %>% 
  e_charts(UrbanPop) %>% 
  e_line(Assault) %>% 
  e_area(Murder, y.index = 1, x.index = 1) %>% 
  e_y_axis(gridIndex = 1) %>%
  e_x_axis(gridIndex = 1) %>% 
  e_grid(height = "35%") %>% 
  e_grid(height = "35%", top = "50%") %>% 
  e_toolbox("dataZoom", title = list(zoom = "zoom", back = "back")) %>%
  e_datazoom()

Close if it works, tell you if you get an error.

from echarts4r.

JohnCoene avatar JohnCoene commented on May 22, 2024 1

You were doing it right, my functions were not... I couldn't find a way of fixing this without breaking the toolbox as it currently is.

Reinstall

devtools::install_github("JohnCoene/echarts4r")

Now toolbox is split into two functions.

  1. e_toolbox - general toolbox options
  2. e_toolbox_feature - feature specific options

To do what you want:

USArrests %>% 
  e_charts(UrbanPop) %>% 
  e_line(Assault) %>% 
  e_area(Murder, y.index = 1, x.index = 1) %>% 
  e_toolbox(right = "10%") %>%
  e_toolbox_feature(feature = "saveAsImage", title = "Save As Image") 

Note that you can still use e_toolbox_feature directly if you do not want to pass additional options.

USArrests %>% 
  e_charts(UrbanPop) %>% 
  e_line(Assault) %>% 
  e_area(Murder, y.index = 1, x.index = 1) %>% 
  e_toolbox_feature(feature = "saveAsImage") 

Sorry if this broke some of your functions (replace e_toolbox to e_toolbox_feature)

from echarts4r.

tlorusso avatar tlorusso commented on May 22, 2024 1

That's great - the spliting makes totally sense imo. It adds flexibility in customizing the toolbox as a whole as well as its single components. Thanks a lot. Really appreciate your efforts!!

from echarts4r.

tlorusso avatar tlorusso commented on May 22, 2024

Thanks a lot! I get no error and it accepts the custom title. However the title gets cut ("Save As Im...") as the toolbox element is placed next to the container / canvas border. I've tried adjusting the position of the entire toolbox by passing the right='20%' as well as moving the position / allignment of the text with the textPosition / textAlign option. Is this supposed to work?

I found a way that solved the problem for me in my specific case by putting a dataview element next to it. However if there is / can be a way to move the toolbox or the text OR the there would be more space for the title by default, that would be even better.

USArrests %>% 
  e_charts(UrbanPop) %>% 
  e_line(Assault) %>% 
  e_area(Murder, y.index = 1, x.index = 1) %>% 
  e_toolbox(feature = "saveAsImage", title = "Save As Image") %>% 
  e_toolbox(feature = "dataView",title="Data",lang="")

from echarts4r.

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.