chartjs-chart-treemap

WebJar for chartjs-chart-treemap

Лицензия

Лицензия

MIT
Категории

Категории

JavaScript Языки программирования
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

chartjs-chart-treemap
Последняя версия

Последняя версия

0.2.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

chartjs-chart-treemap
WebJar for chartjs-chart-treemap
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/kurkle/chartjs-chart-treemap

Скачать chartjs-chart-treemap

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/chartjs-chart-treemap/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>chartjs-chart-treemap</artifactId>
    <version>0.2.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/chartjs-chart-treemap/
implementation 'org.webjars.npm:chartjs-chart-treemap:0.2.3'
// https://jarcasting.com/artifacts/org.webjars.npm/chartjs-chart-treemap/
implementation ("org.webjars.npm:chartjs-chart-treemap:0.2.3")
'org.webjars.npm:chartjs-chart-treemap:jar:0.2.3'
<dependency org="org.webjars.npm" name="chartjs-chart-treemap" rev="0.2.3">
  <artifact name="chartjs-chart-treemap" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='chartjs-chart-treemap', version='0.2.3')
)
libraryDependencies += "org.webjars.npm" % "chartjs-chart-treemap" % "0.2.3"
[org.webjars.npm/chartjs-chart-treemap "0.2.3"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

chartjs-chart-treemap

Chart.js v3.0.0-beta.3 module for creating treemap charts. Implementation for Chart.js v2 is in 2.x branch

npm release travis npm bundle size GitHub

Documentation

To create a treemap chart, include chartjs-chart-treemap.js after chart.js and then create the chart by setting the type attribute to 'treemap'

new Chart(ctx, {
    type: 'treemap',
    tree: dataObject,
    key: 'value',
    groups: ['main', 'sub']
});

Configuration

Tree data should be provided in tree property of dataset. data is then automatically build. key defines the key name in data objects to use for value. groups array can be provided to display multiple levels of hierarchy. Data is summarized to groups internally.

new Chart(ctx, {
    type: 'treemap',
    data: {
        datasets: [{
            label: 'Basic treemap',
            tree: [6,6,5,4,3,2,2,1],
            font: {
                color: '#000',
                family: 'serif',
                size: 12,
                style: 'normal',
            },
            backgroundColor: function(ctx) {
                var value = ctx.dataset.data[ctx.dataIndex];
                var alpha = (value + 3) / 10;
                return Color('blue').alpha(alpha).rgbString();
            },
            rtl: false // control in which direction the squares are positioned
        }]
    },
});

Note about chartjs-plugin-datalabels

Treemap is not using any scales currently and thats why chartjs-plugin-datalabels plugin does not work with it. When other charts are using datalables on the same page, you'll need to disable the plugin for treemap charts:

new Chart(ctx, {
    type: 'treemap',
    data: (...),
    options: {
        plugins: {
            datalabels: false
        }
    }
});

Example

Live examples @codepen.io

TreeMap Example Image

Development

You first need to install node dependencies (requires Node.js):

> npm install

The following commands will then be available from the repository root:

> gulp build            // build dist files
> gulp build --watch    // build and watch for changes
> gulp test             // run all tests
> gulp test --watch     // run all tests and watch for changes
> gulp test --coverage  // run all tests and generate code coverage
> gulp lint             // perform code linting
> gulp package          // create an archive with dist files and samples

License

chartjs-chart-treemap is available under the MIT license.

Версии библиотеки

Версия
0.2.3