2

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)

myClone
  • 1,609
  • 5
  • 17
  • 28
Shweta
  • 23
  • 7
  • This is a good question. I want to know the same thing. Hopefully the author of this package (Enzo Martoglio) will see this and provide insight. – myClone Mar 02 '21 at 21:54
  • Yes ...It will be very much useful if we can change the default settings of rpivottable when we want to use different types of graphs or charts which rpivottable is providing us. – Shweta Mar 05 '21 at 12:42

1 Answers1

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")

Kat
  • 15,669
  • 3
  • 18
  • 51