All Projects → ciprianciurea → chartjs-plugin-doughnutlabel

ciprianciurea / chartjs-plugin-doughnutlabel

Licence: MIT license
Chart.js plugin for doughnut chart to display text in the center

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to chartjs-plugin-doughnutlabel

chartjs-plugin-piechart-outlabels
Highly customizable Chart.js plugin that displays labels outside the pie/doughnut chart.
Stars: ✭ 46 (-4.17%)
Mutual labels:  chartjs, doughnut-chart, chartjs-plugin
chartjs-chart-wordcloud
Chart.js Word Clouds
Stars: ✭ 34 (-29.17%)
Mutual labels:  chartjs, chartjs-plugin
chartjs-plugin-datasource-prometheus
Chart.js plugin for Prometheus data loading
Stars: ✭ 77 (+60.42%)
Mutual labels:  chartjs, chartjs-plugin
Vue Chartjs
📊 Vue.js wrapper for Chart.js
Stars: ✭ 4,554 (+9387.5%)
Mutual labels:  chartjs, doughnut
chartjs-chart-graph
Chart.js Graph-like Charts (tree, force directed)
Stars: ✭ 103 (+114.58%)
Mutual labels:  chartjs, chartjs-plugin
phpchartjs
A PHP library that makes it easy to generate data for ChartJS.
Stars: ✭ 24 (-50%)
Mutual labels:  chartjs
chartjs-plugin-downsample
Chart.js plugin to downsample chart data
Stars: ✭ 41 (-14.58%)
Mutual labels:  chartjs
Chart.js-Rounded-Bar-Charts
Rounded Rectangles in Bar Charts
Stars: ✭ 48 (+0%)
Mutual labels:  chartjs
chart
📊📉 Add beautiful and reusable charts with one line of ruby for Rails 5.x
Stars: ✭ 42 (-12.5%)
Mutual labels:  chartjs
network performance monitor
Network Performance Monitor - a portable tool for troubleshooting performance issues with home networks
Stars: ✭ 74 (+54.17%)
Mutual labels:  chartjs
ipychart
The power of Chart.js with Python
Stars: ✭ 48 (+0%)
Mutual labels:  chartjs
competiwatch
Web app to track and visualize your competitive match history in Overwatch.
Stars: ✭ 17 (-64.58%)
Mutual labels:  chartjs
data-11ty
An open source 11ty theme designed for reporting & data-visualization
Stars: ✭ 19 (-60.42%)
Mutual labels:  chartjs
vuejs-admin-dashboard-template
Mosaic Lite is a free admin dashboard template built on top of Tailwind CSS and fully coded in Vue. Made by
Stars: ✭ 139 (+189.58%)
Mutual labels:  chartjs
chartjs-chart-timeline
Google-like timeline chart for Chart.js.
Stars: ✭ 44 (-8.33%)
Mutual labels:  chartjs
django admin chart js
An example repo showing how to add Chart.js to Django admin
Stars: ✭ 35 (-27.08%)
Mutual labels:  chartjs
competiwatch-desktop
Desktop app built in Electron for tracking your competitive match history in Overwatch.
Stars: ✭ 94 (+95.83%)
Mutual labels:  chartjs
chartjs-web-components
the web components for chartjs
Stars: ✭ 50 (+4.17%)
Mutual labels:  chartjs
vuepress-theme-cool
A custom vuepress theme with mermaid and plantuml, katex and vue components.
Stars: ✭ 57 (+18.75%)
Mutual labels:  chartjs
hugo-chart
a Chart.js component for Hugo. 📈
Stars: ✭ 71 (+47.92%)
Mutual labels:  chartjs

Chart.js Doughnut plugin to allow for lines of text in the middle

Chart.js plugin module that allows to display multiple lines of text centered in the middle area of the doughnut charts

Demo

Have a look at the Demo page.

Table of contents

Installation

Install through npm:

npm install --save chartjs-plugin-doughnutlabel

Usage

var myDoughnutChart = new Chart(ctx, {
  type: 'doughnut',
  data: data,
  options: {
    plugins: {
      doughnutlabel: {
        labels: [
          {
            text: 'The title',
            font: {
              size: '60'
            }
          },
          {
            text: getTotal,
            font: {
              size: '50'
            },
            color: 'grey'
          },
          {
            text: '$100.000',
            font: {
              size: '30'
            },
            color: 'red'
          },
          {
            text: '95%',
            font: {
              size: '45'
            },
          color: 'green'
          }
        ]
      }
    }		
  }
});

var getTotal = function(myDoughnutChart) {
	var sum = myDoughnutChart.config.data.datasets[0].data.reduce((a, b) => a + b, 0);
	return `Total: ${sum}`;
}

Usage without a module bundler

The plugin can be manually downloaded from the Releases page on GitHub!

<script src="chartjs-plugin-doughnutlabel.js"></script>

or use the minified version

<script src="chartjs-plugin-doughnutlabel.min.js"></script>

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 lint             // perform code linting
> gulp build            // build dist files
> gulp build --watch    // build and watch for changes
> gulp package          // create an archive with dist files and samples

In Angular

For an example on how to use this plugin with angular, please check this stackblitz prototype: doughnutlabel plugin in angular

License

chartjs-plugin-doughnutlabel is available under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].