From 146ba57d28717d29fded4164e2b0600e3a1f9c6c Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 20 May 2015 10:34:52 +0200 Subject: [PATCH] Documented `configure` for Timeline and Graph2d. Some minor fixes in the options. --- docs/graph2d/index.html | 14 ++++++++++++++ docs/network/configure.html | 5 ++--- docs/timeline/index.html | 11 +++++++++-- lib/timeline/optionsGraph2d.js | 10 +++++----- lib/timeline/optionsTimeline.js | 4 ++-- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/docs/graph2d/index.html b/docs/graph2d/index.html index 6e537445..84ecdb09 100644 --- a/docs/graph2d/index.html +++ b/docs/graph2d/index.html @@ -731,6 +731,20 @@ function (value) { If true, the Timeline will automatically detect when its container is resized, and redraw itself accordingly. If false, the Timeline can be forced to repaint after its container has been resized using the function redraw(). + + configure + boolean or function + false + When true, a configurator is loaded where all configuration options of the Graph2d can be changed live. + + The displayed options can be filtered by providing a filter function. This function is invoked with two arguments: the current option and the path (an Array) of the option within the options object. The option will be displayed when the filter function returns true. For example to only display format options: +
+function (option, path) {
+  return option === 'format' || path.indexOf('format') !== -1;
+}
+ + + clickToUse Boolean diff --git a/docs/network/configure.html b/docs/network/configure.html index 767d610e..0d51580f 100644 --- a/docs/network/configure.html +++ b/docs/network/configure.html @@ -141,11 +141,10 @@ network.setOptions(options); selection, renderer. Feel free to come up with a fun seperating character. Finally, when supplied an array of strings, any of the previously mentioned fields are accepted.

When supplying a function, you receive two arguments. The option and the path of the option within the options object. If it returns true, the options will be shown in the configurator. Example: -
+                
 function (option, path) {
   return path.indexOf('physics') !== -1;
-}
-                
+}
This only shows the physics options. diff --git a/docs/timeline/index.html b/docs/timeline/index.html index 2ff424e5..362ec432 100644 --- a/docs/timeline/index.html +++ b/docs/timeline/index.html @@ -479,9 +479,16 @@ var options = { configure - boolean + boolean or function false - When true, a configurator is loaded where all configuration options of the Timeline can be changed live. + When true, a configurator is loaded where all configuration options of the Timeline can be changed live. + + The displayed options can be filtered by providing a filter function. This function is invoked with two arguments: the current option and the path (an Array) of the option within the options object. The option will be displayed when the filter function returns true. For example to only display format options: +
+function (option, path) {
+  return option === 'format' || path.indexOf('format') !== -1;
+}
+ diff --git a/lib/timeline/optionsGraph2d.js b/lib/timeline/optionsGraph2d.js index 96ab11eb..5ff1eb42 100644 --- a/lib/timeline/optionsGraph2d.js +++ b/lib/timeline/optionsGraph2d.js @@ -22,9 +22,9 @@ let any = 'any'; let allOptions = { configure: { enabled: {boolean}, - filter: {boolean,string,array}, + filter: {boolean,fn}, container: {dom}, - __type__: {object,boolean,string,array} + __type__: {object,boolean,fn} }, //globals : @@ -155,7 +155,7 @@ let allOptions = { zoomMax: {number}, zoomMin: {number}, __type__: {object} -} +}; let configureOptions = { global: { @@ -180,7 +180,7 @@ let configureOptions = { drawPoints: { enabled: true, size: [6,2,30,1], - style: 'square' // square, circle + style: ['square', 'circle'] // square, circle }, dataAxis: { showMinorLabels: true, @@ -245,7 +245,7 @@ let configureOptions = { maxHeight: '', min: '', minHeight: '', - movable:true, + moveable:true, orientation: ['both', 'bottom', 'top'], showCurrentTime: false, showMajorLabels: true, diff --git a/lib/timeline/optionsTimeline.js b/lib/timeline/optionsTimeline.js index c2d19d02..413403e0 100644 --- a/lib/timeline/optionsTimeline.js +++ b/lib/timeline/optionsTimeline.js @@ -22,9 +22,9 @@ let any = 'any'; let allOptions = { configure: { enabled: {boolean}, - filter: {boolean,string,array}, + filter: {boolean,fn}, container: {dom}, - __type__: {object,boolean,string,array} + __type__: {object,boolean,fn} }, //globals :