# Perspective XY Chart data pivot

**URL:** <https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 27, 2022, 10:27am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114 "2022-05-27T10:27:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [May 27, 2022, 10:27am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/1 "2022-05-27T10:27:16Z")

</div>

I have a dataset,I need to show that value in an XY chart with row view. I’m attaching the images.

 ![data_1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/8/088e3e611fb66fbb4817d6ccd7574e58c4d9a55f.png)  
 ![data_set](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/86f6fce6dd7b9182344b9496ab7701c18b9a8174.png)

here I need the data in row wise as u can see its showing in column wise only.

---

<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 27, 2022, 10:34am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/2 "2022-05-27T10:34:37Z")

</div>

It is not clear what you are asking.  
Your table has three columns. Your chart has only two pens. Why?  
Where is the data coming from?

---

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [May 27, 2022, 10:39am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/3 "2022-05-27T10:39:47Z")

</div>

I was trying that. as u can see the the values is being taken in column wise , but I need to get that in row wise. In vision its available under the behaviour --Extract order.

 ![visionxy](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/9/c96495c7938620b41bb1fd67b981f872cca98d4c.png)  
 ![xychart](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/2/e2916ff2ed07a2e78801eccde8e9b551eb91c238.png)  
check these we have an option for that to change in vision, so I’m thinking is there any way to get that function in perspective.

---

<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 27, 2022, 10:49am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/4 "2022-05-27T10:49:35Z")

</div>

That does not make sense to me because the first column is a timestamp so each of the points has to relate to the X-axis.

If you need to, you can manipulate the data in the binding by adding a script transform.

---

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [May 27, 2022, 11:23am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/5 "2022-05-27T11:23:36Z")

</div>

Thanks for the reply. I think you didn’t got what I asked. Let me explain.  
I have a XY chart in perspective and also I put one in vision as a category chart.  
so there is a database for me in which that dataset will be created, here what you are seeing is what i had created for testing.  
So in perspective I’m using the same dataset which I’m using in vision. but in vision there is an option under behaviour that we extract the data by column or row. I’m asking is there anything like that in perspective.  
The data is being taken as column wise, but I need it as row wise  
 ![MicrosoftTeams-image (3)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/f/5fc303171f7b1ad74954abbadf7d434159a2954e.png)  
this is the vision chart like this I need the data in perspective. please shoot your doubts.

---

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [May 27, 2022, 11:34am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/6 "2022-05-27T11:34:12Z")

</div>

![data_set_1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/4/24d3d115c4361250e7d82e0df9264aee5e89975f.png)  
I need to plot like this rather than column wise.  
I hope you are getting what I’m trying to achieve.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 27, 2022, 11:59am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/7 "2022-05-27T11:59:34Z")

</div>

I assume you just have a query binding on the data property.

You need to `PIVOT` your data either in SQL or by a script transform.

---

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [May 28, 2022, 3:19am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/8 "2022-05-28T03:19:27Z")

</div>

yeah, correct. I was just asking is there any other inbuilt option in perspective to change that, because in vision we had that, we can extract order by column or row, that’s why.

---

<div class="post-metadata">

**Author:** ![John\_S1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@John\_S1](https://forum.inductiveautomation.com/u/John_S1)\
**Post date:** [May 28, 2022, 3:42am UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/9 "2022-05-28T03:42:47Z")

</div>

One more thing is there that; if we pivot it, timestamps will become column names. And they will constantly change.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 31, 2022, 12:07pm UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/10 "2022-05-31T12:07:15Z")

</div>

Yes, but that is exactly the format you showed in your image.

Typically in an XY chart each column represents a series, in your case the t\_stamp.

There is not yet an inbuilt way to PIVOT perspective chart data. You will have to do it in either SQL or in a script transform.

---

<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, 2022, 1:08pm UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/11 "2022-05-31T13:08:55Z")

</div>

> [@John\_S1](#):
>
> One more thing is there that; if we pivot it, timestamps will become column names.

Remove them in your SQL query or in the binding script transform.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [May 31, 2022, 3:09pm UTC](https://forum.inductiveautomation.com/t/perspective-xy-chart-data-pivot/60114/12 "2022-05-31T15:09:46Z")

</div>

I’m also quite confused as to what is supposed to happen to the timestamps ?

if you need to remove them and pivot the table, you can use this

```python
pivoted_data = list(zip(*data))

```

and if you need to remove the first column (the timestamps)

```python
pivoted_data = list(zip(*data[1:]))

```
