Skip to main content
12-Amethyst
April 30, 2024
Solved

How to display Data in barchart

  • April 30, 2024
  • 3 replies
  • 1001 views

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

Best answer by TonyZhang

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();

 

3 replies

5-Regular Member
April 30, 2024

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

 

Community Moderator
May 8, 2024

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.

TonyZhang16-PearlAnswer
16-Pearl
December 4, 2024

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();