5.0.4 • Published 13 days ago

@coreui/angular-chartjs v5.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
13 days ago

Status

angular npm package npm package NPM downloads

install:
npm install chart.js@4
npm install @coreui/chartjs@4
npm install @coreui/angular-chartjs@5
import:
// ng modules
import { ChartjsModule } from '@coreui/angular-chartjs';

@NgModule({
    imports: [
        ChartjsModule,
...
// standalone components
  import { ChartjsComponent } from '@coreui/angular-chartjs';

@Component({
    standalone: true,
    imports: [
        ChartjsComponent, 
...
usage:
@Component({
  selector: 'app-chart-sample',
  template: `<c-chart type="line" [data]="data" [options]="options" width="300"></c-chart>`,
})
export class ChartSample {

  colors = {
    label: 'My dataset',
    backgroundColor: 'rgba(77,189,116,.2)',
    borderColor: '#4dbd74',
    pointHoverBackgroundColor: '#fff',
  }

  labels = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'];

  data = {
    labels: this.labels,
    datasets: [{
      data: [65, 59, 84, 84, 51, 55, 40],
      ...this.colors,
      fill:  {value: 65}
    }],
  }

  options = {
    plugins: {
      legend: {
        display: false
      }
    },
    maintainAspectRatio: false,
    elements: {
      line: {
        tension: 0.4
      },
    }
  };
}

README.png

c-chart

component

Inputs:
namedescriptiontypedefault
customTooltipsEnables custom html based tooltipsbooleantrue
dataThe data passed to Chart.js chartChartDatarequired
optionsThe options object that is passed into the Chart.js chartChartOptionsundefined
pluginsThe plugins array that is passed into the Chart.js chartPluginOptionsByTypeundefined
redrawIf true, will tear down and redraw chart on all updatesbooleanfalse
typeChart.js chart type.keyof ChartTypeRegistrybar
wrapperPut the chart into the wrapper with display: block.booleantrue
heightHeight attribute applied to the rendered canvas (px)numberundefined
widthWidth attribute applied to the rendered canvas (px)numberundefined
idHtml id attribute applied to the rendered canvasstringundefined
Outputs:
namedescription
getDatasetAtEventProxy for Chart.js getDatasetAtEvent. Calls with dataset and triggering event.
getElementAtEventProxy for Chart.js getElementAtEvent. Calls with single element array and triggering event.
getElementsAtEventProxy for Chart.js getElementsAtEvent. Calls with element array and triggering event.

See also:

Support CoreUI Development

CoreUI is an MIT-licensed open source project and is completely free to use. However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing. You can support development by buying the CoreUI PRO or by becoming a sponsor via Open Collective.

Platinum Sponsors

Support this project by becoming a Platinum Sponsor. A large company logo will be added here with a link to your website.

Gold Sponsors

Support this project by becoming a Gold Sponsor. A big company logo will be added here with a link to your website.

Silver Sponsors

Support this project by becoming a Silver Sponsor. A medium company logo will be added here with a link to your website.

Bronze Sponsors

Support this project by becoming a Bronze Sponsor. The company avatar will show up here with a link to your OpenCollective Profile.

Backers

Thanks to all the backers and sponsors! Support this project by becoming a backer.

Copyright and license

Copyright 2024 creativeLabs Łukasz Holeczek. Code released under the MIT License. Docs released under Creative Commons.

5.0.4

13 days ago

5.0.3

25 days ago

4.7.19

28 days ago

5.0.2

28 days ago

5.0.1

1 month ago

4.7.18

2 months ago

5.0.0

2 months ago

5.0.0-rc.1

2 months ago

4.7.17

2 months ago

5.0.0-rc.0

2 months ago

4.7.16

2 months ago

5.0.0-next.23

2 months ago

5.0.0-next.22

3 months ago

4.7.14

3 months ago

4.7.13

3 months ago

4.7.12

3 months ago

5.0.0-next.18

3 months ago

5.0.0-next.16

4 months ago

5.0.0-alpha.15

4 months ago

5.0.0-alpha.12

4 months ago

5.0.0-alpha.10

4 months ago

5.0.0-alpha.0

4 months ago

4.7.8

5 months ago

4.7.7

5 months ago

4.7.6

5 months ago

4.7.3

5 months ago

4.7.1

5 months ago

4.5.28

6 months ago

4.7.0

6 months ago

4.5.25

7 months ago

4.5.27

7 months ago

4.5.10

10 months ago

4.5.11

9 months ago

4.5.15

9 months ago

4.5.13

9 months ago

4.5.16

8 months ago

4.5.17

8 months ago

4.5.8

11 months ago

4.4.7

1 year ago

4.5.0-next.0

12 months ago

4.5.0

12 months ago

4.5.2

11 months ago

4.4.0-next.1

1 year ago

4.3.17

1 year ago

4.4.1

1 year ago

4.4.0

1 year ago

4.2.35

1 year ago

4.3.16

1 year ago

4.3.15

1 year ago

4.2.33

1 year ago

4.3.9

1 year ago

4.4.0-next.0

1 year ago

4.3.7

1 year ago

4.3.0-next.0

1 year ago

4.3.0

1 year ago

4.2.14

1 year ago

4.2.15

1 year ago

4.2.2

2 years ago

4.2.4

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

4.1.1

2 years ago

2.0.2

2 years ago

4.1.0

2 years ago

2.0.0-beta.4

2 years ago

2.0.0

2 years ago

2.0.0-beta.1

2 years ago

2.0.0-beta.0

2 years ago

2.0.0-alpha.7

2 years ago

2.0.0-alpha.8

2 years ago

2.0.0-alpha.9

2 years ago

2.0.0-alpha.6

2 years ago

2.0.0-alpha.5

2 years ago

2.0.0-alpha.4

2 years ago

2.0.0-alpha.3

2 years ago

2.0.0-alpha.2

2 years ago

2.0.0-alpha.1

2 years ago