chartjs-plugin-center-text-doughnut
Advanced tools
Comparing version
/*! | ||
* chartjs-plugin-center-text-doughnut v1.0.0 | ||
* chartjs-plugin-center-text-doughnut v1.0.1 | ||
* https://github.com/isidorasuman/chartjs-plugin-center-text-doughnut | ||
@@ -14,4 +14,4 @@ * (c) 2017-2022 chartjs-plugin-center-text-doughnut contributors | ||
// Get `text` from options | ||
const text = options?.text; | ||
// Get `text` from options (defaults to an empty string) | ||
const text = options?.text || ''; | ||
@@ -18,0 +18,0 @@ // Get `color` from options |
/*! | ||
* chartjs-plugin-center-text-doughnut v1.0.0 | ||
* chartjs-plugin-center-text-doughnut v1.0.1 | ||
* https://github.com/isidorasuman/chartjs-plugin-center-text-doughnut | ||
@@ -20,4 +20,4 @@ * (c) 2017-2022 chartjs-plugin-center-text-doughnut contributors | ||
// Get `text` from options | ||
const text = options?.text; | ||
// Get `text` from options (defaults to an empty string) | ||
const text = options?.text || ''; | ||
@@ -24,0 +24,0 @@ // Get `color` from options |
/*! | ||
* chartjs-plugin-center-text-doughnut v1.0.0 | ||
* chartjs-plugin-center-text-doughnut v1.0.1 | ||
* https://github.com/isidorasuman/chartjs-plugin-center-text-doughnut | ||
@@ -7,2 +7,2 @@ * (c) 2017-2022 chartjs-plugin-center-text-doughnut contributors | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ChartPluginCenterTextDoughnut=e()}(this,(function(){"use strict";return{id:"doughnutCenterText",afterDraw:(t,e,n)=>{if(t.config.options.plugins.doughnutCenterText){const e=t.ctx,i=n?.text,o=n?.color,a={style:n?.font?.style||"normal",variant:n?.font?.variant||"normal",weight:n?.font?.weight||"normal",size:n?.font?.size||"14px",family:n?.font?.family||"initial"};let r=[Math.round((t.chartArea.right+t.chartArea.left-e.measureText(i).width)/2),Math.round((t.chartArea.top+t.chartArea.bottom)/2)];e.restore(),e.font=`${a.style} ${a.variant} ${a.weight} ${a.size} ${a.family}`,e.textBaseline="middle",o&&(e.fillStyle=o),e.fillText(i,...r),e.save()}}}})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).ChartPluginCenterTextDoughnut=e()}(this,(function(){"use strict";return{id:"doughnutCenterText",afterDraw:(t,e,n)=>{if(t.config.options.plugins.doughnutCenterText){const e=t.ctx,i=n?.text||"",o=n?.color,a={style:n?.font?.style||"normal",variant:n?.font?.variant||"normal",weight:n?.font?.weight||"normal",size:n?.font?.size||"14px",family:n?.font?.family||"initial"};let r=[Math.round((t.chartArea.right+t.chartArea.left-e.measureText(i).width)/2),Math.round((t.chartArea.top+t.chartArea.bottom)/2)];e.restore(),e.font=`${a.style} ${a.variant} ${a.weight} ${a.size} ${a.family}`,e.textBaseline="middle",o&&(e.fillStyle=o),e.fillText(i,...r),e.save()}}}})); |
@@ -5,3 +5,3 @@ { | ||
"description": "Chart.js plugin to display centered text within a doughnut chart", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "dist/chartjs-plugin-center-text-doughnut.js", |
10622
0.72%