# 24h - 3 shifts Chart

**URL:** <https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461>\
**Category:** Ignition\
**Tags:** ignition79, vision\
**Created:** [December 10, 2022, 5:24am UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461 "2022-12-10T05:24:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Mor](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Dan\_Mor](https://forum.inductiveautomation.com/u/Dan_Mor)\
**Post date:** [December 10, 2022, 5:24am UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/1 "2022-12-10T05:24:20Z")

</div>

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:

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

Thanks in advanced,  
Dan

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [December 10, 2022, 11:32am UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/2 "2022-12-10T11:32:06Z")

</div>

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.

---

<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:** [December 10, 2022, 3:38pm UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/3 "2022-12-10T15:38:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [December 10, 2022, 4:03pm UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/4 "2022-12-10T16:03:42Z")

</div>

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.

---

<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:** [December 10, 2022, 4:15pm UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/5 "2022-12-10T16:15:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [December 10, 2022, 4:19pm UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/6 "2022-12-10T16:19:36Z")

</div>

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.

---

<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:** [December 10, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/7 "2022-12-10T16:33:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mcgheeiv](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@mcgheeiv](https://forum.inductiveautomation.com/u/mcgheeiv)\
**Post date:** [December 10, 2022, 4:41pm UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/8 "2022-12-10T16:41:59Z")

</div>

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.

---

<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:** [December 10, 2022, 5:01pm UTC](https://forum.inductiveautomation.com/t/24h-3-shifts-chart/67461/9 "2022-12-10T17:01:19Z")

</div>

> [@mcgheeiv](#):
>
> 4 data points, all with real data, and rendered as XY Bar

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.
