Skip to content

KnockoutJS: Label plot

Dmitry A. Grechka edited this page Feb 15, 2017 · 2 revisions

Label plot

label plot

You may want to read about general approach to the KnockoutJS support in IDD [here](KnockoutJS support). This page is about specific plot type.

Label plot is the way to draw a number of text labels.

To create it you must create a plot with data-idd-plot="label" attribute and three mandatory bindings.

Mandatory bindings:

  • iddX (number array) - horizontal coordinates data series
  • iddY (number array) - vertical coordinates data series
  • iddLabelsText (string array) - a sentences to type

Remark: Length of iddX, iddY and iddLabelsText must be the same. The plot will not be drawn until the length is the same.

Source code: View

    <div id="chart" data-idd-plot="chart">
        <div data-idd-plot="label" data-bind="iddX: X, iddY: Y, iddLabelsText: Words" />
    </div>

Source code:View Model

    ko.applyBindings({
        X: ko.observable([1,2,3]),
        Y: ko.observable([2,3,1]),
        Words: ["One","Two","Three"]
    });

Interactive sample