# Perspective Power Chart set data range

**URL:** <https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 29, 2024, 9:20am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878 "2024-01-29T09:20:48Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [January 29, 2024, 9:20am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/1 "2024-01-29T09:20:48Z")

</div>

In Power Chart, I bind startDate and endDate in cofig.  
But set Date Range don't show the right time .

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

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

How to resolve it?

---

<div class="post-metadata">

**Author:** ![Bryson\_Prince](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bryson_prince/32/48866_2.png) [@Bryson\_Prince](https://forum.inductiveautomation.com/u/Bryson_Prince)\
**Post date:** [February 12, 2024, 10:41pm UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/2 "2024-02-12T22:41:15Z")

</div>

Hi,

Without seeing the bindings, and any other processes that may be affecting those properties, it will be hard to give a solution for this issue.

I'd suggest reaching out to our support department instead. You can create a support ticket using this link: [https://support.inductiveautomation.com/hc/](https://support.inductiveautomation.com/hc/) and one of our support reps can assist in finding a solution for this issue.

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 12, 2024, 6:46am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/3 "2024-03-12T06:46:08Z")

</div>

![9e20ab73df5153b1ecb08be0991e33a](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/6/66675fdca260565ef96ac9768e49dc71d39ee976.png)

 ![7b97a75db86719bbd08b07271dbcea4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c75e8fba94f481d4b8634ffd31a3b7ab2caf1bbf.png)

---

<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:** [March 12, 2024, 11:10am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/4 "2024-03-12T11:10:39Z")

</div>

You are trying to use strings that _ **look like** _ dates as if they are dates. **They are not.** Use Ignition's `system.date.*()` scripting functions or the equivalent expression functions to _ **construct** _ date objects.

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 15, 2024, 7:22am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/5 "2024-03-15T07:22:31Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/0/b0f2ec8bf23c73b04ff70de3997940870e1142c2.png)

I already format it as datetime, but the powerchart's datetime don't change .

---

<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:** [March 15, 2024, 11:17am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/6 "2024-03-15T11:17:08Z")

</div>

Formatting makes strings. So you are taking a string and making a string. Still a string. You need a datetime object (`java.util.Date`), like that returned by any of Ignition's datetime expression functions and `system.date.*` scripting functions.

Or use a date picker's value directly, **unformatted**.

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 20, 2024, 1:08pm UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/7 "2024-03-20T13:08:35Z")

</div>

> [@pturmel](#):
>
> You are trying to use strings that _ **look like** _ dates as if they are dates. **They are not.** Use Ignition's `system.date.*()` scripting functions or the equivalent expression functions to _ **construct** _ date objects.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/3/b362621415aad743eb01e187d92b35795ed36d89.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:** [March 20, 2024, 1:17pm UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/8 "2024-03-20T13:17:45Z")

</div>

1. You are binding `werChart.props.config.starDate` to `../LabelNowstartDT.props.text` which is a string. The label text is a string and you want a date so don't do that. Bind `startDate` to whatever is supplying the date to the label.
2. There should be no reason to use `import datetime`. Ignition's `system.date` functions should do all you need. (But you shouldn't be using strings as dates anyway.)

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 21, 2024, 2:24am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/11 "2024-03-21T02:24:20Z")

</div>

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

I query sql to bind the result .  
In the sql ,it is timestamp.  
ChartTime is right now,but datatime input time is wrong?

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

---

<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:** [March 21, 2024, 10:52am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/12 "2024-03-21T10:52:20Z")

</div>

If the column from a query is a true date/time/timestamp object, don't parse it. It already is a the right datatype for assignment to a date/time component.

Also, note that assigning to the components in a loop means you only keep the values from the last row in the loop. Is that what you want?

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 24, 2024, 11:36am UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/13 "2024-03-24T11:36:54Z")

</div>

If I don't parse it,the datetime can't show.

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

---

<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:** [March 24, 2024, 12:49pm UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/14 "2024-03-24T12:49:15Z")

</div>

> [@taohongyu88](#):
>
> don't parse it

Your screenshot clearly shows the dataset column types are `TIMESTAMP`. Those yield `java.sql.timestamp` objects, which are compatible with `java.util.Date`. Something else is wrong. What kind of components are the `startDateTime` and `endDateTime` to which you are assigning these column values?

---

<div class="post-metadata">

**Author:** ![taohongyu88](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@taohongyu88](https://forum.inductiveautomation.com/u/taohongyu88)\
**Post date:** [March 24, 2024, 12:58pm UTC](https://forum.inductiveautomation.com/t/perspective-power-chart-set-data-range/84878/15 "2024-03-24T12:58:22Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7d25a8ac7dc305195654a48b164302440d2a3167.png)

Now is right!
