
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
angular2-chartjs
Advanced tools
Chart.js component for Angular2+
You can install angular2-chartjs by using npm.
npm install angular2-chartjs
Add ChartModule
to your module, eg.
import { ChartModule } from 'angular2-chartjs';
@NgModule({
imports: [ ChartModule ]
// ...
})
export class AppModule {
}
And you can use selector chart
in your template.
JavaScript
type = 'line';
data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
data: [65, 59, 80, 81, 56, 55, 40]
}
]
};
options = {
responsive: true,
maintainAspectRatio: false
};
HTML
<chart [type]="type" [data]="data" [options]="options"></chart>
string, required
Chart type.
object, required
To display data, the chart must be passed a data object that contains all of the information needed by the chart. See.
object, optional
To create a chart with configuration options, simply pass an object containing your configuration to the constructor. See.
Event
Return click event.
Array
Return the clicked dataset array.
Array
Return the clicked element in array.
Array
Return the clicked elements in array.
Chart
Chart instance. You can call Chart.js methods via this member.
Example:
chartComponent.chart.destroy();
Add following settings
{
map: {
'angular2-chartjs': 'npm:angular2-chartjs',
'chart.js': 'npm:chart.js/dist/Chart.bundle.js'
},
packages: {
'angular2-chartjs': {
main: './dist/index.js',
defaultExtension: 'js'
}
}
}
How to call Chart.js methods - #7, #2
The project is released under the MIT license.
The project's website is located at https://github.com/emn178/angular2-chartjs
Author: Chen, Yi-Cyuan (emn178@gmail.com)
v0.5.1 / 2018-05-18
FAQs
Chart.js component for Angular2
The npm package angular2-chartjs receives a total of 8,238 weekly downloads. As such, angular2-chartjs popularity was classified as popular.
We found that angular2-chartjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.