1.4.2 • Published 2 years ago

dynamic-pie-chart v1.4.2

Weekly downloads
44
License
MIT
Repository
github
Last release
2 years ago

The Dynamic Pie Chart

This library provides a dynamic pie chart, i.e. a sector diagram widget, which is linked to a dynamic source, and available for user interaction. Each sector can be activated, or selected with the mouse pointer.

npm.io License: MIT

A sample usage of this library can be previewed (and admired) in the Fitzhì solution.

Dynamic Pie Chart

  • The release 1.1.x is associated with Angular 9.
  • The release 1.2.x is associated with Angular 10.
  • The release 1.3.x is associated with Angular 11.
  • The release 1.4.x is associated with Angular 12.

Installing this library in your project ?

The most simple command npm install dynamic-pie-chart will install this library

To import the module inside your application, just add the module DynamicPieChartModule in your app.module.ts.

location :

import {DynamicPieChartModule} from 'dynamic-pie-chart';

2 mock files are provided for testing purpose. Each one is containing a sample array of slices :

  • MockSlicesOne
  • MockSlicesTwo

Using this library in your application ?

To include this component into a container, you just have to declare this section into the HTML template.

<lib-dynamic-pie-chart
	[pie]=1
	[radius]=150
	[active]=true
	[legend]=legend
	[slices$]=slices$
	[filteredSlices$]=filteredSlices$
	[typeSlices$]=typeSlices$
	(selected)="sliceSelection($event)" 
	(activated)="sliceActivation($event)">
</lib-dynamic-pie-chart>

The parameters are :

ParameterDecoratorComment
pieINPUTthe pie identifier inside the container. There can be multiple pies in the same component. Each pie must have a unique pie.
radiusINPUTthe radius of the Pie in pixel.
activeINPUTDoes this pie have to be active, or not ? A pie is a set of slices. An active pie allows each slice to be activated, or selected, by the mouse cursor.
legendINPUTtrue or false. Does this pie has a legend ? In this current release (1.0.0), the legend is a circle with lebel surrounding the pie.
slices$INPUTan observable which publishes an array of slices to be drawn. Each sector diagram is made up of pieces, from various angles, and whose sum is equal to 360. (This widget supports a sum of tranches lower than 360). This array will be internally sorted on the type property to provide a legend.
filteredSlices$INPUTan OPTIONAL observable which broadcasts an array of slices to be filtered on the chart.
typeSlices$INPUTan observable which publishes an array of type of slices. the array ol slices
selectedOUTPUTan EventEmitter to inform the parent component that a slice has been activated
activatedOUTPUTan EventEmitter to inform the parent component that a slice has been selected

What is a slice ?

For the component, the pie is an array of slices.

A slice is a piece of pie.

PropertytypeComment
idnumberthe identifier of the slice, un unique number per pie
typenumberthe type of slice
anglenumberthe angle of this slice in degree
offsetnumberthe offset (in degrees) of this slice within the pie. This property is there for internal use. Its value will be processed by the component.
backgroundColorstringthe background color of this slice
textColorstringthe color of the 'numeric' value associated to slice
textFontSizestringthe font size attributed to this value
dataanythe data object associated to this child.
childrenarray of anyan array of data which can be considered as the children linked to this slice
activatedbooleantrue or false if this slice is activated (the end-user has moved the mouse on it)
selectedbooleantrue or false if this slice is selected (the end-user has clicked on it)

What is a type of slice ?

A type of slices is a reference table of legend.

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.2.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.1.1

3 years ago

1.1.0

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.2-a

4 years ago

1.0.1-a

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago