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

ngx-frappe-chart

v0.0.8

Published

A simple and easy to use angular wrapper on top of frappe for generating awesome graphs.

Downloads

75

Readme

Install

Install the package.

$ npm i -s ngx-frappe-chart

Add the frappe library to your Angular.json file:

angular.json

 "architect": {
    "build": {
      ...
      "options": {
        ...
          "scripts": [ "./node_modules/frappe-charts/dist/frappe-charts.min.iife.js"]
        ...
      }
      ...
    }
}

Declare the component in your module:

src/app/app.module.ts

import { FrappeChartsModule } from 'ngx-frappe-chart';

...

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

Usage

Ngx-frappy-chart exports 3 different components i.e. bar, pie, and heatmap to draw similar charts. We will check each one them and how to use them.

Bar chart, Line chart and Axis-Mixed chart tag

This component is used for drawing bar, line and mixed charts. you have to add the componant as follows.

<ngx-frappe-charts-bar
  [type]="'bar'"
  [data]="barChartData"
  [height]="500"
  [yMarkers]="yMarkers"
  [yRegions]="yRegions"
  [colors]="barChartColor"
>
</ngx-frappe-charts-bar>

Valid inputs

Valid inputs foe drawing bar, line and axis-mixed charts are as follows.

Custom models

where GraphDataModel , AxisOptions , TooltipOptions , BarOptions , LineOptions, YMarkers , YRegions are interfaces as follows.

graph-data.model.ts

export interface GraphDataModel {
  labels: string[];
  datasets: GraphDatasetModel[];
}

export interface GraphDatasetModel {
  name: string;
  chartType?: string;
  values: number[];
}

axis-options.model.ts

export interface AxisOptions {
  xIsSeries?: boolean; // default: false
  xAxisMode?: string; // default: 'span'
  yAxisMode?: string; // default: 'span'
}

tooltip-options.model.ts

export interface TooltipOptions {
  formatTooltipX: any; // formatTooltipX: d => (d + '').toUpperCase(),
  formatTooltipY: any; // formatTooltipY: d => d + ' pts',
}

bar-options.model.ts

export interface BarOptions {
  spaceRatio: number; // default: 1
  stacked: number; // default 0,
}

line-options.model.ts

export interface LineOptions {
  dotSize: number; // default: 4
  regionFill: number; // default: 0
  hideDots: number; // default: 0
  hideLine: number; // default: 0
  heatline: number; // default: 0
}

ymarkers.model.ts

export interface YMarkers {
  label: string;
  value: number;
  options: LabelPosition;
}

yregions.model.ts

export interface YRegions {
  label: string;
  start: number;
  end: number;
  options: LabelPosition;
}

label-position.model.ts

export interface LabelPosition {
  labelPos: string; // 'left' | 'right'
}

Percentage chart tag

This component is used for drawing pie and percentage charts. you have to add the componant as follows.

<ngx-frappe-charts-percentage [type]="'pie'" [data]="piechart1" [height]="500">
</ngx-frappe-charts-percentage>

<ngx-frappe-charts-percentage
  [type]="'percentage'"
  [data]="piechart1"
  [height]="500"
>
</ngx-frappe-charts-percentage>

Valid inputs

Valid inputs foe drawing pecentage charts are as follows.

Custom models

where GraphDataModel , BarOptions are interfaces as follows.

graph-data.model.ts

export interface GraphDataModel {
  labels: string[];
  datasets: GraphDatasetModel[];
}

export interface GraphDatasetModel {
  name: string;
  chartType?: string;
  values: number[];
}

bar-options.model.ts

export interface BarOptions {
  height: number; // default: 20 only for barF
  depth: number; // default: 2 only for bar
}

Heatmap chart tag

This component is used for drawing Heatmap charts. you have to add the componant as follows.

<ngx-frappe-charts-heatmap
  [data]="heatmapData"
  [countLabel]="'count'"
  [discreteDomains]="1"
>
</ngx-frappe-charts-heatmap>

Valid inputs

Valid inputs foe drawing Heatmap charts are as follows.

Custom models

where HeatmapDataModel is interfaces as follows.

heatmap-data.model.ts

export interface HeatmapDataModel {
  start: Date; // e.g. new Date('2018-12-31')
  end: Date;
  dataPoints: any; //  { '1524064033': 8, /* ... */},
}

Don't forget to check out the Frappe charts docs.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Kedar Paritkar - Software Developer - Tieto India.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Thanks to Frappe Charts for creating this awesome library.