Grouped bar chart with multi line. #2200
              
                Unanswered
              
          
                  
                    
                      ctofficial08
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 3 replies
-
| 
         Can you share the data? I don't understand how "Year" and "key" can be on the same date axis.  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    3 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I want to implement Grouped bar chart with multi line in same graph plot with Y axis show in both sides. But when I am using fx for bar the bar is getting grouped but the line is also getting grouped. I want the bar in groups, but lines should be show without breaking.
I am using below code and getting the screenshot1.png but I want like screenshot2.png
Please help to implement screenshot2.png using observable plot.
const plot = Plot.plot({

x: { axis: null },
fx: { padding: 0 },
y: { tickFormat: "s", grid: true, padding: 0 },
color: { scheme: "puor" },
marks: [
Plot.lineY(linedata, { x: "Year", y: "hours", stroke: "purple", strokeWidth: 1 }),
Plot.lineY(session, { x: "Year", y: "hours", stroke: "lightgreen", strokeWidth: 1 }),
Plot.barY(data, { x: "key", y: "population", fill: "key", fx: "state" }),
Plot.ruleY([0])
]
});
This is what I am getting currently
This is the requirement

Beta Was this translation helpful? Give feedback.
All reactions