Easy chart manual mode

I am trying to create my own real time easy chart using a spinner and a drop down, but I am having trouble figuring out the scripting. The function of the real time selection is exactly what I want but I need it off to the side rather than underneath.

Thank you.

You can bind the Start Date and End Date in the Easy Chart. Bind the Start Date to an expression using the dateArithmetic() function, passing in the values from your spinner and dropdown list. So the expression will look something like this:

dateArithmetic(now(),{Root Container.Spinner.intValue}*-1, {Root Container.Dropdown.selectedLabel})

And you can just bind the End Date to the expression function now().

If you want to implement the pause/play function, here is one possible solution:

  • create three custom properties: startDate, endDate, isPaused
  • create a script to trigger pause/play, and get current start date and end date

the script will look something like this:

event.source.parent.startDate = event.source.parent.getComponent('Easy Chart').startDate
event.source.parent.endDate = event.source.parent.getComponent('Easy Chart').endDate

if event.source.parent.isPaused == 0:
	event.source.parent.isPaused = 1
else:
	event.source.parent.isPaused = 0

also, you will need to change your expression binding for Start Date in the Easy Chart to:

if({Root Container.isPaused}, {Root Container.startDate}, dateArithmetic(now(),{Root Container.Spinner.intValue}*-1, {Root Container.Dropdown.selectedLabel}))
and End Date to

if({Root Container.isPaused}, {Root Container.endDate}, now())

That should be everything you need to implement real time chart mode in manual mode.

OK, I got that to work. Now when I toggle to historical mode with a multi state button I made, the time is still being controled off the start and end date. I can move the slider bar back and forth, but then it is moved back to whatever the start up date is set to. Is there a way to dissable that when I go into history?

You’re not going to be able to use the built in modes anymore. What you’re going to have to do is also simulate the historical mode in a similar way that you simulated the realtime mode. The easy chart is going to always stay in manual mode.

Basically you’ll want to do something like the following:
(in the following example I’m assuming multistate control value of 0 = historical mode and 1 = realtime)

1)add a daterange component to the window
2) the start data of your easy chart should be bound to something like the following expression:

if({Root Container.Multi-State Button.controlValue},dateArithmetic(now(),{Root Container.Spinner.intValue}*-1, {Root Container.Dropdown.selectedLabel}),{Root Container.Date Range.startDate})
  1. then binding on the end date of your chart will also have to be modified:
if({Root Container.Multi-State Button.controlValue},now(),{Root Container.Date Range.endDate})
  1. finally you need to bind the visible properties of the spinner, dropdown, and daterange components to an expression that looks at your multi-state indicator and tells the components whether or not they should be visible depending on the control value.

Hope this isn’t too confusing.