chart-parts is a flexible Grammar-of-Graphics designed for application developers.
In the seminal book The Grammar of Graphics, Leland Wilkinson envisioned a system of charting components and data-flow processes to support the generation of charts.
Charting is a common and complex task. Charting libraries are often implemented as taxonomies of charts, providing components such as BarChart, LineChart, AreaChart, or ScatterPlot to cover the most broadly used types of charts. When a developer wants to augment a chart with a modest graphic such as a mean line or an uncertainty band, or make a novel visualization, it's often necessary to eject out of the charting library and work directly with a 2D rendering API such as SVG, Canvas or WebGL. Additionally, charting libraries are often browser-dependent, which precludes the ability to abstractly describe charts independently of platform.
We believe that the notion of a Grammar of Graphics, sometimes referred to as mark-based visualization, has been proved in many contexts to be an elegant way to describe expressive, functional charts that are not as constrained by the charting library that is selected. Moreover, this level of abstraction is easier to develop software at than low-level graphics libraries, and is not coupled to any platform.
In The Grammar of Graphics, the author envisions a sequenced pipeline of steps that are common to creating charts: including data transformations, scale applications, mark binding, and rendering of marks and guides. Each of these steps is predicated on components existing to define these processes.
These systems are built on the analogy that graphical elements are to charting as words are to prose, and they are constructed of a "language" of fundamental charting elements. These charting elements are described at a higher level than raw graphics primitives.
Mark-based systems are common in data-visualization research, but are relatively rare in practice. The most notable implementations of these systems presently are Vega and it's descendants Vega-Lite and Altair.
These systems are excellent for certain use cases, but are often tightly coupled to a target rendering context (e.g. Browsers), and may not integrate easily with application code.