# Pie Chart Widget

**General Setting**

User can change following things in Pie Chart widget:

* Name for widget which will be used data reference. For Example, if widget name is 'Pie Chart', then data of widget is referenced as Pie Chart.data
* Show title - User can show/hide widget title
* Title Color
* Background Color

![Configure Pie Chart Widget](https://365492316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7aTljSjWsfbXZ_OP_9%2Fuploads%2FtJPYk86gGIV5s4bEIjxV%2Fpiechart_general.png?alt=media\&token=4b522ab5-166b-45ba-9cfc-6bb66466a5a1)

**Widget Setting**

In Widget Setting option, user can change following parameters:

* Inner Radius - Integer value for radius of inner circle of pie chart
* Show Legend - Enable to show legends

![Configure Pie Chart Widget](https://365492316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7aTljSjWsfbXZ_OP_9%2Fuploads%2Flwbsnc9IGUFvfVfMCJmK%2Fpiechart_widget.png?alt=media\&token=3bc8c938-e92b-4316-9a3c-4a811d12d0ae)

#### Source <a href="#source" id="source"></a>

User can select a source mode as MQTT or Action.

**Using MQTT**

Here, to update data on Pie Chart user can publish JSON object on given **data** MQTT topic. No need to provide \<account\_id> while providing the MQTT topic. The JSON obejct will be as below.

```
// Example 

{ "Andrew": 100 ,"John":160 ,"Sam":120}
```

![Configure Pie Chart Widget](https://365492316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7aTljSjWsfbXZ_OP_9%2Fuploads%2F9TpDfezRT8wpmEhBa2Du%2FlineChartSourceMQTT.png?alt=media\&token=b0bfa019-9a71-4c4d-9679-532b175a6288)

**Using Action**

Here, to update the Pie Chart widget, output of the action should contain JSON Object as given in above example. User can also update the widget either onLoad or periodically by providing refresh interval.

![Configure Pie Chart Widget](https://365492316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7aTljSjWsfbXZ_OP_9%2Fuploads%2FN6Kt6V2v2AY6DoMNOFkr%2FgmapSourceAction.png?alt=media\&token=cf74a013-a1c2-4c1e-8a98-e8970312c39d)

#### Event Handling

Pie Chart widget does not support any event.

#### Example

Here, data in below format published on configured topic, will appear as shown in image.

```
// Example

{ "Andrew": 100 ,"John":160 ,"Sam":120}
```

![MQTT Data for Pie Chart](https://365492316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7aTljSjWsfbXZ_OP_9%2Fuploads%2FEw78XR41deusQxAN4PZa%2FpieChart_MQTT_Example.png?alt=media\&token=3bd53b17-0902-488f-8d81-3ce9f98835b7)

![Pie Chart Example](https://365492316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7aTljSjWsfbXZ_OP_9%2Fuploads%2FAInylG030wzciBjgY9o2%2Fpiechart_Example.png?alt=media\&token=f5ae4449-5090-4de3-bfe2-787e980cf155)
