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
-
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({
![screenshot1](https://private-user-images.githubusercontent.com/77676642/376507745-9edf3f42-77e9-4490-8ef3-0c33d6ccd9a3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MjM2ODIsIm5iZiI6MTczODkyMzM4MiwicGF0aCI6Ii83NzY3NjY0Mi8zNzY1MDc3NDUtOWVkZjNmNDItNzdlOS00NDkwLThlZjMtMGMzM2Q2Y2NkOWEzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDEwMTYyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc1MmU4NGIwYzc0ZjRhZTViODA5ZjRkMzAxYjA1YWJmOGRiZDg0YjU2N2M0YzdlZDBiNjJjNjIwYjRhMzZkODcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qHwbFynqe0liJManluTkpHSvtKze0zN7uqnf64kwVX4)
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
![screenshot2](https://private-user-images.githubusercontent.com/77676642/376507863-0f6ea476-ecff-4b9d-88a5-b8be6d01e84f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MjM2ODIsIm5iZiI6MTczODkyMzM4MiwicGF0aCI6Ii83NzY3NjY0Mi8zNzY1MDc4NjMtMGY2ZWE0NzYtZWNmZi00YjlkLTg4YTUtYjhiZTZkMDFlODRmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDEwMTYyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY5ODVmMTVhMjZlYzM5NWFjYTVhZGU5ZjBjZDY1YWU2ZWJhNTI2NTFmODY4Mjc5NThiODMwYjg4YWVjYjM1NGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.T1O52hTa4vF2hvO6u_vg6v7csKxScGrzSRnOnSG9BS0)
Beta Was this translation helpful? Give feedback.
All reactions