Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust c3 axis labels with css #21

Open
ixodid198 opened this issue Jan 12, 2021 · 0 comments
Open

Adjust c3 axis labels with css #21

ixodid198 opened this issue Jan 12, 2021 · 0 comments

Comments

@ixodid198
Copy link

The last date on the x-axis of my c3 chart is cut off.

Screen Shot 2021-01-11 at 8 28 39 PM

Since space is tight I wish to re-align the date rather than create more space for the date to print.

Using Chrome Inspector I can manually adjust the text-anchor: middle to text-anchor: end

and that seems to work.

Screen Shot 2021-01-11 at 8 22 12 PM

However, I do not understand how to do this with css.

Here's my R Script and related css though I don't think that R is relevant to the issue here.

R Script

library(shiny)
library(c3)

data <- data.frame(a = abs(rnorm(20) * 10),
                   b = abs(rnorm(20) * 10),
                   date = seq(as.Date("2014-01-01"), by = "month", length.out = 20))


ui <- fluidPage(
  
  includeCSS("c3.css"),
  
  c3Output("chart",  height = "100%")
)

server <- function(input, output, session) {
  output$chart <- renderC3({
    data %>%
      c3(x = 'date') %>%
      tickAxis('x', count = 5, format = '%Y-%m-%d') 
  })
}

shinyApp(ui, server)

css

.c3-line {
  stroke-width: 4px !important; 
}

.c3-axis-x-label {
    text-anchor: end; 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant