# Flex Repeater with Pie Charts

**URL:** <https://forum.inductiveautomation.com/t/flex-repeater-with-pie-charts/91190>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 31, 2024, 10:41am UTC](https://forum.inductiveautomation.com/t/flex-repeater-with-pie-charts/91190 "2024-05-31T10:41:26Z")\
**Posts on this page:** 4\
**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 31, 2024, 10:41am UTC](https://forum.inductiveautomation.com/t/flex-repeater-with-pie-charts/91190/1 "2024-05-31T10:41:26Z")

</div>

I´m trying to generate dinamically Pie Charts with a Flex repeater based on number of months I want to see.

one example of wanted result not generated dinamically:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/4/54de98041f178a5e32e277f0a708439e4e88573a.png)

To do so, I´ve got my Flex repeater with the path to a Pie chart

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/e/6e3b654d1226ce0252659f1c6a5c55b0757ac1c6.png)

I binded my named Query with a transform on the instances of the Flexbox

```python
def transform(self, value, quality, timestamp):

    if quality.isGood() and value is not None:
  
        py_data = system.dataset.toPyDataSet(value)
        
  
        unique_months = sorted(set(row['LOC'] for row in py_data))
        
        all_data = []

    
        for month in unique_months:
            count_zero = 0
            count_one = 0
            
          
            for row in py_data:
                if row['LOC'] == month:
                    state = row['STATES']
                    if state == 0:
                        count_zero += 1
                    elif state == 1:
                        count_one += 1
            
            data = [
                {"label": "Zero Value States", "value": count_zero},
                {"label": "One Value States", "value": count_one}
            ]
            
            all_data.append({"data": data})
        
        return all_data
    else:
     
        return []

```

wich works fine  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/fa92dfa906682406869fc539548d00c3558850d8.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/2/62196cf8727b10707bd0924f2643b0ee1ebaafde.png)

Now I´m not sure how to bind the Pie View to this instances to see the result

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [May 31, 2024, 11:23am UTC](https://forum.inductiveautomation.com/t/flex-repeater-with-pie-charts/91190/2 "2024-05-31T11:23:21Z")

</div>

the path to the view should be to your pie view,  
this view would need a param named data which will contain the {value,label} for your one pie

---

<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 31, 2024, 11:25am UTC](https://forum.inductiveautomation.com/t/flex-repeater-with-pie-charts/91190/3 "2024-05-31T11:25:27Z")

</div>

It works! thanks @victordcq

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5c2bd94c8bac2b281477e9cca124947942292f22.png)

---

<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 31, 2024, 11:32am UTC](https://forum.inductiveautomation.com/t/flex-repeater-with-pie-charts/91190/4 "2024-05-31T11:32:39Z")

</div>

![Pie flex repeater](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/5/85a8d223be43f2d836517f21a0b2a89b06fe9891.png)
