Dwarf Fortress Storyteller (DF Storyteller, DF ST) is an application that parses Dwarf Fortress legends files, stores them internally and makes them queryable using API's. Providing a uniform interface to query the legends of Dwarf Fortress allows other applications to use this interface so they do not have to parse the (large) data files in order to display some simple information.
DF Storyteller is written to be used by other applications so it might be included in the visualizer you want to use. Look here for a list of visualizers (painters). To get started, download the executable from the release page (cross platform: Windows, Linux, macOS)
An example of a visualizer is The Bard created in DF ST.