webvis settings¶
This tutorial will give an overview of the configuration settings available in webvis. A configuration in webvis is a collection of settings each consisting of a key-value pair and an optional attributes object describing type and possible values for a better UI representation.
The following list gives a few examples of the possible settings:
SettingString |
Value |
Description |
---|---|---|
language |
[“en”, “de”, “fr”, …] |
Language of the UI strings |
coordSys |
[“-yz”, “xy”, …] |
Defines the front plane of the model for the UI elements. |
selectionColor |
[“FFFF00”, “55FF44”, …] |
Color of selected parts in the 3D view. |
Changing webvis settings¶
There are three different ways to configure webvis’ setting according to your needs:
Using the Configuration Tag¶
You can make configurations directly by placing them inside the <webvis-config> HTML-tag and defining the settings as key-value pairs in JSON string notation:
<webvis-config>
{
"coordSys" : "-yz",
"language" : "de"
}
</webvis-config>
WebVis will also look for a config file called “config.json” in the folder of the webvis.js file.
Using the API¶
By placing the following lines in a script tag in the body of the HTML document you can change the settings using the webvis API:
webvis.changeSetting("coordSys", "-yz");
webvis.changeSetting("language", "de");
You can edit the configuration using the changeSetting function. Optionally, a third parameter with an attributes object can be used to provide additional data.
Importing and Exporting a Configuration¶
You can import a configuration using the function importConfig taking a key-value-based configuration object as a parameter.
var config =
{
coordSys : "-yz",
language : "de"
};
webvis.importConfig(config);
In a similar way you can export the configuration as an object by calling:
var config = webvis.exportConfig();