Wie füge ich Tooltip -Etiketten in R Sparline hinzu?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie füge ich Tooltip -Etiketten in R Sparline hinzu?

by Anonymous » 02 Mar 2025, 12:10

Ich habe Beispielcode zum Hinzufügen von Sparklinien zu DT DataTable, die funktionieren, mit Ausnahme des Tooltip in Sparlin (aus dem Funkline-Paket).

Code: Select all

library(sparkline)
library(formattable)
library(DT)
library(tidyverse)

## Create dataframe

data = data.frame(group = rep(c("A", "B"),3), yr_q = rep(c("2021 Q1", "2021 Q2", "2021 Q3"),2), count = c(1, 2, 3, 4, 5, 6))

## Add in column showing Trend for sparkline

data1 = data %>% group_by(group) %>% summarise("Trend" = spk_chr(count, x = yr_q, tooltipFormat = '{{x}}:{{y}}'))

## Create table (just illustrating issue)

data1 %>% formattable() %>% as.datatable() %>% spk_add_deps()
Hier zeigt der Farkline -Tooltip für Gruppe A: '0: 1', '1: 3' und '2: 5' , wenn es ' 2021 Q1: 1', '2021 Q2: 3', '2021 Q3: 5' . Tooltip. < /p>
Es scheint jedoch stattdessen in einen Index umzuwandeln. Ich frage mich, dass es möglicherweise die Verwendung von spk_add_deps oder anderen verwendet wird.>

Top