0

I am using timevis package from r to create a timeline.

I would like to change the content items box to transparent instead of blue background default. I have been able to change the font color to orange but not able to change background to transparent (code, image shown below).

enter image description here

Code I have used :

library(tidyverse)
library(timevis)

data <- data.frame(
  id = 1:10,

  # 'background-color: transparent` is not working
  content = c("<span style='color:#ff8c00 style='background-color: transparent;'>Prescription</span>",
              "<strong>Hospitalization</strong>",
              "BloodReport",
              "Aerobic Pus Report",
              "Anaerobic Pus Report",
              "<span style='color:#ff8c00;'>Prescription</span>",
              "<span style='color:#ff8c00;'>Prescription</span>",
              "MRI",
              "Cultre Report", 
              "<span style='color:#ff8c00;'>Prescription</span>"
              ),
  start = c("2020-11-18","2020-11-20","2020-11-20","2020-11-23","2020-11-25","2020-11-28","2020-12-12",
            "2020-12-14","2020-12-17","2020-12-25"),
  end = c(NA,NA,NA,NA, NA, NA, NA,NA,NA,NA)
)

timevis::timevis(data)

Also tried:

"<span style='color:#ff8c00; 'background-color: transparent;'>Prescription</span>"

I have referred below SO post for this:

Is background-color:none valid CSS?

Multiple "style" attributes in a "span" tag: what's supposed to happen?

ViSa
  • 1,563
  • 8
  • 30
  • There can be a single style attribute. If not, only one will be used. Style rules are to be separated via **;** . Also you have a typo a closing quote before baçkground. – G-Cyrillus Jan 01 '21 at 12:57
  • if you need just transparent with color at all, set background-color: #ffffff00; – aktoriukas Jan 01 '21 at 13:10
  • @G-Cyrillus: I have tried these now: 1. `"Prescription"` (2). `"Prescription"` (3). `"Prescription"` (4). `"Prescription"`. None of these worked. Could you please help me with the correct line of code for this `span`. – ViSa Jan 01 '21 at 13:15
  • @aktoriukas, I am looking to make them `colored font without any background or white background`. Not sure how to combine them together in one `span`. Could you please help me with the single line of code that includes both of these properties ? – ViSa Jan 01 '21 at 13:18
  • 1
    only one style attribute !! , `span` :) – G-Cyrillus Jan 01 '21 at 13:29
  • Thanks @G-Cyrillus, this helped and have set the **background of text** white but not of the entire **box**. Is there a way to change the **background color** of the **box* to white which contains this text (pls refer to the image in the post)? – ViSa Jan 01 '21 at 13:35
  • you should be able to do so since you now understood how to write inline style ;) – G-Cyrillus Jan 01 '21 at 13:37
  • Thanks @G-Cyrillus, I was not sure how to access **box items**. But I think I can get it done using this post: https://stackoverflow.com/questions/54885083/timevis-make-different-boxes-have-colour-dependent-on-name-in-different-groups. – ViSa Jan 01 '21 at 13:42

0 Answers0