# Getting started

## Widget plugin

Let's create a widget that uses HighCharts javascript library to plot time series data. It will look like:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2F0vgkt6PcmyGZxljlSSiG%2FWidgetDisplay.png?alt=media&#x26;token=6497dccb-9f65-43d4-bd5d-a8bab25d3807" alt=""><figcaption></figcaption></figure>

Download the zip file containing the source code for this widget from [here](https://res.cloudinary.com/di2vaxvhl/raw/upload/v1694454062/Plugin%20Assets/Widget%20plugin/CustomHighCharts.zip). Then, head to Ubidots => Devices => Plugins. Once there, click on the Developer console icon:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FxlBICkXjVJfjketwfg3S%2Fimage.png?alt=media&#x26;token=c617aee5-7d5d-4b9f-bd0a-847ffce4de72" alt=""><figcaption></figcaption></figure>

Click the + icon to create a new plugin, set a name for it and a description, then hit the done button. After that your new plugin will be created:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FpAKBiC7Rf1qYlA1nIzJw%2F1.gif?alt=media&#x26;token=6b0ad2a8-ed72-4fea-81be-79b6d1395cc9" alt=""><figcaption></figcaption></figure>

Click the newly created plugin's name. While in the *General information* tab, click on *Add Plugin Icon* to add the icon that will be displayed on the plugins drawer and then hit the *Save* button within the *Display information* section. You can download the icon from [here](https://res.cloudinary.com/di2vaxvhl/image/upload/v1693863919/Plugin%20Assets/Widget%20plugin/highChartsLogo.png).

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FmYZD7LIo4K0gjLrFCGde%2Fimage.png?alt=media&#x26;token=44bd4c16-9f6a-4318-ae62-05358b8902ce" alt=""><figcaption></figcaption></figure>

Scroll down to the *Plugin description* section and there paste the following readme and hit the *save* button within that section.

```
# Ubidots Highcharts Widget
Visualize your Ubidots variable data using the Highcharts graphing library with this widget. Easily configure titles, axis names, and more!
![](https://res.cloudinary.com/di2vaxvhl/image/upload/v1693865751/Plugin%20Assets/Widget%20plugin/WidgetDisplay.png)

## Features

- Seamless integration with Ubidots.
- Real-time fetching of variable data based on the provided label.
- Customizable graph elements like title, subtitle, x-axis & y-axis names, and the series name.

## Table of Contents

- [Ubidots Highcharts Widget](#ubidots-highcharts-widget)
  - [Features](#features)
  - [Table of Contents](#table-of-contents)
  - [Prerequisites](#prerequisites)
  - [Setup and Installation](#setup-and-installation)
  - [Widget's inputs](#widgets-inputs)
  - [License](#license)

## Prerequisites
- An active Ubidots account with Enterprise license.

## Setup and Installation
1. Log in to your Ubidots account.
2. Navigate to the **Dashboards** section and select the one in which you want to place the widget.
3. Click on **Add Widget** and select **HighCharts widget**.

## Widget's inputs 

After adding the widget to your dashboard:

1. Configure the widget settings:
   - **Chart's title**: Define the main title of the graph.
   - **Chart's Subtitle**: Provide a subtitle, if needed.
   - **X Axis Name**: Specify the label for the x-axis.
   - **Y Axis Name**: Specify the label for the y-axis.
   - **Variable Label**: Click on the "ADD VARIABLE" button and follow the variable selection wizard.
     - **Series Name**: Define the label that will be displayed within the graph line.

2. Save the changes and the graph will automatically fetch the data and display it.

## License
This project is licensed under the MIT License. See the `LICENSE` file for more details.
```

Navigate to the *Version* tab in the sidebar menu. Click the "+" icon and upload the zip file. The plugin is now in your Ubidots account, but it still needs to be deployed.

While in the *Versions* tab, scroll down to the *Version history* section and click on the icon that resembles a paper-clip airplane:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FlfC5Ov5bE74TfmOVTz2D%2Fimage.png?alt=media&#x26;token=5857fe38-569c-464e-b87e-3a0046211180" alt=""><figcaption></figcaption></figure>

A confirmation will be displayed, click the *Release* button:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FszrbNQ7gpvVjc1AnVc8s%2Fimage.png?alt=media&#x26;token=6c4d0b49-a115-4b81-9cdf-6eab2fd69daa" alt=""><figcaption></figcaption></figure>

After that, your plugin's status will change from *Draft* to *Released:*

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2Fy2qnKSse7ZpUK6iUOwPd%2Fimage.png?alt=media&#x26;token=aad09a16-dfa2-45c0-9dd6-292b565dcadd" alt=""><figcaption></figcaption></figure>

Go to *Devices* -> *Plugins* and click the *create new plugin* button. Then, in the plugins drawer, search for the plugin that you just created (HighCharts custom widget), fill in the required *Ubidots token* field and click the *Done* button. After that, you'll be able to see a new plugin has just been created:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FvJ4dIIkYW2Dp9mZlghly%2FjuanDavid3.gif?alt=media&#x26;token=b9901cbd-cb4d-46fb-82d0-b0f4e70a8af7" alt=""><figcaption></figcaption></figure>

Go to the dashboard that you want to place the widget in and click the *Add new widget button.* A drawer will be pop-up displaying all the widget, within it search the Widget that you just created and click on it. An instance of said plugin will be placed on the dashboard:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FLaG1xAFQ1AgQnYchPfzT%2FjuanDavid4.gif?alt=media&#x26;token=61652eb7-dbee-49b8-b565-6dbabc268fc5" alt=""><figcaption></figcaption></figure>

Fill the Widget's fields according to the variable that you want the data visualized in the widget. The following screenshot shows an example:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FEmRErxQOWWTnTmxRDoVU%2Fimage.png?alt=media&#x26;token=3cfcd79d-6322-4c0e-b9b7-7db17e5d3081" alt=""><figcaption></figcaption></figure>

Finally, the widget will be created on the dashboard. This is how the widget looks like in the dashboard:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2F7bpe6DiyPLIBlq208ER4%2Fimage.png?alt=media&#x26;token=086ef605-dc04-4d3b-8034-1d79d407db05" alt=""><figcaption></figcaption></figure>
