chartjs-plugin-empty-overlay
Advanced tools
Comparing version 1.0.0 to 1.0.1
/*! | ||
* chartjs-plugin-empty-overlay | ||
* http://neverbounce.com/ | ||
* Version: 1.0.0 | ||
* Version: 1.0.1 | ||
* | ||
@@ -75,3 +75,3 @@ * Copyright 2017 NeverBounce | ||
y = chartArea.top, | ||
width = chartArea.right - chartArea.top, | ||
width = chartArea.right - chartArea.left, | ||
height = chartArea.bottom - chartArea.top, | ||
@@ -135,3 +135,3 @@ textX = (x / 2) + (width / 2), | ||
afterDraw: function (chartInstance) { | ||
afterDatasetsDraw: function (chartInstance) { | ||
@@ -138,0 +138,0 @@ // Merge config |
/*! | ||
* chartjs-plugin-empty-overlay | ||
* http://neverbounce.com/ | ||
* Version: 1.0.0 | ||
* Version: 1.0.1 | ||
* | ||
@@ -10,2 +10,2 @@ * Copyright 2017 NeverBounce | ||
*/ | ||
"use strict";!function(){function t(t,e){(!t||t.length<1)&&(e.isEmpty=!0);var o=t.map(function(t){var e=t.data.filter(function(t){return t.x?t.x>0:t>0});return e.length>0}).filter(function(t){return t});return e.isEmpty=o.length<1}function e(t,e){var a=new o.EmptyOverlay({ctx:t.chart.ctx,options:e,originalConfig:t.config,chart:t,isEmpty:!1});t.emptyOverlay=a}var o=window.Chart,a=o.helpers;o.defaults.global.emptyOverlay={enabled:!0,message:"No data available",fillStyle:"rgba(100,100,100,0.3)",fontColor:"rgba(100,100,100,1.0)",fontStroke:"rgba(255,255,255,0.6)",fontStrokeWidth:"3",fontSize:"auto"},o.EmptyOverlay=o.Element.extend({position:"chartArea",initialize:function(t){a.extend(this,t)},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.ctx,l=o.defaults.global,n=t.options,i=t.chart.chartArea,r=i.left,f=i.top,y=i.right-i.top,s=i.bottom-i.top,p=r/2+y/2,m=f+s/2,u=a.getValueOrDefault,c=n.message,d=u(n.fontSize,l.defaultFontSize),v="auto"===d?Math.sqrt(y):d,g=u(n.fontStyle,l.defaultFontStyle),h=u(n.fontFamily,l.defaultFontFamily),O=a.fontString(v,g,h);e.fillStyle=u(n.fillStyle,l.defaultColor),e.fillRect(r,f,y,s),e.textAlign="center",e.textBaseline="middle",e.font=O,e.lineWidth=n.fontStrokeWidth,e.miterLimit=2,e.strokeStyle=n.fontStroke,e.strokeText(c,p,m,y),e.fillStyle=u(n.fontColor,l.defaultFontColor),e.fillText(c,p,m,y)}}),o.plugins.register({beforeInit:function(t){var l=t.options.emptyOverlay||{};l=a.configMerge(o.defaults.global.emptyOverlay,l),e(t,l)},beforeUpdate:function(e){var o=t(e.config.data.datasets,e.emptyOverlay);o&&(e.config.data.datasets=[],e.config.data.labels=[])},afterDraw:function(t){var l=t.options.emptyOverlay||{};l=a.configMerge(o.defaults.global.emptyOverlay,l),t.emptyOverlay?t.emptyOverlay.options=l:e(t,l),l.enabled&&t.emptyOverlay.isEmpty?t.emptyOverlayBox||(t.emptyOverlayBox=!0,o.layoutService.addBox(t,t.emptyOverlay)):t.emptyOverlayBox&&(o.layoutService.removeBox(t,t.emptyOverlay),delete t.emptyOverlayBox)}})}(); | ||
"use strict";!function(){function t(t,e){(!t||t.length<1)&&(e.isEmpty=!0);var o=t.map(function(t){var e=t.data.filter(function(t){return t.x?t.x>0:t>0});return e.length>0}).filter(function(t){return t});return e.isEmpty=o.length<1}function e(t,e){var a=new o.EmptyOverlay({ctx:t.chart.ctx,options:e,originalConfig:t.config,chart:t,isEmpty:!1});t.emptyOverlay=a}var o=window.Chart,a=o.helpers;o.defaults.global.emptyOverlay={enabled:!0,message:"No data available",fillStyle:"rgba(100,100,100,0.3)",fontColor:"rgba(100,100,100,1.0)",fontStroke:"rgba(255,255,255,0.6)",fontStrokeWidth:"3",fontSize:"auto"},o.EmptyOverlay=o.Element.extend({position:"chartArea",initialize:function(t){a.extend(this,t)},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.ctx,l=o.defaults.global,n=t.options,i=t.chart.chartArea,r=i.left,f=i.top,y=i.right-i.left,s=i.bottom-i.top,p=r/2+y/2,m=f+s/2,u=a.getValueOrDefault,c=n.message,d=u(n.fontSize,l.defaultFontSize),v="auto"===d?Math.sqrt(y):d,g=u(n.fontStyle,l.defaultFontStyle),h=u(n.fontFamily,l.defaultFontFamily),O=a.fontString(v,g,h);e.fillStyle=u(n.fillStyle,l.defaultColor),e.fillRect(r,f,y,s),e.textAlign="center",e.textBaseline="middle",e.font=O,e.lineWidth=n.fontStrokeWidth,e.miterLimit=2,e.strokeStyle=n.fontStroke,e.strokeText(c,p,m,y),e.fillStyle=u(n.fontColor,l.defaultFontColor),e.fillText(c,p,m,y)}}),o.plugins.register({beforeInit:function(t){var l=t.options.emptyOverlay||{};l=a.configMerge(o.defaults.global.emptyOverlay,l),e(t,l)},beforeUpdate:function(e){var o=t(e.config.data.datasets,e.emptyOverlay);o&&(e.config.data.datasets=[],e.config.data.labels=[])},afterDatasetsDraw:function(t){var l=t.options.emptyOverlay||{};l=a.configMerge(o.defaults.global.emptyOverlay,l),t.emptyOverlay?t.emptyOverlay.options=l:e(t,l),l.enabled&&t.emptyOverlay.isEmpty?t.emptyOverlayBox||(t.emptyOverlayBox=!0,o.layoutService.addBox(t,t.emptyOverlay)):t.emptyOverlayBox&&(o.layoutService.removeBox(t,t.emptyOverlay),delete t.emptyOverlayBox)}})}(); |
@@ -5,3 +5,3 @@ { | ||
"description": "Chart.js plugin to replace empty plots with a friendly placeholder", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "src/plugin.js", |
@@ -1,2 +0,2 @@ | ||
# Defer initial chart updates | ||
# Display Overlay on Empty Charts | ||
@@ -3,0 +3,0 @@ [![npm](https://img.shields.io/npm/v/chartjs-plugin-empty-overlay.svg?style=flat-square)](https://npmjs.com/package/chartjs-plugin-empty-overlay) [![Travis](https://img.shields.io/travis/NeverBounce/chartjs-plugin-empty-overlay.svg?style=flat-square)](https://travis-ci.org/NeverBounce/chartjs-plugin-empty-overlay) [![Code Climate](https://img.shields.io/codeclimate/github/NeverBounce/chartjs-plugin-empty-overlay.svg?style=flat-square)](https://codeclimate.com/github/NeverBounce/chartjs-plugin-empty-overlay) |
@@ -66,3 +66,3 @@ 'use strict'; | ||
y = chartArea.top, | ||
width = chartArea.right - chartArea.top, | ||
width = chartArea.right - chartArea.left, | ||
height = chartArea.bottom - chartArea.top, | ||
@@ -126,3 +126,3 @@ textX = (x / 2) + (width / 2), | ||
afterDraw: function (chartInstance) { | ||
afterDatasetsDraw: function (chartInstance) { | ||
@@ -129,0 +129,0 @@ // Merge config |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38071