# Predefined annotation event on Perspective Power Chart

**URL:** <https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [December 18, 2020, 8:34pm UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662 "2020-12-18T20:34:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [December 18, 2020, 8:34pm UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/1 "2020-12-18T20:34:19Z")

</div>

I’m looking to use the Power Chart component to replace a paper chart recorder. The end user wants to press a button and have the chart annotated with predefined text (i.e. “collection step started”, “elution step complete”, etc.) and the name of the logged in user. My plan was to have a memory array with the predefined text and paste it along with the credentials of the active user through an actionPerformed script on a button.

The problem: I don’t know how to create the annotation via scripting. Is this possible?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 18, 2020, 9:27pm UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/2 "2020-12-18T21:27:36Z")

</div>

`system.tag.storeAnnotations` - it’s not yet in the user manual (oops) but autocomplete in the software should get you started on using it.

---

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [December 19, 2020, 12:06am UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/3 "2020-12-19T00:06:16Z")

</div>

😱

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/8/28a0f9d2922504932f335fd632675a1632d41527.png)

If it had not been for this post, I wouldn’t have noticed that is not only all `system.tag.*Annotations` are nowhere to be found in the user manual, but also the documentation is missing within the Designer for the following functions:

`system.tag.deleteAnnotations` has no docstring.  
`system.tag.queryAnnotations` docstring is missing the description for `types`

Maybe in 8.1.2 they’ll be available?

---

<div class="post-metadata">

**Author:** ![epsmitas](https://avatars.discourse-cdn.com/v4/letter/e/4af34b/32.png) [@epsmitas](https://forum.inductiveautomation.com/u/epsmitas)\
**Post date:** [December 21, 2020, 6:43pm UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/4 "2020-12-21T18:43:05Z")

</div>

This Button script stored an annotation for anyone working their way through this;

```
"""
system.tag.storeAnnotations(paths, startTimes, endTimes, types, data, storageId, deleted )
"""

from datetime import datetime

endTime = system.date.now()
startTime = system.date.addSeconds(endTime, -0)
tagpath = 'histprov:Postgres:/drv:cardiff:default:/tag:sterilization/vtis/mainstep'

results = system.tag.storeAnnotations( paths = [tagpath], startTimes = [startTime], endTimes= [endTime],data= ['Step Number Test'] )

system.perspective.print(message=results)
```

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [December 22, 2020, 2:24am UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/5 "2020-12-22T02:24:52Z")

</div>

Thanks! This is exactly what I need!

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [December 22, 2020, 2:25am UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/6 "2020-12-22T02:25:10Z")

</div>

Very helpful. Thanks for sharing!

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [December 22, 2020, 5:12am UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/7 "2020-12-22T05:12:39Z")

</div>

@paul-griffith Could you expand on the “type” argument for system.tag.storeAnnotations? The function descriptions states that it defaults to “marker” if not specified but the [“sqlth\_annotations” description](https://docs.inductiveautomation.com/display/DOC80/Ignition+Auto-Generated+SQL+Tables#IgnitionAuto-GeneratedSQLTables-sqlth_annotations) says that the only type is “note.” What are the options available?

Also, is it possible to edit/move the annotations so that they don’t sit atop each other? I’m hoping to use the Print To PDF functionality, but three of my four annotations won’t be visible.

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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 4, 2021, 6:23pm UTC](https://forum.inductiveautomation.com/t/predefined-annotation-event-on-perspective-power-chart/41662/8 "2021-01-04T18:23:19Z")

</div>

The `type` should be one of four literal strings that are currently understood by the power chart for representation:

```auto
    / **A user stored note.** /
    "note"
    / **A date range that indicates a special area** /
    "range"
    / **A point in time marker** /
    "marker"
    / **A single point or date range that indicates an X-trace** /
    "trace"

```
