Hi all,

Peter Hunter has proposed that it be possible to create SVG diagrams 
which interact with PCEnv so that you can click on parts of the SVG 
diagram and have PCEnv update the styles of traces being displayed on a 

For example, someone might click on a sodium channel in the SVG diagram, 
and have a trace showing sodium concentrations come up on their graph.

There are several possible ways to implement this, and I am looking for 
feedback from potential users on which way they would find the most useful:

1) Create a generic language which describes the relationship between 
elements in an SVG diagram and trace resources in the graph metadata. 
This relationship could describe what happens when the SVG diagram is 
clicked. This would probably be the most useful for tools other than 
PCEnv to process, although it is not clear whether this would actually 
be useful to such tools.

2) Provide an API which Javascript in SVG diagrams  can use to 
manipulate PCEnv traces, perhaps by giving the resource URI.

If we choose to use this Javascript API, there are several choices as to 
how we could construct the API:
a) Provide an API which allows trace properties to be directly changed, e.g.
      var tc = new TraceController();
      tc.setTraceStyle(graphURI, traceURI, "invisible");
      tc.setTraceColour(graphURI, traceURI, "#ff00ff");

The problem with this approach is that Javascript code will often want 
to highlight variables, but if this is done through hiding traces and/or 
changing colours, code would have to keep track of what changes are 
made, and store enough information to be able to reverse the changes.

b) Use the above API style, but provide additional API functions to save 
all trace styles / colours on a graph and restore them again, by name. 
The only problem here is that the use might have changed something, and 
then their change will get reverted.
c) Make some sort of transactional system, where temporary changes can 
be made in transactions, and the transaction can be rolled back. The 
user will see changes, but if they modify the same variable, their 
change will be committed so will not be rolled back.

The problem with option c is that it is very complex both to implement 
and to learn how to use, which means it might end up never being used 

d) Create a highly specialised API allowing the 'highlighted variable' 
to be set, such that only one highlighted variable can be set at a time. 
If the user changes the variable, it gets unhighlighted automatically. 
This is more similar to option 1.

Option 1 and 2d would probably the simplest to use, with there being a 
realistic possibility that option 1 could one day be edited in something 
other than a text editor. However, they do not give the same flexibility 
as the other options would.

I welcome any opinions on what approach would be best.

Best regards,
Andrew Miller

cellml-discussion mailing list

Reply via email to