npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rotateknik/plot

v2.8.1

Published

This is a plotting module that uses Plotly.js and is made for quickly creating plots in various Rota Teknik projects. Currently uses Angular 12.

Downloads

5,316

Readme

RT-Plot

This is a plotting module that uses Plotly.js and is made for quickly creating plots in various Rota Teknik projects. Currently uses Angular 12.

Table of contents

Using in projects

The module needs to be added to the Angular module that will be used in.

import { PlotModule } from '@rotateknik/plot';

@NgModule({
  // ...
  imports: [
    // ...
    PlotModule
    // ...
  ],
})
// ...

Then the module can be added to the DOM using the following tag;

<rt-plot></rt-plot>

Inputs and outputs

Plot ID

Every plot requires a unique string ID. This can be given using the following input;

<rt-plot [plotId]="someString"></rt-plot>

Plot Data

Every plot also requires data. Data can be given using the following input;

<rt-plot [data]="someData"></rt-plot>

Data input accepts an array written in the following format;

// Data interfaces can be imported like this
import { PlotData, TraceData } from '@rotateknik/plot';

// The data must be formatted like this.
const someTrace: TraceData = {
  x: [5, 7, 8],
  y: [15, 17, 19]
};

// This is the variable that should be given to the data input.
// Every member of the data array creates it's own axis.
const someData: PlotData[] = [{
  label: 'Trace', // This will be shown in the legend
  data: someTrace,
  color: '#000000' // Optional. Sets the color of the trace
}];

Dark mode

Optional. A boolean can be given in the following way to toggle dark mode.

<rt-plot [isDarkMode]="isDarkMode"></rt-plot>

Plot deletion

This event fires when the public removePlot() function gets executed. This event could be used for removing the plot from the component it is being used. The event returns the plot ID it was given.

<rt-plot (deletePlot)="handlePlotDeletion($event)"></rt-plot>

Plot interval selection

This event fires when the plot is in annotation mode. To toggle annotation mode, the public function toggleAnnotationMode() should be used. The event returns the min and max values in the selected area.

<rt-plot (chosenInterval)="handleIntervalSelection($event)"></rt-plot>
<script>
function handleIntervalSelection({ min: number, max: number }) {
  // ...
}
</script>

Plot annotation click

This event fires when there is a click on the plot. This event will be used when adding notes to the plot. This event may change name and outputs in the future. It currently returns the x and y coordinates of the click event.

<rt-plot (annotationClick)="handleAnnotationClick($event)"></rt-plot>
<script>
  function handleAnnotationClick({ x: number, y: number }) {
    // ...
  }
</script>

Public functions

Adding new data to an existing trace

The following function can be used for adding new data to an existing trace. It takes a trace index and a data object.

<rt-plot #plot [plotId]="plotId" [data]="plotData"></rt-plot>
<script>
  const data: TraceData = {
    x: [5, 6, 7],
    y: [10, 12, 11]
  }
  plot.addToTrace(0, data);
</script>

Adding a new trace

The following function can be used for adding a new trace to an axis. It takes an axis index, a label to identify, a data object and an optional color parameter.

<rt-plot #plot [plotId]="plotId" [data]="plotData"></rt-plot>
<script>
  const data: TraceData = {
    x: [5, 6, 7],
    y: [10, 12, 11]
  }
  plot.addNewTrace(0, 'New Trace', data, '#000000');
</script>

Adding a new axis

The following function can be used for adding a new trace to an axis.

<rt-plot #plot [plotId]="plotId" [data]="plotData"></rt-plot>
<script>
  plot.addNewAxis();
</script>

Resetting plot zoom

By default dragging the mouse while clicking on the plot zooms to the selected area. The following function can be used for resetting the zoom. One alternative is double clicking on the plot.

<rt-plot #plot [plotId]="plotId" [data]="plotData"></rt-plot>
<script>
  plot.resetPlotZoom();
</script>

Toggling annotation mode

By default the plot is on the zoom mode. By executing the following function the plot will go from zoom mode to annotation mode or visa verca. In annotation mode, the dragging creates a box on the selected area then returns the selected interval using an event. It takes a number as a parameter. 0 for annotation mode, anything else for zoom mode.

<rt-plot #plot [plotId]="plotId" [data]="plotData"></rt-plot>
<script>
  plot.toggleAnnotationMode(0);
</script>

Removing the plot

While this function doesn't removes the plot from the DOM, it fires an event for the parent to handle the deletion.

<rt-plot #plot [plotId]="plotId" [data]="plotData"></rt-plot>
<script>
  plot.removePlot();
</script>

Interfaces

Plot data

interface PlotData {
  label: string,
  data: TraceData,
  color?: string
}

Trace data

interface TraceData {
  x: number[],
  y: number[]
}

Version Update

Go to plot/projects/plot/package.json and change the version number. Then run the following script from that package.json file.

"build:dist": "ng build plot --prod"

Then go to plot/dist/plot and open terminal in folder. Run the following script

npm publish