Metric User Script Configuration for a Line Data Visualization in UI Builder

davmz
Tera Contributor

So I am creating a Line Data Visualization Component and I am having trouble figuring out the script to add for the Metric, the Data Source I have figured out and works with other Data Visualization Components.

This is what the visualization looks like with these script configurations:

davmz_0-1705337339851.png

 

Data Source Script:

 

    return [{
        allowRealTime: true,
        filterQuery: "###",
        id: "###",
        isDatabaseView: false,
        sourceType: "table",
        tableOrViewName: "###"
    }];

 

 

Trend Script:

 

    return {
        "trendByFields": [{
            "field": "anything",
            "metric": "###"
        }],
        "trendByFrequency": "date"
    };​

 


Metric Script: 

 

    return {
        axisId: "primary",
        dataSource: "###",
        id: "###",
        transforms: {
            metric: "###",
            transform: [{
                name: "chart-subjects",
                transform: "Reference"
            }]
        }
    };​

 


I have looked through the Page Definition and the composition JSON of a static input component to reference.

 

"metrics": {
    "container": [
        {
            "container": {
                "axisId": {
                    "type": "JSON_LITERAL",
                    "value": "primary"
                },
                "dataSource": {
                    "type": "JSON_LITERAL",
                    "value": "###"
                },
                "id": {
                    "type": "JSON_LITERAL",
                    "value": "###"
                },
                "numberFormat": {
                    "type": "JSON_LITERAL",
                    "value": {
                        "customFormat": false
                    }
                },
                "transforms": {
                    "type": "JSON_LITERAL",
                    "value": [
                        {
                            "metric": "###",
                            "transform": {
                                "name": "chart-subjects",
                                "transform": "Reference"
                            }
                        }
                    ]
                }
            },
            "type": "MAP_CONTAINER"
        }
    ],
    "type": "LIST_CONTAINER"
},

 

 

Any help will be great. Thanks in advance.

1 REPLY 1

Hari1
Mega Sage

Hi @davmz ,

I am facing the same issue did you find a solution for this?