Skip to content

signaloid/Signaloid-UxData-Tools-Typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Signaloid Ux Data Tools TypeScript

This repository contains a set of tools for parsing and plotting Signaloid distributional data in TypeScript/JavaScript.

Installation

The package is publicly available through GitHub Packages.

Authenticate using your GitHub Access Token:

echo "Enter your GitHub Access Token with read:packages and repo scopes:" && read -s GITHUB_TOKEN && npm config set @signaloid:registry https://npm.pkg.github.com/ && npm config set //npm.pkg.github.com/:_authToken $GITHUB_TOKEN

You can now install the latest version of @signaloid/uxdata-tools package via npm:

npm install @signaloid/uxdata-tools

Parse Ux data

You can construct DistributionalValue objects by parsing Ux string or Ux bytes. You can find more details about the Signaloid Ux format here. Following is an example of parsing Ux strings and Ux bytes.

import { DistributionalValue } from '@signaloid/uxdata-tools';

...

/* Parse a Ux string */
const distValue = DistributionalValue.parse(ux_string);

/* Parse a Ux bytes buffer */
const distValue = DistributionalValue.parse(ux_bytes_buffer);

Plot DistributionalValue objects

You can use the PlotData class for plotting a distributional value as a histogram with variable bin width. We also provide the signaloidChartMount wrapper function to assist plotting, which you can find here, to easily plot a distributional value like in the following example:

import { DistributionalValue, PlotData, signaloidChartMount } from '@signaloid/uxdata-tools';

...

/* Create the element to mount the plot */
const chart = document.createElement("div");
chart.className = "signaloid-chart";
document.body.appendChild(chart);

/* Create distributional value object from string */
const distValue = DistributionalValue.parse(ux_string);
const plotData = new PlotData(distValue);

/* Mount the plot */
signaloidChartMount(chart, plot_data);

About

Tools for parsing and plotting Signaloid distributional data in TypeScript/JavaScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages