npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vis-chronicle

v0.0.2

Published

Generates JSON for populating a vis.js timeline from Wikidata queries.

Downloads

118

Readme

vis-chronicle

vis-chronicle is a tool to generate web-based timelines from Wikidata SPARQL queries. You feed the tool a specification JSON file that describes what items to put on the timeline. The tool gathers the needed data from Wikidata and produces a JSON file suitable for feeding directly to vis-timeline.

vis-chronicle-demo is a demo application using this tool.

Example

This specification file generates a timeline containing the lifespans of every United States president.

{
	"groups":
	[
		{
			"id": "presidents",
			"content": ""
		}
	],
	"options":
	{
		"width": "100%",
		"preferZoom": false,
		"showCurrentTime": true,
		"stack": false,
		"stackSubgroups": false,
		"verticalScroll": true
	},
	"queryTemplates":
	{
		"dateOfBirth": "{entity} p:P569 ?_prop. ?_prop psv:P569 ?_value.",
		"dateOfDeath": "{entity} p:P570 ?_prop. ?_prop psv:P570 ?_value."
	},
	"items":
	[
		{
			"comment": "All United States presidents",
			"itemQuery": "?_node wdt:P39 wd:Q11696. ?_node wdt:P31 wd:Q5.",
			"group": "presidents",

			"startQuery": "#dateOfBirth",
			"endQuery": "#dateOfDeath"
		},
		{
			"label": "Ed Kealty (fictional)",
			"entity": "Q5335019",
			"group": "presidents",
			"startQuery": "#dateOfBirth",
			"endQuery": "#dateOfDeath"
		}
	]
}

groups and options are transparently passed through for vis-timeline - see the vis-timeline documentation. "stack": false and "stackSubgroups": false false are necessary in order for chronicle's open-ended ranges to display correctly.

queryTemplates contains template queries to be re-used by multiple items. vis-chronicle comes with a few template queries by default. Queries need to match a property (p:) using the variable ?_prop and a value (such as psv: or pqv:) using the variable ?_value. Also, any format variable like {format} will be replaced by the same-named value on the item entry, allowing templates to be parameterized.

items contains any number of items to generate. An item can be a single, literal item, or a multi-item generator (using itemQuery or items).

Item properties:

  • label: Literal items only. Display label for the item. Can contain HTML. For generators, wildcards can be used:
    • {_LABEL} will be replaced by the Wikidata label.
    • {_QID} will be replaced by the Wikidata Q-id.
  • itemQuery: Generators only. A SPARQL query segment to select all the items that should be generated. ?_node stands in for the ouput variable. The entity property is added to each item with the item's entity id. Item labels are automatically fetched from Wikidata.
  • items: Generators only. An array of Wikidata ids. Works like itemQuery but with an explicit list.
  • itemRange: Generators only. Only generates items whose time spans fall at least partially within the provided range.
    • min
    • max
  • group: The vis-timeline group to put the item(s) in.
  • className: CSS class to apply to the timeline div.
  • type: vis-timeline type of the item.
  • startQuery: A SPARQL query segment that selects the desired start time of the object. These should select Wikidata properties (not statements or values). Can be a query term like {entity} p:P569 ?_prop. ?_prop psv:P569 ?_value. or a template query like #dateOfBirth.
  • endQuery: Same as startQuery, but for the end time.
  • startEndQuery: Use instead of startQuery and endQuery separately if the start and end times are from qualifiers. This guarantees they will be drawn from the same statement.
    • general: General query segment, usually for selecting the item and property.
    • start: Query segment for selecting the start value.
    • end: Query segment for selecting the end value.
  • expectedDuration: Describes the expected duration, for hinting if the start or end is missing.
    • min: The absolute minimum duration.
    • max: The absolute maximum duration.
    • avg: The average duration.

Parameters

The tool can be run as a package script like vis-chronicle ./src/timeline.json -v.

The tool takes these parameters on the command line:

  • (Mandatory) The name of the input file or directory. If a directory, all JSON files in the directory will be combined together.
  • (Optional) The name of the output file. Defaults to intermediate/timeline.json.
  • -v[erbose]: Print verbose output, including the actual queries being run.
  • -skip-wd-cache: Do not read anything from the local cache, query all data fresh.
  • -q[uery-url]: The URL of the SPARQL endpoint. Defaults to https://query.wikidata.org/sparql.
  • -l[ang]: Language priorities to use when fetching labels. Defaults to en,mul. See (SPARQL/SERVICE - Label)[https://en.wikibooks.org/wiki/SPARQL/SERVICE_-_Label].