githubEdit

Charts

Charting components for Universal Apps.

Universal Apps provides several built-in charting solutions to help visualize your data retrieved from PowerShell.

ChartJS

Universal Apps integrates with ChartJSarrow-up-right.

Creating a Chart

To create a chart, use New-UDChartJS and New-UDChartJSData. The below chart shows the top ten CPU using processes.

Image

Types

Bar

Image

Stacked Bar

Image

Horizontal Bar

Image

Bubble

Image

A bubble chart consists of x and y coordinates and an r value for the radius of the circles.

Line

Image

Doughnut

Image

Pie

Image

Radar

Image

Colors

Colors can be defined using the various color parameters of New-UDChartJS.

Image

Data Sets

By default, you do not need to define data sets manually. A single data set is created automatically when you use the -DataProperty and -LabelProperty parameters. If you want to define multiple data sets for a single chart, you can use the -Dataset property in conjunction with New-UDChartJSDataset.

Image

Click Events

You can take action when a user clicks the chart. This example shows a toast with the contents of the $Body variable. The $Body variable contains a JSON string with information about the elements that were clicked.

Image

Auto refreshing charts

You can use New-UDDynamic to create charts that refresh on an interval.

Image

Monitors

Monitors are a special kind of chart that tracks data over time. Monitors are good for displaying data such as server performance stats that change frequently. You return a single value from a monitor and it is graphed automatically over time.

Image

Options

The New-UDChartJS cmdlet supports accepting advanced ChartJS options. You can use the -Options parameter to pass in a hashtable.

This example hides the legend.

Title

You can include a title with the title option.

Nivo Charts

Universal Dashboard integrates with Nivo Chartsarrow-up-right. Below you will find examples and documentation for using these charts.

Creating a Chart

All the Nivo charts can be created with New-UDNivoChart. You will specify a switch parameter for the different types of charts. Each chart type will take a well defined data format via the -Data parameter.

Image

Patterns

Nivo provides the ability to specify patterns to display over data sets. You can configure these patterns with New-UDNivoPattern and New-UDNivoFill .

Image

Responsive Widths

Nivo charts provide responsive widths so they will resize automatically when placed on a page or the browser is resized. A height is required when using responsive widths.

Image

Auto Refreshing Charts

Like many components in Universal Dashboard v3, Nivo charts do not define auto-refresh properties themselves. Instead, you can take advantage of New-UDDynamic to refresh the chart on an interval.

Image

OnClick

Nivo charts support OnClick event handlers. You will be provided with information about the data set that was clicked as JSON.

Image

Types of Charts

Bar

Bubble

Image

Calendar

Image

Heatmap

Image

Line

Image

Network

Image
Network Chart

Assuming the below JSON data, you can use the following app code.

Stream

Image

Treemap

Image

Color Based on Data

You can use the following format to use colors based on your data.

Image
Color based on data

Last updated

Was this helpful?