'rpivottable: How to Statically Show Values on rpivottable Where renderName is a Chart
Using rpivottable function in my code. rpivottable provides us readymade graph options which we can choose. eg 1. Heat map 2. Bar chart 3. Tree map 4. Horizontal stacked bar chart etc.
For example, when "Horizontal Bar Chart" is selected, whenever I hover over each bar it is showing appropriate value.
However, I want the value displayed on hover to be statically shown on the chart. So without hovering over, the viewer can see the value for each bar.
Is this possible?
(NOTE: This post has been edited so that the request is more clear)
Solution 1:[1]
You asked this a long time ago, but I've just now come across your question. I can help with this! Other than the treemap, all of the other charts are C3 charts.
In this example, I used the data mtcars
. I've included more than the static labels here; you may find use for some of these other methods to customize your table.
rp <- rpivotTable(mtcars, rows = "mpg", cols=c("cyl"), width = "80%", height = "40%",
rendererOptions = list(
c3 = list(legend = list(show = FALSE), # hide legend
data = list(labels = TRUE), # label the data
size = list(width = "600", # control the size
height = "500"))))
If you are using the cran package, you'll have to run this line of code, as well.
rp$x$params$rendererOptions <- rp$x$params$rendererOptions[[0]]
I've forked their repo; it doesn't look like they are going to be updating that package anymore. I've fixed this problem in my fork. If you wanted to you could always install my repo instead: devtools::install_github("fraupflaume/rpivotTable")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |