SetMode() Function for EasyChart

In a previous post “Binding Chart mode selection to buttons” 2/9/2007 Carl Gould mentioned a SetMode() function that would be added in a future release. Do you have a time frame for this?

Yes, that feature was implemented.

For the Classic Chart, the function is called setMode, but for the Easy Chart, the function is called setChartMode (setMode on the easy chart sets manual/historical/realtime mode).

You pass these functions an integer, defined as:
[li]0 = Zoom[/li]
[li]1 = Pan[/li]
[li]2 = Mark[/li]
[li]3 = X-Trace[/li][/ul]

Hope this helps,

**EDIT - this is wrong - see below!

I tried the following script:

chart = event.source.parent.getComponent("ctg_Chart") chart.SetChartMode(3)
but this is the error I get.

[quote]Traceback (innermost last):
File “”, line 2, in ?
AttributeError: ‘None’ object has no attribute ‘SetChartMode’[/quote]
What is the correct way of doing this?

You have 2 problems. I’ll show you how to interpret that error message:

See how the error message says for line 2, ‘None’ object has no attribute ‘SetChartMode’?

This means that for the line “chart.SetChartMode”, the “chart” part of it is evaluating to ‘None’. This means that your call to event.source.parent.getComponent(“ctg_Chart”) is returning ‘None’ (aka null).

To fix that, you need to make sure that your chart is actually called “ctg_Chart” and that it is on the same container as the component that this event is running under.

If you were to fix that problem, you’d see another error, that looked similar. This is because you capitalized the “s” in “setChartMode”. Don’t do that. I like to tell people to always assume that everything is case sensitive - this way you’re always right!

Hope this helps,

I had the option button located in a separate container. They are now on the same one. The case issue has been changed also.

chart = event.source.parent.getComponent chart.setChartMode(3)

I have this code in each of the buttons with only the passed value changing. However, when I run it it is changing from Historical to Manual to Realtime.

I then modified the code to read setMode(x) and it works (sort of).
This is what I found.

setMode(0) = zoom
setMode(1) = pan
setMode(2) = No Change
setMode(3) = mark
setMode(4) = x-trace

Does this make any sense?

Thank you for all of your help!! Your support is much better than with GE Cimplicity!

Yeah, I’m sorry, must have had my wires crossed. It is setMode for both the Classic and Easy Chart, and the constants are defined as follows:


Must’ve not had my coffee when I answered that post! Thanks for clearing that up.