cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to display Data in barchart

LY_10691079
12-Amethyst

How to display Data in barchart

Hi Everyone,

I have a service which is fetching data and I have bind that service to grid widget which displays the data now I want to count each column unique data (I mean there are duplicates data in column) but I want them to count once and then showing that records to the Bar Chart graph and the graph data should change based on filter selected by user

for e.g. Suppose we have 4 column like, name , age , Class , place now I want to count each column and represent in bar chart  

 

Thanks and Regards,
Lav

ACCEPTED SOLUTION

Accepted Solutions

Hi @LY_10691079,

 

I guess what you are looking for is how to count distinct values of a column in infotable?

Check out below sample code.

let params = {
	t: infotableData /* INFOTABLE */,
	columns: columnName /* STRING */
};
// get distinct values of a column in the infotable first with below function
let distinct = Resources["InfoTableFunctions"].Distinct(params);
// count the number of distinct values using infortable.getRowCount function
let countDistinct = distinct.getRowCount();

 

Tony

View solution in original post

3 REPLIES 3

Hello @LY_10691079 ,

 

Kindly follow the article having knowledge of implemeting the Bar Chart Graph in a Mashup:

https://www.ptc.com/en/support/article/CS351273?

 

Let m eknow if you have any further questions.

 

Regards

Bhawna

 

Hello @LY_10691079,

 

It looks like you have a reply on your topic. If it helped you solve your question please mark the reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Community Moderation Team.

Hi @LY_10691079,

 

I guess what you are looking for is how to count distinct values of a column in infotable?

Check out below sample code.

let params = {
	t: infotableData /* INFOTABLE */,
	columns: columnName /* STRING */
};
// get distinct values of a column in the infotable first with below function
let distinct = Resources["InfoTableFunctions"].Distinct(params);
// count the number of distinct values using infortable.getRowCount function
let countDistinct = distinct.getRowCount();

 

Tony
Announcements


Top Tags