Git Product home page Git Product logo

Comments (8)

timelyportfolio avatar timelyportfolio commented on August 18, 2024 1

@jangorecki Looks like we need to do a couple things to support rowTotals and colTotals now provided and explained in rendererOptions.

  1. update pivottable to the newest release 2.23.0
  2. add arguments rowTotals and colTotals or a recycling option as you suggest

For now, a very ugly solution would be to modify the htmlwidget as shown below.

library(rpivotTable)

rp <- rpivotTable(
 Titanic,
 rows = "Survived",
 cols = c("Class","Sex"),
 aggregatorName = "Sum as Fraction of Columns",
 vals = "Freq"
)
rp$x$params$rendererOptions <- list(table = list(rowTotals = FALSE))
htmltools::browsable(
  htmltools::attachDependencies(
    htmltools::tagList(
      rp
    ),
    htmltools::htmlDependency(
      name = "pivottable",
      version = "2.23.0",
      src = c(href = "https://unpkg.com/"),
      script = "[email protected]/dist/pivot.min.js",
      stylesheet = "[email protected]/dist/pivot.css"
    ),
    append = TRUE
  )
)

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

According to the pivottable Q&A it is possible do what you want changing the css:

.pvtTotal, .pvtTotalLabel, .pvtGrandTotal {display: none}

You could in principle fork the package, change the css as above and use the new version: a lot of work!

What would make sense though, would be a way to change the css programmatically, i.e. on the fly.

I'm investigating...

from rpivottable.

timelyportfolio avatar timelyportfolio commented on August 18, 2024

Perhaps ramnathv/htmlwidgets#231 will help.

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@timelyportfolio great suggestion!

I was hoping to be able to use the JS method described here,
but I haven't been able to change the css on the fly in javascript (see my reply), therefore I'm a bit stuck.

Any further help is very welcome!

from rpivottable.

anu87 avatar anu87 commented on August 18, 2024

@smartinsightsfromdata I tried it in CSS - I added a style.css file to a folder 'www' in the project folder and then tried to add code that @XavierFlo shared. That didn't work. But if I change/add other things to the file about header and interface, it does change the Shiny output.

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

I will give it a try next week, as I will be on hols :)

from rpivottable.

smartinsightsfromdata avatar smartinsightsfromdata commented on August 18, 2024

@anu87 Apologies for taking so long. I didn't get around to try this, but I now posted in github (cran ongoing) a new version of rpivotTable aligned to the latest version of pivottable.

Would you be so kind to try again and report?

See also this nicolaskruchten/pivottable#538

from rpivottable.

jangorecki avatar jangorecki commented on August 18, 2024

There is subtotals argument to enable sub totals but there is no totals argument to disable totals... New totals argument could take logical of length two (recycled when length 1) to control rows/columns separately allowing to disable only row totals.
As per linked issue in pivottable js, this seems to be implemented there already, could we add support in rpivotTable function for that?

from rpivottable.

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.