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-g2plot

v2.2.0

Published

Angular's g2plot package is easy to use

Downloads

1,039

Readme

About

Angular's g2plot package is easy to use

Install

npm install --save  ngx-g2plot
#or
yarn add  ngx-g2plot

Preview

https://stack-stark.github.io/ngx-g2plot-preview-compiled/

Usage

line.component.html

<div starkG2plotLine  #divG2plotLine="g2plotLine" [options]="options"></div>

line.component.ts

import { Component, ViewChild } from '@angular/core';
import { G2plotLineDirective } from 'ngx-g2plot';

@Component({
  selector: 'app-line',
  templateUrl: './line.component.html',
  styleUrls: ['./line.component.less']
})
export class LineComponent {

  constructor() { }
  // Gets to the instruction object
  @ViewChild('divG2plotLine') divG2plotLine!: G2plotLineDirective;

  data: Array<object> = [
    { year: '1991', value: 3 },
    { year: '1992', value: 4 },
    { year: '1993', value: 3.5 },
    { year: '1994', value: 5 },
    { year: '1995', value: 4.9 },
    { year: '1996', value: 6 },
    { year: '1997', value: 7 },
    { year: '1998', value: 9 },
    { year: '1999', value: 13 },
  ];

  options = {
    title: {
      visible: true,
      text: '折线图',
    },
    description: {
      visible: true,
      text: '用平滑的曲线代替折线。',
    },
    data: this.data,
    xField: 'year',
    yField: 'value',
  };

  update(): void {
   const options = {
      title: {
        visible: true,
        text: 'The line chart',
      },
      description: {
        visible: true,
        text: 'Replace broken lines with smooth curves.',
      },
      xField: 'year',
      yField: 'value',
    };
    this.divG2plotLine.update(options);
  }

  changeData(): void {
    const data = [
      { year: '1991', value: 13 },
      { year: '1992', value: 14 },
      { year: '1993', value: 13.5 },
      { year: '1994', value: 15 },
      { year: '1995', value: 14.9 },
      { year: '1996', value: 16 },
      { year: '1997', value: 17 },
      { year: '1998', value: 19 },
      { year: '1999', value: 23 },
    ];
    this.divG2plotLine.changeData(data);
  }

  destroy(): void {
    this.divG2plotLine.destroy();
  }

  changeSize(): void {
    //Use the current instance method
    this.divG2plotLine.instance.changeSize(300, 300);
  }
}

line.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { G2plotLineModule } from 'ngx-g2plot';

@NgModule({
  declarations: [G2plotDemoComponent],
  imports: [
    CommonModule,
    G2plotLineModule
  ]
})
export class G2plotDemoModule { }

Tip

I'm using exportAs the deduced update(), changeData(), destroy() the three methods, so that you can at any time to change chart.

If you need to get the current diagram instance and all its properties and methods, use this.xxx.instance. See changeSize() above for details.

See the official documentation for all methods of charting: https://g2plot.antv.vision/zh/docs/manual/plot-api

All Directive

指令名/Directive | 图表名 | exportAs | Module -|-|-|- starkG2plotArea | Area - 面积图 | g2plotArea | G2plotAreaModule starkG2plotBar | Bar - 基础条形图 | g2plotBar | G2plotBarModule starkG2plotBidirectionalBar | BidirectionalBar - 对称条形图 | g2plotBidirectionalBar | G2plotBidirectionalBarModule starkG2plotBox | Box - 箱图 | g2plotBox | G2plotBoxModule starkG2plotBullet | Bullet - 子弹图 | g2plotBullet | G2plotBulletModule starkG2plotChord | Chord - 弦图 | g2plotChord | G2plotChordModule starkG2plotColumn | Column - 柱状图 | g2plotColumn | G2plotColumnModule starkG2plotDualAxes | DualAxes - 柱线混合图 | g2plotDualAxes | G2plotDualAxesModule starkG2plotFunnel | Funnel - 漏斗图 | g2plotFunnel | G2plotFunnelModule starkG2plotGauge | Gauge - 仪表盘 | g2plotGauge | G2plotGaugeModule starkG2plotHeatmap | Heatmap - 热力图 | g2plotHeatmap | G2plotHeatmapModule starkG2plotHistogram | Histogram - 直方图 | g2plotHistogram | G2plotHistogramModule starkG2plotLine | Line - 折线图 | g2plotLine | G2plotLineModule starkG2plotLiquid | Liquid - 水波图 | g2plotLiquid | G2plotLiquidModule starkG2plotPie | Pie - 饼图 | g2plotPie | G2plotPieModule starkG2plotRadialBar | RadialBar - 玉珏图 | g2plotRadialBar | G2plotRadialBarModule starkG2plotRadar | Radar - 雷达图 | g2plotRadar | G2plotRadarModule starkG2plotRose | Rose - 玫瑰图 | g2plotRose | G2plotRoseModule starkG2plotSankey | Sankey - 桑基图 | g2plotSankey | G2plotSankeyModule starkG2plotScatter | Scatter - 散点图 | g2plotScatter | G2plotScatterModule starkG2plotStock | Stock - 股票图 | g2plotStock | G2plotStockModule starkG2plotSunburst | Sunburst - 旭日图图 | g2plotSunburst | G2plotSunburstModule starkG2plotTinyColumn | TinyColumn - 迷你图 | g2plotTinyColumn | G2plotTinyColumnModule starkG2plotTreemap | Treemap - 树图 | g2plotTreemap | G2plotTreemapModule starkG2plotWaterfall | Waterfall - 瀑布图 | g2plotWaterfall | G2plotWaterfallModule starkG2plotWordCloud | WordCloud - 词云 | g2plotWordCloud | G2plotWordCloudModule

About the name

Directive = starkG2plot + Graph Name,

exportAs = g2plot + Graph Name,

Module = G2plot + Graph Name + Module

G2plot official document address

https://g2plot.antv.vision/zh/docs/manual/introduction

Use has encountered a problem or defect?

https://github.com/stack-stark/ngx-g2plot/issues

License

MIT