plugin-sparkline

plugin-sparkline

new plugin-sparkline(options) → {Sparkline}

Source:

Sparkline plugin.
Generates sparkline charts

  • NOTE:

    • Plugins aren't built-in. Need to be loaded or imported to be used.
    • Non required modules from billboard.js core, need to be installed separately.
  • Bear in mind:

  • Use this plugin to visualize multiple tiny chart only and chart APIs won't work properly.

  • Sparkline chart size will be based on the main chart element size. To control spakrline charts, is highly recommended to set size option.

  • Bubble, scatter and Arc(pie, donut, ratdar) types aren't supported.

  • Some options will be stricted to be:

    • resize.auto = false
    • axis.x.show = false
    • axis.y.show = false
    • axis.y.padding = 10
    • legend.show = false
Examples
// Plugin must be loaded before the use.
<script src="$YOUR_PATH/plugin/billboardjs-plugin-sparkline.js"></script>

 var chart = bb.generate({
    ...
    plugins: [
       	new bb.plugin.sparkline({
       	  selector: ".sparkline"
       	}),
    ]
 });
import {bb} from "billboard.js";
import Sparkline from "billboard.js/dist/billboardjs-plugin-sparkline";

bb.generate({
    ...
    plugins: [
       new Sparkline({ ... })
    ]
})
Parameters:
Name Type Description
options object

sparkline plugin options

Returns:
Type
Sparkline

Extends

Members

(static) selector :string

Source:
Default Value:
  • undefined

Specify sparkline charts holder selector.

  • NOTE: The amount of holder should match with the amount of data. If has less, will append necessaray amount nodes as sibling of main chart.
Type:
  • string
Example
selector: ".sparkline"