D3 vertical bar graph

How can I draw a chart as follows? I have data (for example):

{
  "USA": {
    "value": 10,
    "companies": [ "Apple", "Google" ],
    "color": "red"
  },
  "Germany": {
    "value": 3,
    "companies": [ "SAP" ],
    "color": "green"
  }
}

"value" for the left side.
"companies" for the right side.
"value"! = "compnaies" length.

I cannot figure out which graph should I use.
I will try hierarchy , but it should have only one root.

graph

+4
source share
1 answer

poc, , , , , : https://jsfiddle.net/z9bcfdvk/ : , .

var data = [
        {
            country: "USA",
            "value": 10,
            companies: ["Apple", "Google"],
            "color": "#123445"
        },
        {
            country: "Germany",
            "value":
                3,
            companies:
                ["SAP"],
            "color":
                "#987456"
        }, {
            country: "France",
            "value":
                1,
            companies:
                ["RENAULT"],
            "color":
                "#8b9838"
        }
    ]
0

Source: https://habr.com/ru/post/1669785/


All Articles