How to use @hpcc-js/other - 10 common examples

To help you get started, we’ve selected a few @hpcc-js/other examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hpcc-systems / Visualization / packages / marshaller / src / ddl1 / HipieDDLMixin.ts View on Github external
callback(widget);
                }
            });
        }
        if (this._prev_ddlUrl && this._prev_ddlUrl !== this.ddlUrl()) {
            //  DDL has actually changed (not just a deserialization)
            this
                .clearContent()
                ;
        }
        this._prev_ddlUrl = this.ddlUrl();
        this._prev_databomb = this.databomb();

        //  Gather existing widgets for reuse  ---
        const widgetArr = [];
        Persist.widgetArrayWalker(this.content(), function (w) {
            widgetArr.push(w);
        });
        const widgetMap = d3Map(widgetArr, function (d) {
            return d.id();
        });
        const removedMap = d3Map(widgetArr.filter(function (d) { return d.id().indexOf(d._idSeed) !== 0 && d.id().indexOf("_pe") !== 0; }), function (d) {
            return d.id();
        });

        const context = this;
        this._marshaller = new HipieDDL.Marshaller()
            .proxyMappings(this.proxyMappings())
            .clearDataOnUpdate(this.clearDataOnUpdate())
            .propogateClear(this.propogateClear())
            .missingDataString(this.missingDataString())
            .widgetMappings(widgetMap)
github hpcc-systems / Visualization / tests / test-other / src / other.spec.ts View on Github external
describe(`${item.prototype.constructor.name}`, () => {
                    if (item.prototype instanceof Class) {
                        classDef("other", item);
                    }
                    if (item.prototype instanceof HTMLWidget || item.prototype instanceof SVGWidget || item.prototype instanceof CanvasWidget) {
                        switch (item.prototype.constructor) {
                            case HeatMap:
                                render(new HeatMap()
                                    .columns(data.HeatMap.simple.columns)
                                    .data(data.HeatMap.simple.data)
                                );
                                break;
                            case Table:
                                const table = new Table()
                                    .columns(["Subject", "Year 1", "Year 2", "Year 3", "Year 4"])
                                    .data([
                                        ["Width 2 undefined", , 83, , 72],
                                        ["English II", 17, 43, 83, 93],
                                        ["English III", 6, 43, 64, 93],
                                        ["Width Blank", 7, "", 52, 83],
                                        ["Geography II", 16, 73, 52, 83],
                                        ["Width 2 undefined", , 83, , 72],
                                        ["Science", 66, 60, 85, 6],
                                        ["Science II", 46, 20, 53, 7],
github hpcc-systems / Visualization / tests / test-other / src / other.spec.ts View on Github external
["Science", 1],
                                        ["Geography", 3],
                                        ["Irish", 5],
                                        ["English", 7],
                                        ["Spanish", 2],
                                        ["Physics", 4],
                                        ["Astrology", 6]
                                    ])
                                    .label("Label:  ")
                                    .valueColumn("Col Value")
                                    .textColumn("Col Label")
                                );
                                */
                                break;
                            case Select:
                                render(new Select()
                                    .columns(["Col Label", "Col Value"])
                                    .data([
                                        ["Math", 0],
                                        ["Science", 1],
                                        ["Geography", 3],
                                        ["Irish", 5],
                                        ["English", 7],
                                        ["Spanish", 2],
                                        ["Physics", 4],
                                        ["Astrology", 6]
                                    ])
                                    .label("Label:  ")
                                    .valueColumn("Col Value")
                                    .textColumn("Col Label")
                                );
                                break;
github hpcc-systems / Visualization / tests / test-other / src / other.spec.ts View on Github external
describe(`${item.prototype.constructor.name}`, () => {
                    if (item.prototype instanceof Class) {
                        classDef("other", item);
                    }
                    if (item.prototype instanceof HTMLWidget || item.prototype instanceof SVGWidget || item.prototype instanceof CanvasWidget) {
                        switch (item.prototype.constructor) {
                            case HeatMap:
                                render(new HeatMap()
                                    .columns(data.HeatMap.simple.columns)
                                    .data(data.HeatMap.simple.data)
                                );
                                break;
                            case Table:
                                const table = new Table()
                                    .columns(["Subject", "Year 1", "Year 2", "Year 3", "Year 4"])
                                    .data([
                                        ["Width 2 undefined", , 83, , 72],
                                        ["English II", 17, 43, 83, 93],
                                        ["English III", 6, 43, 64, 93],
                                        ["Width Blank", 7, "", 52, 83],
                                        ["Geography II", 16, 73, 52, 83],
                                        ["Width 2 undefined", , 83, , 72],
                                        ["Science", 66, 60, 85, 6],
                                        ["Science II", 46, 20, 53, 7],
                                        ["With 2 NULL", null, 20, null, 7],
                                        ["Math", 98, 30, 23, 13],
                                        ["Math II", 76, 30, 34, 6],
                                        ["Math III", 80, 30, 27, 8]
                                    ])
                                    ;
github hpcc-systems / Visualization / tests / test-other / src / other.spec.ts View on Github external
["English III", 6, 43, 64, 93],
                                        ["Width Blank", 7, "", 52, 83],
                                        ["Geography II", 16, 73, 52, 83],
                                        ["Width 2 undefined", , 83, , 72],
                                        ["Science", 66, 60, 85, 6],
                                        ["Science II", 46, 20, 53, 7],
                                        ["With 2 NULL", null, 20, null, 7],
                                        ["Math", 98, 30, 23, 13],
                                        ["Math II", 76, 30, 34, 6],
                                        ["Math III", 80, 30, 27, 8]
                                    ])
                                    ;
                                render(table);
                                break;
                            case Html:
                                render(new Html()
                                    .html('<div style="border:1px solid red;padding:10px;margin:20px;font-size:24px;">Text in a div!</div>')
                                );
                                break;
                            case IconList:
                            case AutoCompleteText:
                                /*
                                render(new AutoCompleteText()
                                    .columns(["Col Label", "Col Value"])
                                    .data([
                                        ["Math", 0],
                                        ["Science", 1],
                                        ["Geography", 3],
                                        ["Irish", 5],
                                        ["English", 7],
                                        ["Spanish", 2],
                                        ["Physics", 4],
github hpcc-systems / Visualization / tests / test-other / src / other.spec.ts View on Github external
["English", 7],
                                        ["Spanish", 2],
                                        ["Physics", 4],
                                        ["Astrology", 6]
                                    ])
                                    .label("Label:  ")
                                    .valueColumn("Col Value")
                                    .textColumn("Col Label")
                                );
                                break;
                            case Legend:
                                const line = new Line()
                                    .columns(data.ND.ampolar.columns)
                                    .data(data.ND.ampolar.data)
                                    ;
                                const legend = new Legend()
                                    .targetWidget(line)
                                    ;
                                render(new Border()
                                    .setContent("center", line)
                                    .setContent("right", legend)
                                );
                                break;
                            default:
                                it.skip("Missing Test", () => {
                                    expect(false).to.be.true;
                                });
                        }
                    }
                });
            }
github hpcc-systems / Visualization / packages / marshaller / src / ddl1 / HipieDDL.ts View on Github external
Marshaller.prototype.url = function (url, callback) {
    this.espUrl = new Comms.ESPUrl()
        .url(url)
        ;
    let transport = null;
    let hipieResultName = "HIPIE_DDL";
    if (this.espUrl.isWorkunitResult()) {
        hipieResultName = this.espUrl.param("ResultName");
        transport = new Comms.HIPIEWorkunit()
            .url(url)
            .proxyMappings(this._proxyMappings)
            .timeout(this._timeout)
            ;
    } else {
        transport = new Comms.HIPIERoxie()
            .url(url)
            .proxyMappings(this._proxyMappings)
            .timeout(this._timeout)
github hpcc-systems / Visualization / demos / dashy / src / index.ts View on Github external
init(placeholder: string, urlStr, layoutJson?) {
        const _url = new Comms.ESPUrl().url(urlStr);
        if (!!_url.param("dashboard")) {
            this._dashy = new Dashboard(new ElementContainer())
                .target(placeholder)
                .hideSingleTabs(true)
                .titleVisible(false)
                .render()
                ;
        } else {
            this._dashy = new Dashy()
                .target(placeholder)
                .render()
                ;
        }

        this._dashy.element()
            .on("drop", () => this.dropHandler(this.event()))
github hpcc-systems / Visualization / packages / marshaller / src / ddl1 / HipieDDL.ts View on Github external
Marshaller.prototype.url = function (url, callback) {
    this.espUrl = new Comms.ESPUrl()
        .url(url)
        ;
    let transport = null;
    let hipieResultName = "HIPIE_DDL";
    if (this.espUrl.isWorkunitResult()) {
        hipieResultName = this.espUrl.param("ResultName");
        transport = new Comms.HIPIEWorkunit()
            .url(url)
            .proxyMappings(this._proxyMappings)
            .timeout(this._timeout)
            ;
    } else {
        transport = new Comms.HIPIERoxie()
            .url(url)
            .proxyMappings(this._proxyMappings)
            .timeout(this._timeout)
            ;
    }

    const context = this;
    transport.fetchResults().then(function (response) {
        if (Utility.exists(hipieResultName, response)) {
            return transport.fetchResult(hipieResultName).then(function (ddlResponse) {
                const json = ddlResponse[0][hipieResultName];
                context.parse(json, function () {
                    callback(response);
                });
            }).catch(function (e) {
                context.commsEvent(context, "error", hipieResultName, e);
github hpcc-systems / Visualization / packages / marshaller / src / ddl1 / HipieDDL.ts View on Github external
});
        });

        if (this.WUID) {
            this.comms = new Comms.HIPIEWorkunit()
                .url(this.URL)
                .proxyMappings(proxyMappings)
                .timeout(timeout)
                .hipieResults(hipieResults)
                ;
        } else if (this.databomb) {
            this.comms = new Comms.HIPIEDatabomb()
                .hipieResults(hipieResults)
                ;
        } else if (DDL1.isHipieDatasource(datasource)) {
            this.comms = new Comms.HIPIERoxie()
                .url(datasource.URL)
                .proxyMappings(proxyMappings)
                .timeout(timeout)
                .hipieResults(hipieResults)
                ;
        }
    }