How Do I Sync Ignition Perspective Chart Timestamps?

James Nishida6 min read
HMI / SCADAOther ManufacturerTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

The first chart zooms to the dragged date interval, but the second chart stays on its previous time range. This usually comes from mixing an Easy Chart event pattern with a Perspective XYChart, reading a configured range that does not change during client-side zoom, or leaving the receiving chart in an automatic range mode.

Component and View Prerequisites

Before anything else, confirm which visualization component is actually on the page. An XYChart identifies a Perspective implementation; an Easy Chart example belongs to a different visualization model. Code based on event.source cannot be transferred directly when the Perspective event does not expose source.

  1. Open both chart components in the designer and confirm that they are Perspective XYChart components.
  2. Confirm whether both charts are siblings in the same view. The expression self.getSibling("XYChart") works only when a component named XYChart is a sibling of the component represented by self.
  3. If the charts are not siblings, select an appropriate data path: view custom properties for charts in one view, or session custom properties when the range must cross view boundaries.
  4. Identify the date axis on each chart. Perspective chart date-range configuration is associated with xAxes.date.range.
Condition Range transport Confirmation
Charts are siblings Direct component reference or shared parent property self.getSibling("XYChart") resolves the intended chart
Charts share a view but are not siblings View custom properties Both charts can bind to the same view-level values
Charts are in different views Session custom properties Both views can read the same session-level range

Do not move on until the component type, component hierarchy, and date axis have been identified on both charts.

Zoom-Range Source Test

Test the proposed zoom API against the chart that the operator manipulates. The available example reads the component through self and calls two component functions:

chart = self.getSibling("XYChart")
return "{} - {}".format(
    str(chart.getZoomedStartDate()),
    str(chart.getZoomedEndDate())
)

Run the test once before zooming and again after selecting a different date interval. The decisive check is whether both returned timestamps change to match the visible axis limits. A successful call alone is insufficient; unchanged values cannot drive synchronization.

If the methods are unavailable or continue returning the same values, stop using that Easy Chart-style access path for this XYChart. Inspect the Perspective component's live properties while performing the zoom. Check both xAxes.date.range and the chart's selected data range. A selection property is usable only when its start and end values change with the operator's gesture.

Keep cursor hover and zoom selection separate. A cursor can render the date beneath the pointer without publishing that date as a component property. The synchronization requirement needs the two zoom boundaries, not the transient hover label. Do not move on until one observable source produces a changing start and end timestamp.

Shared Start and End Values

Create one shared start value and one shared end value at the narrowest scope that reaches both charts. For charts in the same view, view custom properties provide a direct handoff without making the range global to the session. Session custom properties are appropriate only when separate views must follow the same interval.

  1. Write the observed zoom start into the shared start property.
  2. Write the observed zoom end into the shared end property.
  3. Read both properties back before applying them to the second chart.
  4. Reject an incomplete pair; changing only one boundary can produce an invalid or misleading window.
  5. Verify that start precedes end and that both values retain their date/time type through the transfer.
Value Source Acceptance check
Shared start Chart 1 zoom start Changes when the left zoom boundary changes
Shared end Chart 1 zoom end Changes when the right zoom boundary changes
Range pair Shared properties Start is earlier than end

A formatted string such as "start - end" is useful for display diagnostics, but it is a poor transport format. Preserve the two endpoints separately so Chart 2 receives date values rather than text that must be parsed. Do not move on until both shared values update after every new selection.

Receiving-Chart Manual Range

Configure Chart 2 to accept explicit boundaries. Set its date-range mode to manual, then connect the shared start and end values to the corresponding fields under its xAxes.date.range configuration.

  1. Change Chart 2 from its automatic date-range behavior to manual.
  2. Bind the manual range's lower boundary to the shared start value.
  3. Bind the manual range's upper boundary to the shared end value.
  4. Apply a new zoom on Chart 1 and watch Chart 2's live range properties.
  5. Confirm that Chart 2 redraws with the same visible start and end timestamps.

Automatic range calculation can overwrite or ignore supplied boundaries because it derives the displayed span from the receiving chart's own data. This is especially visible when the two charts contain different series or different data extents. Do not move on until Chart 2 remains in manual mode and follows both endpoints without reverting to its data-derived range.

Direction and Feedback Control

Start with one-way synchronization from Chart 1 to Chart 2. One-way flow separates range capture from range application and prevents Chart 2's update from being interpreted as a new operator action.

Design Use Recurring pitfall
One-way binding Chart 1 is the range controller None of Chart 2's changes return to Chart 1
Bidirectional binding Either chart may control the range Updates can bounce between charts
Session property exchange Charts occupy different views Unrelated pages may inherit stale range values

If operators must zoom either chart, add bidirectional behavior only after one-way operation passes. Compare the incoming start/end pair with the current shared pair before writing. Do not write identical values back, and do not treat a programmatic range update as a fresh zoom request. This breaks the feedback cycle that otherwise causes repeated property changes or visible range oscillation.

When a session property carries the range, initialize or replace it deliberately as the destination view opens. Do not move on until a single zoom produces one stable shared pair and both charts stop changing after they reach that pair.

End-to-End Commissioning Check

  1. Load both charts and record their initial visible date ranges.
  2. Drag a narrow interval on Chart 1.
  3. Confirm that the selected or zoom-range source publishes two changed timestamps.
  4. Confirm that the shared start and end properties match those timestamps as date values.
  5. Confirm that Chart 2 remains in manual mode and displays the same boundaries.
  6. Repeat with a wider interval and a range near each end of the available data.
  7. If bidirectional control is required, zoom Chart 2 and confirm that Chart 1 follows once without oscillation.
  8. Move the cursor without zooming and confirm that hover movement does not alter the synchronized interval.

The final acceptance point is an exact start/end match on both visible date axes after repeated zooms, with no stale values, automatic-range override, or feedback loop.

FAQ

How do I get the zoomed start and end dates from an XYChart?

First test getZoomedStartDate() and getZoomedEndDate() against the actual component and confirm that both values change after a zoom. If they remain fixed or are unavailable, use the changing selected-range or xAxes.date.range properties exposed by that Perspective chart configuration.

How do I reference another Perspective chart without event.source?

Use the component context, such as self.getSibling("XYChart"), when the target is a sibling named XYChart. For a different hierarchy, pass the range through view or session custom properties.

How do I make a second XYChart follow the first chart?

Publish Chart 1's start and end as two shared date values, set Chart 2's date-range mode to manual, and bind its range boundaries under xAxes.date.range to those values.

How do I stop two synchronized charts from updating each other repeatedly?

Commission one-way synchronization first. For bidirectional control, compare the incoming range with the current range and suppress identical or programmatically generated writes.

How do I verify that chart timestamp synchronization works?

Zoom Chart 1 to narrow, wide, early, and late intervals; each time, compare the visible start and end timestamps on both charts. The test passes when both boundaries match and cursor-only movement does not change the range.

Back to blog