Combining Effects of GoJS Samples

Is there away of calling the effects of a GoJS sample into another one? For example let say that you want to give the nodes in the Swim Lanes sample the the Monitor Display effect without combining the source code of the desperate and unrelated samples.

In other words is there a way of linking in a tag or reference to the Swim Lanes sample source code to give the Monitor Display effect?

What is the “Monitor Display effect”?

Fundamentally, all appearance and behavior is implemented in source code, although the templates are more data-structured than regular JavaScript code. So you’re going to have to do some merging of source code, even if it is just a matter of setting some properties and/or copying some template structure.

Shop Floor Monitor:

“Monitor Display” is embolden name on page. There are 7 pictures frames of kittens.
The main feature are the color coded symbols at the inside corners of the frames to indicate various conditions.

Actual wording on page:

Monitor display

This continuously shows the state of a number of stations on an imaginary shop floor. Every two seconds it updates the display, showing some random problems via highlighting. You can add nodes and links by adding data to the model text below and then clicking "Load".

Well, I was asking which “effects” that you wanted to port from the Shop Floor Monitor sample to the SwimLanes sample.

If I were you, I would copy the node template and supporting converter functions from the Shop Floor Monitor sample into the SwimLanes sample, replacing the SwimLanes’s node template. Then I would merge the two data models, copying the status data properties into the SwimLanes’s data. Finally I would copy the randomProblems function and the loop that calls it.

Of course in your app you are going to have to replace randomProblems and that loop with getting the real data from whatever feed you have on your server. Presumably you’ll get that data asynchronously (so you won’t need a setTimeout loop), at which time you can call Model.updateTargetBindings, just as randomProblems does.

Is there a way that someone can review the code that I merged of both swim lanes and shop floor monitor. It is almost complete but has a few snags in it that need ironing out

I cannot review (or write) code for specific apps. But if you have a very specific question about how to do something, I can answer that.

Two Questions:

  1. I want to add different state colored symbols to nodes in the swim lanes GoJS sample code. What’s
    the best way to do that?

  2. What’s the best way to bind data from a Web Service like JSON?<span =“Apple-tab-span” style=“white-space:pre”>

  1. Add a property on your node data that is the color that you want, and on a Shape in your node template add a Binding of “fill” to your new property name. If you want a gradient, use a converter function.

    Read Many samples demonstrate this, too. Actually you have to search to find a sample that doesn’t do this.

    2) Learn about web services and AJAX and JSON. This is covered in many manners on lots of web sites and in lots of books. Once you have JavaScript objects in memory, you can assign Diagram.model.nodeDataArray or you can modify model data by calling Model.setDataProperty.

    This sample might help, if you ignore the layout:

How could I get a context menu to come up in nodes of the Swim Lanes Sample problem? I’m trying to follow GoJS’s on-line ContextMenu example.

Set contextMenu in your node template(s).

could you give me an example of how you would set the template context menu property/

Would it go somet<span =“Apple-tab-span” style=“white-space:pre”> hing like this:

$(go.Contextmenu, go.Panel.Right);