# Dynamic pens on chart

**URL:** <https://forum.inductiveautomation.com/t/dynamic-pens-on-chart/21774>\
**Category:** Ignition\
**Created:** [January 9, 2019, 8:13pm UTC](https://forum.inductiveautomation.com/t/dynamic-pens-on-chart/21774 "2019-01-09T20:13:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WChester](https://avatars.discourse-cdn.com/v4/letter/w/df788c/32.png) [@WChester](https://forum.inductiveautomation.com/u/WChester)\
**Post date:** [January 9, 2019, 8:13pm UTC](https://forum.inductiveautomation.com/t/dynamic-pens-on-chart/21774/1 "2019-01-09T20:13:24Z")

</div>

I have a data set where I would like to use an xy chart for some data that is in a format similar to this

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c4ee69af38ad2d9c50b9aef8bb39fda918906903.png)  
In the chart I’d like to have a separate pen for each Part SN(the number of part SN’s are not fixed) and plot the cycle vs the data. Any ideas?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 9, 2019, 8:38pm UTC](https://forum.inductiveautomation.com/t/dynamic-pens-on-chart/21774/2 "2019-01-09T20:38:09Z")

</div>

That would be a group by cycle and pivot on part SN in SQL. You could use the [view() expression function](https://www.automation-pros.com/simaids/doc/expression.view.html)’s Pseudo-SQL for this, too. Part of the [Simulation Aids](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-simulation-aids) module. Something like this:

```auto
SELECT Cycle
GROUP BY Cycle
PIVOT Data FOR Part_SN
ORDER BY Cycle

```
