Data Visualization - Time Series: Line / Area Graph : UI Builder not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 02:40 AM
Hi,
I am trying to create a Line / Area Graph using data visualization in UI Builder. I am not able to see any data when i run the page. I see the data to be blank.
Below is the script:
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;
It is not working without Group By, But i don't want the data to be set to Group By based on a field. It has to be based on the month so i have not set Group By as i have trend based on month. I am not sure what is going wrong. Can anyone please help.
Example of a report: I want the Data Visualization on the UI Builder to be as below.
@Nootan Bhat, Can you please help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2024 03:40 AM
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 04:13 AM - edited 05-07-2024 04:41 AM
Hi @Hari1,
Try to print the below in console in data source:
api.data.product_gr_1.output.name
If I am not wrong the data source values need to be used like:
api.data.product_gr_1.output.name.value
because api.data.product_gr_1.output.name will return the object which holds keys value & displayValue.
Above will work for the data resource lookuprecord. But if you are using data resource gliderecord query then the dynamic binding will be different.
So try using this and let me know if it resolved your issue.
Thanks
Nootan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 11:04 PM
Hi @Nootan Bhat
I don't see it to be working. Even if i just add a simple query as below
"sys_created_onONThis year@javascript:gs.beginningOfThisYear()@javascript:gs.endOfThisYear()^state=7" it is still not working. It just gives a blank screen on the data visualization component.
Below is the code:
Data source:
var data = [{
"isDatabaseView": false,
"allowRealTime": true,
"sourceType": "table",
"label": {
"message": "LABEL OF YOUR DV" // Proper label
},
"tableOrViewName": "incident", // Table name
"filterQuery": "sys_created_onONThis year@javascript:gs.beginningOfThisYear()@javascript:gs.endOfThisYear()^state=7", //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;
Can you please help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2024 11:46 PM
Hi @Nootan Bhat
Can you please help on how to get this issue resolved, The Time Series is not working even when i pass a simple query. But the same code that i have provided on the 1st or 2nd example works fine for pie, single score, etc but not for Time Series.
Can you please share the code samples that your using to achieve this?