Perspective Power Chart set data range

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

How to resolve it?

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/ and one of our support reps can assist in finding a solution for this issue.

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.

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

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.

1 Like

  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.)
1 Like

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

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?

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

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?

Now is right!

1 Like