最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - morris.js Multiple stacked bars on single label - Stack Overflow

matteradmin6PV0评论

I'm curious if morris.js supports having multiple stacked bars on single label and if someone knows workaround.

I want to have 2 graphs stacked together on same line. Blue and red should be on top each other and green and yellow.

Morris.Bar({
    element: 'daily_revenue',
    data: [],
    xkey: 'label',
    ykeys: ['inbound_netto', 'inbound_brutto', 'outbound_netto', 'outbound_brutto'],
    labels: ['Inbound Netto', 'Inbound Brutto', 'Outbound Netto', 'Outbound Brutto'],
    resize: true,
    barColors: ["#B21516", "#1531B2", "#1AB244", "#B29215"],
    hideHover: true
});

Thank you.

I'm curious if morris.js supports having multiple stacked bars on single label and if someone knows workaround.

I want to have 2 graphs stacked together on same line. Blue and red should be on top each other and green and yellow.

Morris.Bar({
    element: 'daily_revenue',
    data: [],
    xkey: 'label',
    ykeys: ['inbound_netto', 'inbound_brutto', 'outbound_netto', 'outbound_brutto'],
    labels: ['Inbound Netto', 'Inbound Brutto', 'Outbound Netto', 'Outbound Brutto'],
    resize: true,
    barColors: ["#B21516", "#1531B2", "#1AB244", "#B29215"],
    hideHover: true
});

Thank you.

Share Improve this question edited Nov 6, 2015 at 13:35 TayTay 7,1905 gold badges46 silver badges69 bronze badges asked Nov 6, 2015 at 13:26 TadejTadej 111 silver badge3 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

I don't think it's possible with the latest Morris.js version (0.5.1).
You can set the stacked parameter to true in your Morris.Bar configuration, but for only one stacked bar for each label:

stacked: true

Morris charts samples

Post a comment

comment list (0)

  1. No comments so far