v7.3.0

TimelineHistogram
Widget

This view displays histograms for the provided store records.

A ScaleColumn is also added automatically.

To create a standalone histogram, simply configure it with a Store instance:

const store = new Store({
    data : [
        {
            id            : 'r1',
            name          : 'Record 1',
            // data used to render a histogram for this record
            histogramData : [
                { value1 : 200, value2 : 100 },
                { value1 : 150, value2 : 50 },
                { value1 : 175, value2 : 50 },
                { value1 : 175, value2 : 75 }
            ]
        },
        {
            id            : 'r2',
            name          : 'Record 2',
            // data used to render a histogram for this record
            histogramData : [
                { value1 : 100, value2 : 100 },
                { value1 : 150, value2 : 125 },
                { value1 : 175, value2 : 150 },
                { value1 : 175, value2 : 75 }
            ]
        }
    ]
});

const histogram = new TimelineHistogram({ appendTo : 'targetDiv', startDate : new Date(2022, 11, 26), endDate : new Date(2022, 11, 30), store, // specify series displayed in the histogram series : { value1 : { type : 'bar', field : 'value1' }, value2 : { type : 'bar', field : 'value2' } }, columns : [ { field : 'name', text : 'Name' } ] });

Providing histogram data

There are two basic ways to provide histogram data:

  • the data can be provided statically in a record field configured as dataModelField:
const store = new Store({
    data : [
        {
            id   : 11,
            name : 'John Smith',
            // data used to render a histogram for this record
            hd   : [
                { weight : 200, price : 100 },
                { weight : 150, price : 105 },
                { weight : 175, price : 90 },
                { weight : 175, price : 95 }
            ]
        }
    ]
});

const histogram = new TimelineHistogram({ dataModelField : 'hd', series : { weight : { type : 'bar' }, price : { type : 'outline' } }, ... });
  • the data can be collected dynamically with the provided getRecordData function:
const histogram = new TimelineHistogram({
    dataModelField : 'hd',
    series : {
        weight : {
            type : 'bar'
        },
        price : {
            type : 'outline'
        }
    },
    ...
    async getRecordData(record) {
        // we get record histogram data from the server
        const response = await fetch('https://some.url/to/get/data?' + new URLSearchParams({
            // pass the record identifier and the time span we need data for
            record    : record.id,
            startDate : DateHelper.format(this.startDate),
            endDate   : DateHelper.format(this.endDate),
        }));
        return response.json();
    }
});

Please check "Timeline histogram" guide for more details.

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class

Properties

Properties are getters/setters or publicly accessible variables on this class

Functions

Functions are methods available for calling on the class

    Events

    Events are triggered for certain actions in this class and can be listened for to react to those actions in your code
    • unsplit
      FROM-FEATURE

      Fires when un-splitting the Grid.

      Added by the Split feature, only available when that feature is enabled.

    Event handlers

    Event handlers are callbacks called as a result of certain actions in this class
    • onUnsplit
      FROM-FEATURE

      Called when un-splitting the Grid.

      Added by the Split feature, only available when that feature is enabled.