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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

String Data in pie chart

VijayBhimraoCha
7-Bedrock

String Data in pie chart

Any idea on how to show String data in pie chart in thingworx?

I have service which returns a String type data. Requirement is to display that data in pie chart. But it looks ThingWorx only allows NUMBER as source data for pie chart.

Any solution, workaround for the same. Pl. let me know the related details and example if any? I am using java as service implementation language.

5 REPLIES 5
qn
12-Amethyst
12-Amethyst
(To:VijayBhimraoCha)

I wonder how would you like to display s String type data on a pie chart, knowing that this chart is used principally for percentage.

There could be n-number of such usecases. For example, my service list all the tasks from different projects. Now need to create pie chart of number of tasks from each project. So I should be create pie chart for project column. Many such examples. Following Sample Data:

-------------------------------------

Project     Tasks

-------------------------------------

Proj1        Design

Proj2        Implementation

Proj2        Design

Proj3        Testing

Proj2        Estimate

Proj3        Manufacturing

qn
12-Amethyst
12-Amethyst
(To:VijayBhimraoCha)

I would create a service which provides the data for the Pie chart. Following the Sample Data, my service will do something like this:

1) Count the number of tasks from each project --> Proj1 - 1, Proj2 - 3, Proj3 - 2

2) (Optionally) Calculate the percentage: Number of tasks from each project / Total number of tasks * 100 --> Proj1 - 16.67%, Proj2 - 50%, Proj3 - 33.33%

With this data, the Pie chart can display now 3 parts (for 3 projects) with the percentage of number of tasks from each project. If the percentage was not calculated by the step 2, it will be automatically calculated by the chart, I suppose. In this case, the value displayed while hovering will be the number of tasks from each project (instead of percentage if step2 was realized).

That's how I am doing now. Creating additional column for every column where charting is required/used. But I think that's not efficient way. It has its own overhead, considering data to be fetched from different application across network. So I was looking for more efficient way to achieve the same.

qn
12-Amethyst
12-Amethyst
(To:VijayBhimraoCha)

You do not need to create additional columns. I would do like this:

- Create a new DataShape with 2 fields: Name (String), Value (Number)

- In the new service above, after counted the number of tasks from each project, I will create a new InfoTable based on the new DataShape above

- I add a number of new rows to this InfoTable which are exactly the amount of project

- Info of each row: row.Name = nameOfProject, row.Value = numberOfTasksFromProject

This InfoTable would have a low impact on memory / cpu usage.

Announcements


Top Tags