# Chart.js

![Chart.js for WireBootstrap](/files/-MJdvBHdLPRFcUAF-Tzz)

[Chart.js](https://www.chartjs.org) is simple yet flexible JavaScript charting for designers & developers.  Chart.js supports bar, line, area, pie, and other [chart types](https://www.chartjs.org/samples/latest).

Chart.js for WireBootstrap brings Chart.js into the WireBootstrap framework providing a powerful way of displaying data visualizations in applications developed with Bootstrap themes.

![](/files/-MLUBESjgH1-7LPqIYbV)

## Installation

The Chart.js for WireBootstrap library is located in `wire-chart.js`.  This and other other related files can be installed from the NPM package registry at`@wirebootstrap/wire-chartjs`.

```javascript
npm install @wirebootstrap/wire-chartjs
```

Chart.js for WireBootstrap will load `Chart.min.js` from a [CDN](https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js) if it's not found on the page.&#x20;

## Class

Chart.js for WireBootstrap extends the [wire.ui.component](https://docs.wirebootstrap.com/wirebootstrap/reference/wire.ui/wire.ui.component) class.  As such, it inherits all the base functionality of that class.

To create a new instance of the Chart.js for WireBootstrap component, use the `wire.chartjs` class.

```javascript
const myChart = new wire.chartjs();
```

## Render

Render the component using an HTML `div` element.

{% tabs %}
{% tab title="JavaScript" %}

```html
<div id="chart"></div>
<script>
    new wire.chartjs().render("#chart", {});
</script>
```

{% endtab %}

{% tab title="Web Component" %}

```html
<wire-chartjs wr-config=""></wire-chartjs>
```

{% endtab %}

{% tab title="React" %}

```html
<WireComponent component="wire.chartjs" config={}>
    <div></div>
</WireComponent>
```

{% endtab %}

{% tab title="Vue" %}

```html
<div wire-component="wire.chartjs" v-wire-config=""></div>
```

{% endtab %}

{% tab title="Angular" %}

```html
<div wire-component="wire.chartjs" [config]=""></div>
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wirebootstrap.com/pro-pack/chartjs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
