I am new to JavaScript/D3, and I am trying to code a relatively simple visualization based on some toy data I have, but cannot figure it out. This is the toy data:
toy_data = {
'abstract' : ['a'],
'introduction' : ['b', 'c'],
'methods' : ['d', 'e', 'f'],
'findings' : ['g', 'h', 'i', 'j'],
'conclusion' : ['k', 'l', 'm', 'n', 'o']
}
I want to write a function that takes in data formatted like this (or in a slightly different way, if necessary) and generates a visualization in D3 that looks roughly like the following (I generated this plot in Altair using similar data):
The difference would be that the x axis labels would correspond to the terms specified in my toy data, and I would only have as many circles as there are items in each associated key-value pair (e.g. 1 circle for abstract, 2 for introduction, 3 for methods, etc.). Eventually, I also will add additional data to control the size of the circles as in the image above, but for the moment I am satisfied with just a function that can take in any data of this form and at least generate a prototype with circles of the same size.
I feel like this should be fairly doable in D3, perhaps by defining a scatter plot and then adding connecting horizontal lines, or by combining a line plot and scatter plot, but I cannot figure out how to do it. If someone can explain and give an example of how to achieve this behavior, that would be extremely helpful, as I think I can build off of it to achieve what I want.
