Skip to content

Support basic charts #1663

@damithc

Description

@damithc

Suggestions: Provide support (likely through a third-party plugin) to add basic charts (e.g., bar/line/pie ... charts) using text sources (or csv files), similar to how we support basic UML diagrams.


(Updating the description to include the TODO from the attempt in #2052

  • Add optional mermaid plugin for alternative diagram & chart support

(Updating the description to include conclusions/TODOs from the discussions below, see #1663 (comment))

  1. Include documentation/examples on how it is possible to utilize some of these charting libraries
  2. Extract out a few common chart types with minimalistic options to allow for really simple use cases.
    • E.g. a way to create a piechart by doing something like <pie-chart>data = [1,2,3]</pie-chart>.
    • The user need not know what is the underlying charting library in use, and the user is limited in terms of the options provided.
  3. Create a general abstraction to simplify the typical steps required

Elaboration on the last point:

  1. import (help import the script according to the type defined)
  2. define a location to place the chart (user define the data/option right here, or pass in from an external file via data attribute)
  3. init with a data/option object (help pass the data/option and generate the required script to append to the page)

Example syntax:

<chart type="chartjs">
{
    type: 'bar',
    data: {
        labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3],
        }]
    },
    options: {
        scales: {
            y: {
                beginAtZero: true
            }
        }
    }
}
</chart>
<chart type="chartjs" data="/chart2.json"></chart>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions