Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Line Graph reporting Data Visualization in UI Builder

Hari1
Mega Sage

Hi,

I am using the Data Visualization component in the UI Builder where i do not want to use Group By or need to set Group By to --None--. I want the Data Visualization component in the UI Builder to show the data as per the below report.

Report:

Hari1_0-1714646172835.png

What i see on the UI Builder Data Visualization component

Hari1_1-1714646243733.png

I have not added any condition for the Group By

Hari1_2-1714646342463.png

Data source:

 

 

 

var data = [{
        "isDatabaseView": false,
        "allowRealTime": true,
        "sourceType": "table",
        "label": {
            "message": "LABEL OF YOUR DV" // Proper label
        },
        "tableOrViewName": "incident", // Table name
        "filterQuery": "cmdb_ci.ref_cmdb_ci_business_app.u_product.name=" + api.data.product_gr_1.output.name + "^sys_created_onONThis year@javascript:gs.beginningOfThisYear()@javascript:gs.endOfThisYear()", //you can bind the state values here  
        "id": "DVID" //proper ID name
    }];
    return data;

 

 

 

Metric:

 

 

 

var metric = [{
        "dataSource": "DVID", // from data source
        "id": "METRICID", // proper id
        "aggregateFunction": "COUNT",
        "aggregateField": "",
        "numberFormat": {
            "customFormat": false
        },
        "axisId": "primary"
    }];
    return metric;

 

 

 

 Trend by:

 

 

 

var trend = {
      "trendByFrequency" : "month",
            "trendByMinuteInterval" : null,
            "trendByFields" : [ {
              "field" : "sys_created_on", //trend on which field
              "metric" : "METRICID" // From metric
            } ]
    };
    return trend;

 

 

 

@Nootan BhatCan you please help on how to achieve this?

 

3 REPLIES 3

Hari1
Mega Sage

Hi @Nootan Bhat , Can you please let me know if this can be achieved?

Mark Manders
Mega Patron

https://www.servicenow.com/community/developer-forum/data-visualization-time-series-line-area-graph-...


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Nootan Bhat
Kilo Sage

Hi @Hari1 ,

Answered the question in https://www.servicenow.com/community/developer-forum/data-visualization-time-series-line-area-graph-...

Please mark this as solved if it helped you!

 

Thanks