For the complete documentation index, see llms.txt. This page is also available as Markdown.

Line Chart

Visualize time series data in Ubidots with the Line Chart widget

The Line Chart widget includes several options to display and customize data visualizations in your application. Color, time span, and aggregation method are some of the options available in this widget.

For a basic overview of the widget, visit this article, which covers the basics of setting up a Line Chart widget.

This section covers only the advanced features of the Line Chart widget.

ECharts configuration

ECharts is a powerful open-source visualization library designed to create interactive and customizable charts. ECharts provides extensive customization options that let you tailor the appearance and behavior of charts to fit specific requirements. With it, you can add new layers of customization to your widgets, simplify monitoring, and better support your users' needs.

The Line Chart widget is built on top of the ECharts library. This gives users access to all features provided by the library through the ECharts configuration option in the APPEARANCE tab:

After you click the option, a large drawer opens from the left and shows the ECharts options JSON. It maps all fields available in the UI and also provides an editing environment where users can take full advantage of the Line and Bar series types.

All fields exposed through the UI are mapped bidirectionally. This means that if you make a change in the UI, it is reflected in the ECharts options JSON, and vice versa.

Valid placeholders

The following are valid placeholders that you can use at the device or variable level.

Device

Access via device.<placeholder>

Variable

Access via variable.<placeholder>

Examples

The examples below use the ECharts configuration option to produce the results shown. Without this advanced option, you cannot get the same visualization using only the fields available in the UI.

Area boundaries

This example creates colored areas in the widget that act as boundaries, making it easier to see whether the data is within expected ranges. Red indicates an alarm, while green and orange indicate safe and warning values, respectively.

This is the ECharts JSON for a single variable. You need to adjust the series[0].markArea.data values so the limits reflect your specific needs and data behavior:

JSON example

Color-Coded Line Chart

This example shows a line chart where the line color changes dynamically based on the value of the data points.

You can set the color ranges by modifying each of the pieces within the visualMap element in the following ECharts JSON:

Color-Coded Line Chart ECharts JSON

Color-Coded Area Line Chart

This example shows a line chart similar to the previous one. It maps the Y-axis value to a color and also colors the area under the chart:

Below is the configuration for this line chart. You can customize the colors and ranges for each of the pieces within the visualMap as needed:

Color-Coded Area Line Chart JSON

Animations

Initial load animation

Set the initial load animation by adding the following attributes to the series:

Initial Load Animation Line Chart JSON

Data update animation

Set the animation shown when the data series updates by setting the following attributes:

Data Update Line Chart JSON

Data point custom icon

Set the following attributes in the data series:

Data Point Custom Icon JSON

Last updated

Was this helpful?