Open Saad55555 opened 5 years ago
Any brilliant mind with an idea?
After looking at this, the only solution I can find involves a modification to the source code of rpivotTable. It is in fact a bug in the way the 2 parameters are handled and passed into the pivotUI() call.
I can provide a patch if needed.
That would be great if you could provide the patch or update the codes. Bundle of thanks mate :)
https://github.com/avsdev-cw/rpivotTable/tree/patch-002 - you can use devtools::install_github() to install
Usage would be something like:
library(rpivotTable)
rpivotTable(
data = mtcars,
rows = c("cyl"),
cols = c("carb"),
aggregatorName = "Sum",
vals = "mpg",
rendererName = "Table",
renderers = '{"Table": $.pivotUtilities.renderers["Table"], "Bar Chart": $.pivotUtilities.c3_renderers["Bar Chart"]}',
aggregators = '{"Sum": $.pivotUtilities.aggregators["Sum"]}',
width = "50%",
height = "550px")
Thanks a lot, but the output is showing '0' as rendererName and aggregatorName. No options are displayed with empty table. Can you please have a look?
I've bumped the version number in that branch to 0.3.1002
Install the branch from within R/RStudio with: devtools::install_github("avsdev-cw/rpivotTable", "patch-002")
Restart R and then use library(rpivotTable) to load the new library. Use sessionInfo() to check that the version that is loaded is 0.3.1002
NOTE: this is a development build of the package and as such you should treat it with caution, especially when deploying your application. If one of the maintainers of rpivotTable would like to include the modification in the origin repository, I am happy to create a PR for them to do so.
Many thanks mate :) its working perfectly now. Just one last question, is it possible to remove 'Totals' coming up in column and rows?
You can add a stylesheet with a couple of rules in it:
.pvtTotal, .pvtGrandTotal, .pvtTotalLabel {
display: none
}
.pvtGrandTotal {
display: none;
}
You do lose the right hand table border though...
@avsdev-cw Great stuff. Would you like to submit a PR for the patch?
Thanks a lot mate, is it possible for you to update the codes with stylesheet having those rules. I tried but didn't work. Regards
The CSS change would need to be done on your app. This link should help you with how to do it: https://shiny.rstudio.com/articles/css.html
Somehow i did not get the Version 0.3.1002. When I install the package with devtools::install_github("avsdev-cw/rpivotTable", "patch-002") and check the version by sessionInfo() i still have 0.3.0. Is there any solution for that
@AndreasPhilippi did you restart your R session before loading the library?
I only want to have Table, Bar chart as RendererName and Sum coming up in AggregatorName. It is currently not working. I shall be extremely grateful for the help. Thanks
Codes: