Skip to main content
5-Regular Member
December 1, 2015
Question

String Data in pie chart

  • December 1, 2015
  • 1 reply
  • 2424 views

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.

1 reply

1-Visitor
December 1, 2015

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.

5-Regular Member
December 1, 2015

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

1-Visitor
December 1, 2015

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).