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 🙏

© 2024 – Pkg Stats / Ryan Hefner

bd2-ngx-polarplot

v18.0.0

Published

Angular component for plotting data in cyclic coordinates (mod range).

Downloads

7

Readme

bd2-ngx-polarplot

Angular component for plotting data in cyclic coordinates (mod range).

example

Interactive demo

Although it is called polar plot, it is not the de-facto polar plot in the sense in the matlab, as the data are one dimensional rather then angle/radius in typical polar plot.

It was designed to plot circadian phases, so peak times in data in 24 scale.

The domain range is cyclic, so the data are mod range, ie data 3, 27, 28 will be plotted as 3, 3, 4.

The petals represents the mean value of the series. Petals radius and width can be scaled by std dev of the data or the provided error values.

How to use it

Installation

npm install bd2-ngx-polarplot --save

Using

  1. Import the PolarPlotModule module:
@NgModule({
...
  imports: [
  ...
    BD2NgxPolarplotModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
  1. Place the component in your template:
<bd2-ngx-polar-plot
  [data]="data" [domain]="domain" [showIndividuals]="all"
  [scaleRadius]="true" >
</bd2-ngx-polar-plot>
  1. Inputs
  • data: number[][] series of data to represents as petals. For example:
data = [
[-23.4,1,25.2,48.7,73.1],
[22.5,21.5,20.6],
[3.5,4.9,3,4.9],
[15.1,16.2,16.1,12.2,12.8]
]

gives 4 petals as in the screenshot

  • domain: [start, end] data will be represented around the circle [start,end) mod domain range. Start does not have to be 0. The example above is made with domain [0,24]

  • showIndividuals: node | selected | all, defaults selected. Determines how individual data points are presented, none no rendering, all, all data points are represented as cricles in the corresponding locations, selected the individual data points are rendered only when the corresponding petal is hoovered over. The example above is taken with option all

  • scaleRadius: boolean, default true, petals radius/length is scalled by the std deviationo of the data or provided errors. The larger the deviation/error the shorted the petal

  • scaleWidth: boolean, default false, petals width can be scalled by the std deviation of the data or provided errors values. The larger the error the wider the petal

  • optional errors: number[], optional, errors values for each series, if missing the std. deviation of the inuput series is used for scaling width or radius

  • optional palette: string[], optional, collors to be used with the data

  • optional labels: string[], labels of the data, will be rendered in the center on hover over the petal

  • optional labelsOn: boolean, if true the label on hover works otherwise disabled

  • optional lookAndFeel, some rendering parameters, check the code for options

  • optional removed: number[], indexes of the data groups that should be removed from plot. The removed groups are being rendered just hidden so the labels, colors are preserved and bringing them back/removing does not triggers transitions in the not removed petals

The angular demo project

This project was generated with Angular CLI version 8.3.20.

Credits

Integration with D3 is based on the code from d3-ng2-service by Tom Wanzek. The d3-ng2-service was actually used during development but then removed to reduce the dependencies and bundle size.

The axis grid is based on the radar plot implementation by Nadieh Bremer: radar chart, radar chart redesigned

The examples from Tom Wanzek [https://tomwanzek.github.io/d3-ng2-demo/] were also of great help.

Performance optimization was achieved by using tricks described by Pascal Precht in articles about using: ngZone ChangeDetectionStrategy.