Basics

Example #1

This example creates a text box to set a variable's value.

HTML:

<div class="notification--container" id="notification">
  <p>Value sent successfully</p>
</div>

<div class="send-value--container">
  <input type="number" step="0.0001" placeholder="Enter number" class="send-value--input" id="value" />
  <button type="button" class="send-value--button" id="send-value">Send value</button>
</div>

CSS:

.send-value--container {
  	left: 50%;
	position: absolute;
  	top: 50%;
  	transform: translate(-50%, -50%);
}

.send-value--input {
	border: none;
  	border-bottom: 2px solid #28AECD;
  	display: block;
  	margin: 0 auto;
  	font-size: 14px;
  	outline: none;
}

.send-value--button {
  	background: #FFFFFF;
  	border: 2px solid #28AECD;
  	border-radius: 20px;
  	color: #28AECD;
  	font-size: 14px;
	margin-top: 10px;
	width: 100%;
}

.send-value--button:hover {
 	background: #28AECD;
  	cursor: pointer;
  	color: #FFFFFF;
}

.notification--container {
 	display: none;
}

JavaScript:

In the following code, the variable VARIABLE_ID must be set accordingly.

Example #2:

The next example shows how to get data from Ubidots and display it in a Highcharts chart:

HTML:

JavaScript:

In the following code, the variable VARIABLE_ID must be set accordingly.

Third party libraries:

Example #3:

This example is exactly the same as the one before, but it uses Plotly as a charting library instead of Highcharts:

HTML:

JavaScript:

Third party libraries:

Example #4:

This example uses the HTML Canvas widget to turn on/off a dashboard's "real time":

HTML:

CSS:

JavaScript:

Last updated

Was this helpful?