Indeed, multiple Diagrams on one page can be problematic; the script wasn't really designed for that. Especially if a Diagram needs to be interfaced with some external element, such as custom JavaScript embedded in the page, piece lists or tables embedded in the text, or buttons to change Diagram parameters, there can easily be confusion about which Diagram these belong to. What makes it worse is that each Diagram usually cames with its own link to a betza.js script, and if they use different versions it will be the last link on the page that will prevail. Which could be an obsolete version not implementing what an earlier Diagram relies on.
To make life easier I now made all the betza.js scripts save the Diagram numbers in the global array sats[], which can be indexed by the satellite value of the sought Diagram. Buttons could use that info to make sure they will always act on the right Diagram; they should call TwitchDiag(sats['satelliteValue']) before they start changing any parameters.
Indeed, multiple Diagrams on one page can be problematic; the script wasn't really designed for that. Especially if a Diagram needs to be interfaced with some external element, such as custom JavaScript embedded in the page, piece lists or tables embedded in the text, or buttons to change Diagram parameters, there can easily be confusion about which Diagram these belong to. What makes it worse is that each Diagram usually cames with its own link to a betza.js script, and if they use different versions it will be the last link on the page that will prevail. Which could be an obsolete version not implementing what an earlier Diagram relies on.
To make life easier I now made all the betza.js scripts save the Diagram numbers in the global array sats[], which can be indexed by the satellite value of the sought Diagram. Buttons could use that info to make sure they will always act on the right Diagram; they should call TwitchDiag(sats['satelliteValue']) before they start changing any parameters.