You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/11/04 13:13:40 UTC
[incubator-echarts-examples] 02/02: enhance dat.GUI in examples.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-examples.git
commit 301953c01ed3bd7eefa0f87531873edaa0a60023
Author: 100pah <su...@gmail.com>
AuthorDate: Wed Nov 4 21:13:18 2020 +0800
enhance dat.GUI in examples.
---
README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
src/editor/sandbox.js | 2 +-
2 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index bd143c2..e24213b 100644
--- a/README.md
+++ b/README.md
@@ -50,4 +50,52 @@ category: 'line, visualMap'
*/
```
-describes the meta info of this example.
\ No newline at end of file
+describes the meta info of this example.
+
+
+## Some built-in features available in examples
+
+### Controller panel
+
+Use this code to enable controller panel for a example:
+```js
+app.config = {
+ aNameForTheSelectWidget: 'This is the initial value'
+ aNameForTheRangeWidget: 45,
+ aNameForTheButtonWidget: function () {
+ // Do something.
+ },
+ onChange: function () {
+ // Do something.
+ }
+};
+app.configParameters = {
+ aNameForTheSelectWidget: {
+ options: [
+ 'This is the initial value',
+ 'This is another value',
+ 'This is the third value'
+ ]
+ },
+ aNameForTheRangeWidget: {
+ min: -90,
+ max: 90
+ }
+};
+```
+
+### Resize
+
+```js
+app.onresize = function () {
+ // Do something.
+}
+```
+
+### Get width and height of the chart area
+
+```js
+var width = myChart.getWidth();
+var height = myChart.getHeight();
+```
+
diff --git a/src/editor/sandbox.js b/src/editor/sandbox.js
index 211c4a3..cfeafe8 100644
--- a/src/editor/sandbox.js
+++ b/src/editor/sandbox.js
@@ -152,7 +152,7 @@ export function createSandbox(optionUpdated) {
if (name !== 'onChange' && name !== 'onFinishChange') {
var isColor = false;
// var value = obj;
- var controller;
+ var controller = null;
if (configParameters[name]) {
if (configParameters[name].options) {
controller = gui.add(appEnv.config, name, configParameters[name].options);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org