24h - 3 shifts Chart

Hi, how do I make a real-time 24 hour chart, that is divided by three using two historical tags. The first division starts at 5:00 AM and ends at 12:59pm, the second: 1:00pm to 8:59pm, and the third: 9:00pm to 4:59am of the next day. And it moves when it's 5:00Am of the next day.

For context, I have two historical tags that contain the current efficiency of two production lines. I want to be able to see the efficiency of the entire day as it's occurring. I don't want to have to type the 24 hour range I want to see every time.

This is what I got, but is not divided by 3, and it doesnt update every day:

Thanks in advanced,
Dan

The start and end times of the chart could be bound to an expression that calculates the desired start and end times. If the expression uses a custom property that calculates the current date minus 5 hours, the chart should automatically change the start / end times at 5 AM each day.

With the Chart object (not Easy Chart) a sub plot could provide thin bars at the shift change times.

Start and end times of a classic chart (Domain axis) are not bindable--not even exposed. You must replace the axis in configureChart with a jython subclass that will dynamically return your desired lower and upper bounds.

Extra note: the Classic chart does not run configureChart for every redraw like the EasyChart. You cannot just compute and assign upper and lower bound in configureChart if the chart will be continuously displayed long enough to need to shift over. This phenomenon also impacts any dynamically computed range axis bounds.

1 Like

I stand corrected.... How about binding the data source (query or historian) start and end times to a similar expression? I do not understand the need to replace the axis with a jython subclass.

If the domain axis is auto-scaling, it will conform to the data available. The OP's request is for a chart that covers a time period that doesn't have data yet. To achieve the OP's intent, the domain axis bounds must be calculated and set.

If the shift dataset contains 4 items, 5:00 AM, 1:00 PM, 9:00 PM, and 5:00 AM the next day, then the chart will autoscale to 24 hours, even at the start of the first shift.

Programmatically creating a chart dataset that just contains the shift boundaries and dummy data? I guess that would work. You'd need to futz with the rendering of the dummy data.

OP asked for a chart that is "divided by 3" I might have misunderstood, but I took that to mean that it was desired to show the the shift boundaries on the chart. The first dataset would contain historian data, which can have dynamic binding on the start and end times. It would be rendered as an XY Line/Shape plot. The second dataset would have 4 data points, all with real data, and rendered as XY Bar. No need to create any dummy data and no futzing with jython subclasses.

Which you would have to "futz with" to make suitably narrow.

Or, for a professional appearance, you can use my approach for the domain axis, and use actual Markers to provide the vertical dividers.

1 Like