Sync chart timestamps

Can you please provide an example for this?

Instead of bumping a 15 year old thread, which is literally an example...

Can you provide more information about what you're trying to do or what is going wrong with the code snippet already provided?

Hi Paul, thanks for the quick response :slight_smile:
On mouse clicking over a chart and selecting a range event in an XYChart, the chart automatically updates its x coordinate selected date range, zooms to the selected date range.
I want to grab this selected date range and sync another chart with the same date range

Well the first half of that is what you've already copied and pasted - getZoomedStartDate() and getZoomedEndDate() are functions available on the chart component instance.

Then in your other chart you want to 'follow' that range, set the mode of the chart to 'manual' and send the two date parameters you're getting from chart A into chart B.

I guess, I am missing something.
Here is simple script that I am failing to adapt:
chart = self.getSibling("XYChart")
return "{} - {}".format(
str(chart.getZoomedStartDate()),
str(chart.getZoomedEndDate())
)

If you have an XY Chart, then you're in Perspective, not Vision, a different visualization module that didn't exist 15 years ago.

The XY Chart appears to be configured via the xAxes.date.range properties:

Which you could just link via property bindings between two charts?

I tried that. However, chart is not updating its selected date ranges when zooming. They remain the same

Then you'll have to wait for someone else to offer advice, my knowledge of Perspective taps out early, unfortunately.

1 Like

Are the charts on the same page? In the same view?
There are a couple ways to solve this, you could pass the ranges into the other chart with custom props, bind the ranges bi-bidirectionally, set up session custom props and handle the back and forth of the props that way.

I have two charts in the same page. Chart1 is using the XYChart with its default sample data. On chart1, I enabled cursor and selected ‘process temp‘ as the series. And, when I click on chart1 and select a date range, chart1 zooms into the date range I just selected.

Now, I want to copy this current date range from this chart to chart2. however, I cannot see selected range on a chart property.

Similarly, when hovering over, the cursor shows the current date. But I cannot get that date from any property.

You might need to parse out the date from a selected data point under the props. Have you looked at the Timeseries chart or Embr charts? Both may provide an easier solution to this.

Actually, this selected data range can help
Let me work on this more,
Thanks :slight_smile: