|
| 1 | +--- |
| 2 | +title: "Chart Playground" |
| 3 | +url: /appstore/widgets/chart-playground/ |
| 4 | +weight: 180 |
| 5 | +description: "Describes the Chart playground widget, which lets you edit the layout, configuration, and series settings of a chart live while the app runs." |
| 6 | +aliases: |
| 7 | + - /appstore/widgets/ChartPlayground/ |
| 8 | +--- |
| 9 | + |
| 10 | +## Introduction |
| 11 | + |
| 12 | +The Chart playground widget is a helper for customizing charts. It adds a live JSON editor to a chart in the running app, so you can see the effect of layout, configuration, and series settings right away. When you are happy with the result, you copy the JSON to the chart properties in Studio Pro. |
| 13 | + |
| 14 | +The Chart playground widget is included in the [Charts](/appstore/widgets/charts/) module. It works with all chart widgets in the module, including [Custom chart](/appstore/widgets/charts-custom-usage/). |
| 15 | + |
| 16 | +{{% alert color="warning" %}} |
| 17 | +Changes made in the Chart playground are for preview only. They are lost when you reload the page. To keep your changes, copy the JSON to the chart properties in Studio Pro. |
| 18 | +{{% /alert %}} |
| 19 | + |
| 20 | +{{% alert color="info" %}} |
| 21 | +In Charts versions below 5.0.0, the live editor was enabled with the **Enable developer mode** property instead of a separate Chart playground widget. |
| 22 | +{{% /alert %}} |
| 23 | + |
| 24 | +## Adding Chart Playground to a Chart {#add} |
| 25 | + |
| 26 | +To add a Chart playground to a chart, do the following: |
| 27 | + |
| 28 | +1. Open the page with the chart in Studio Pro. |
| 29 | +1. Open the chart properties and go to the **General** tab. |
| 30 | +1. Set **Show playground slot** to **Yes**. A **Playground slot** drop zone appears on the chart. |
| 31 | +1. In the **Toolbox**, find the **Chart playground** widget. |
| 32 | +1. Drag the **Chart playground** widget into the **Playground slot**. |
| 33 | + |
| 34 | + {{< figure src="/attachments/appstore/platform-supported-content/widgets/charts/chart-playground-add.png" alt="Chart in the page editor with a Chart playground widget in its Playground slot, and the Chart playground widget in the Toolbox" class="no-border" >}} |
| 35 | + |
| 36 | +1. Run the app and open the page with the chart. |
| 37 | + |
| 38 | +{{% alert color="info" %}} |
| 39 | +The Chart playground widget has no properties of its own. It gets all its data from the chart it is placed in. If you place it anywhere other than a **Playground slot**, it shows an error. |
| 40 | +{{% /alert %}} |
| 41 | + |
| 42 | +## Using the Editor {#editor} |
| 43 | + |
| 44 | +In the running app, click **Toggle Editor** on the chart to open the editor panel. |
| 45 | + |
| 46 | +{{< figure src="/attachments/appstore/platform-supported-content/widgets/charts/chart-playground-editor.png" alt="Chart playground editor panel next to a line chart, with Layout selected in the drop-down list, an empty Custom settings editor, and the Settings from the Studio Pro view" class="no-border" >}} |
| 47 | + |
| 48 | +The editor panel has these parts: |
| 49 | + |
| 50 | +* **Drop-down list** – Selects which settings to edit: |
| 51 | + * **Layout** – The layout of the whole chart, such as fonts, titles, axes, and legend. For available options, see [Layout](https://plotly.com/javascript/reference/layout/) in the Plotly documentation. |
| 52 | + * One item per series – The settings of a single series (a trace in Plotly). The item shows the series name, or **trace** with a number if the series has no name. For available options, see the [JavaScript Figure Reference](https://plotly.com/javascript/reference/) in the Plotly documentation. |
| 53 | + * **Configuration** – The configuration of the chart, such as the mode bar and zoom behavior. For available options, see [Configuration Options](https://plotly.com/javascript/configuration-options/) in the Plotly documentation. |
| 54 | +* **Custom settings** – An editable JSON editor. Your changes are applied to the chart immediately. If the JSON is invalid, the editor shows it and the chart is not updated. |
| 55 | +* **Settings from the Studio Pro** – A read-only view of the settings that come from the chart properties in Studio Pro. |
| 56 | + |
| 57 | +To move the keyboard focus out of the editor, press <kbd>Esc</kbd> and then <kbd>Tab</kbd>. |
| 58 | + |
| 59 | +## Saving Your Changes {#save} |
| 60 | + |
| 61 | +The playground does not save anything. Copy the JSON from **Custom settings** to the matching chart property in Studio Pro: |
| 62 | + |
| 63 | +| Playground Item | Chart Widgets | Custom Chart | |
| 64 | +| --- | --- | --- | |
| 65 | +| **Layout** | **Advanced** tab > **Custom layout** | **Layout options** tab > **Static** | |
| 66 | +| A series | **Edit Series Item** dialog box > **Advanced** tab > **Custom series options** (for pie charts and heat maps: **Advanced** tab > **Custom series options**) | **Data** tab > **Static** (the item at the same position in the array) | |
| 67 | +| **Configuration** | **Advanced** tab > **Custom configurations** | **Configuration options** tab > **Configuration options** | |
| 68 | + |
| 69 | +## Removing Chart Playground {#remove} |
| 70 | + |
| 71 | +Chart playground is a development tool. Before you deploy your app to production, remove it from your charts: |
| 72 | + |
| 73 | +1. Delete the **Chart playground** widget from the **Playground slot**. |
| 74 | +1. Set **Show playground slot** to **No**. |
| 75 | + |
| 76 | +If **Show playground slot** is set to **No** while a widget is still in the slot, Studio Pro shows an error asking you to remove the widget from the slot. |
| 77 | + |
| 78 | +## Read More |
| 79 | + |
| 80 | +* [Fine-Tune a Chart with Chart Playground](/appstore/widgets/chart-advanced-tuning/) |
| 81 | +* [Chart Advanced Cheat Sheet](/refguide/charts-advanced-cheat-sheet/) |
| 82 | +* [Charts](/appstore/widgets/charts/) |
0 commit comments