# Pie chart title from Transform Script

**URL:** <https://forum.inductiveautomation.com/t/pie-chart-title-from-transform-script/91153>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 30, 2024, 4:16pm UTC](https://forum.inductiveautomation.com/t/pie-chart-title-from-transform-script/91153 "2024-05-30T16:16:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [May 30, 2024, 4:16pm UTC](https://forum.inductiveautomation.com/t/pie-chart-title-from-transform-script/91153/1 "2024-05-30T16:16:15Z")

</div>

Hello!

```python

    if quality.isGood() and value is not None:

        py_data = system.dataset.toPyDataSet(value)
        
 
        first_month = None
        for row in py_data:
            if first_month is None or row['LOC'] < first_month:
                first_month = row['LOC']
        
        non_zero_count = 0
        zero_count = 0
        
      
        for row in py_data:
            if row['LOC'] == first_month:
                state = row['STATES']
                if state > 0:
                    non_zero_count += 1
                else:
                    zero_count += 1

    
        data = [
            {"label": "Non-Zero Percentage", "value": non_zero_count},
            {"label": "Zero Percentage", "value": zero_count}
        ]        

        title = first_month        
   
        return {"title": title, "data": data}
    else:
 
dictionary
        return {}

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/a/9a2fcd6c4549a102856a38fcda27b66b931d1ae9.png)

I would like to pass the title to a pie chart from a transform script...but seem is not working, it goes all together with the data.

Also I would like it to be the value of that LOC

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 30, 2024, 4:22pm UTC](https://forum.inductiveautomation.com/t/pie-chart-title-from-transform-script/91153/2 "2024-05-30T16:22:35Z")

</div>

Use `system.perspective.sendMessage` in your script with  
`payload = {"title" : title}`.

Add a message handler on the chart to listen for the message.  
In the message handler script,  
`self.props.title = payload['title']`
