Skip to content

Overlay charts with two y-axis on opposites not displayed #21

@Johanneslueke

Description

@Johanneslueke

The Chart in Question:
image

Only the first y-axis of the first plot of the overlay function is honored!
My expection woud have been that both y-axis left and right were rendered.

the code to the chart:

 #let y_axis2 = axis(min: 0,  max: 200, step: 40, location: "left", show_values: true, title: "Mtl. Kosten (€)")
      #let x_axis2 = axis(values: ("","Jan", "Feb", "Mar", "Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"), location: "bottom", helper_lines: false, invert_markings: false)

      #let y_axis3 = axis(min: 0,  max: 2000, step: 400, location: "right", )
      #let x_axis3 = axis(values: ("","Jan", "Feb", "Mar", "Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"), show_values: true, location: "bottom", helper_lines: false, invert_markings: false)

      #let data = ( 
         (  "Jan", 156.95),
          (  "Feb", 156.95),
          (  "Mar", 156.95),
          (  "Apr", 156.95),
          (  "Mai", 156.95),
          (  "Jun", 156.95),
          (  "Jul", 156.95),
          (  "Aug", 156.95),
          (  "Sep", 156.95),
          (  "Okt", 156.95),
          (  "Nov", 156.95),
          (  "Dez", 156.95)
      )
    
      #let data_hist = ( 
          ( 156.95,    "Jan"),
          ( 156.95*2,  "Feb"),
          ( 156.95*3,  "Mar"),
          ( 156.95*4,  "Apr"),
          ( 156.95*5,  "Mai"),
          ( 156.95*6,  "Jun"),
          ( 156.95*7,  "Jul"),
          ( 156.95*8,  "Aug"),
          ( 156.95*9,  "Sep"),
          ( 156.95*10, "Okt"),
          ( 156.95*11, "Nov"),
          ( 156.95*12, "Dez")
      )

      
      
      // Combine the axes and the data and feed it to the plot render function.
      #let pl2 = plot(axes: (x_axis2, y_axis2), data: data)
      #let pl3 = plot(axes: (x_axis3, y_axis3), data: data_hist)
      
     #let monthly = graph_plot(pl2, (100%,20%))
     #let histo   = bar_chart(pl3,(100%,20%), bar_width: 50%)
     
     #overlay((histo,monthly),(100%,20%))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions