JSPM

mithril-node-linechart

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q24125F

Line chart component for Mithril NodeJS

Package Exports

  • mithril-node-linechart

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mithril-node-linechart) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-mithril-linechart

A simple SVG line chart component for Mithril and NodeJS.

Line chart screenshot

Usage

Add linechart to your dependencies on package.json file then:

const linechart = require("linechart");
const model = {
    "lines": [
        {
            "title": "A",
            "color": "#ff33ee",
            "data": [
                {
                    "label": "Sample label",
                    "value": 100,
                    "tooltip": "More details"
                },
                ...
            ]
        },
        {
            "title": "B",
            "color": "#2233ee",
            "data": [
                {
                    "label": "Some label",
                    "value": 130,
                    "tooltip": "More details"
                },
                ...
            ]
        },
        ...
    ]
};
const ctrl = linechart.controller(model);
const view = linechart.view(ctrl);

Options

  • lines: Define the lines of the line chart.
    • title: Define the title of the line.
    • color: Define the color of the line.
    • data: Define values to draw the line chart.
      • label: X value of the point.
      • value: Y value of the point.

Test

Setup mithril-component-tools first. Then:

npm install
mct test .