Giter Club home page Giter Club logo

angular2guy / ngx-simple-charts Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 2.0 3.91 MB

Angular 17+ library for D3 based line, bar, donut and date/timeline charts with multiple entry points. A configurable service for token handling is provided.

Home Page: https://angular2guy.wordpress.com

License: Apache License 2.0

JavaScript 2.96% TypeScript 87.24% HTML 3.83% SCSS 5.69% Shell 0.27%
angular typescript angular-cli d3 d3js charts npm angular-library d3-barchart d3-linechart

ngx-simple-charts's Introduction

NgxSimpleCharts

This is a small chart library for Angular based on D3js. It currently supports single line and multi line charts with a legend. Bar and Donut charts are now supported too. The token service and token interceptor are now included in a configurable manner. The Bar charts, line charts, donut, and Date/Timeline charts and the services are in separate entry points to enable the Angular Compiler to put only the required code in the modules that use the features. Its purpose is to enable fast updates to new Angular versions. To enable the fast updates and due to limited time the library will continue have a small feature set.

Minimum Supported Angular Version

Angular 17

Articles

Line Charts

To use the line chart component this module has to be imported: NgxLineChartsModule

Then the component can be used: <sc-line-chart [chartPoints]="..." [replaceName]="..." [replaceSymbol]="...">

The lines are defined in the ChartPoints interface. To draw multiple lines in a chart multiple chartPoints have to be provided. The interface for the chartPoints can be found here: ChartPoints

To enable styling of the chart these classes can be used: Component.scss The classes have to be overwritten with '::ng-deep' and the ViewEncapsulation.ShadowDom is not supported for the enclosing component. To style multiple lines '::ng-deep' classes with the naming convention line-'ChartPoints.name'(for example: 'line-abc') with the name in lower case can be used. The ChartPoints.name is filtered with this Regex: '[^a-zA-Z0-9\-]' that cuts off the name if a character is found that is not a letter, number or '-'(for example 'line-Abc1.d' -> 'line-abc1') and changes it to lower case.

The legend shows the names of the ChartPoints in the color that set for the lines. If one 'ChartPoints.name' should be replaced the 'replaceSymbol' has to be a string that the 'ChartPoints.name' includes and is replaced with the 'replaceName'.

The Line Charts are animated.

Bar Charts

To use the bar chart component this module has to be imported: NgxBarChartsModule

Then the component can be used: <sc-bar-chart [chartBars]="...">

The bars are defined in the ChartBars interface. The interface for the chartPoints can be found here: ChartBars

To enable styling of the chart these classes can be used: Component.scss The classes have to be overwritten with '::ng-deep' and the ViewEncapsulation.ShadowDom is not supported for the enclosing component. To style multiple bars '::ng-deep' classes with the naming convention line-'ChartBar.x'(for example: 'bar-abc') with the name in lower case can be used. The ChartBar.x is filtered with this Regex: '[^a-zA-Z0-9\-]' that cuts off the name if a character is found that is not a letter, number or '-'(for example 'bar-Abc1.d' -> 'line-abc1') and changes it to lower case.

The Bar Charts are animated.

Donut Charts

To use the bar chart component this module has to be imported: NgxDonutChartsModule

Then the component can be used: <sc-donut-chart [chartState]="..." [chartSlices]="...">

The slices are defined in the ChartSlices interface. The interface for the chartSlices can be found here: ChartSlices

The chartState is a string with the values of 'ready' or 'not-ready'. The animation starts when 'not-ready' is set to 'ready'.

To enable styling the optional 'color' property of the ChartSlice can be used to provide a custom color. It needs to be in Css color format.

Date/TimeLine Charts

This is a scolling chart to display time periods in bars vertically in units of years or months. To use the Date/Timeline chart componnent this module has to be imported: NgxDateTimeChartsModule

Then the component can be used: <sc-date-time-chart [showDays]="..." [items]="..."> The property 'showDays' switches the on the view with months and days and the 'items' property contains the ChartItems to display.

Token Services

The services/interceptors for the Jwt token handling are now included.

To use the token handling this module has to be imported: NgxServiceModule

Examples howto use it can be found in the AngularAndSpring and AngularPortfolioMgr projects.

Some time in the future

For more features pull requests are welcome.

ngx-simple-charts's People

Contributors

angular2guy avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.