Comments (6)
The old way to set options is:
new Chart(ctx, {
type: 'doughnut',
// ... your data ...
options: {
// ... your other options ...
deferred: {
xOffset: 150,
yOffset: '50%',
delay: 10000
}
}
});
Note that this will not work anymore in 1.0.0 and you would have to use the syntax of your first message. The only difference is that in 1.0.0, options are nested under the plugins
property.
from chartjs-plugin-deferred.
Well, that's my fault, I didn't release latest changes in master since it introduces a breaking change due to that specific way to set options and I was waiting for more stuff to make a proper 1.0.0 release. Your code is supposed to work against master but not with current releases (<= 0.3.0).
I will need some time to test/prepare 1.0.0 so you can either build master by yourself (npm install && gulp build
) or use 0.3.0 with the old way to set options (via options.deferred
). I don't know when I will be able to make 1.0.0 but since the last commit was 8 months ago and there is no feature requests / bug to fix, I will try to release it soon. If you go with the first option (build master), it would help to test the latest code and certainly speed up the release.
from chartjs-plugin-deferred.
Hi,
Thanks for the quick answer, what do you mean by old way to set options? Where can I find documentation about that? it's the first time I use ChartJs and the documentation is not very clear (at least for my level) :
var chart3 = new Chart(ctx3, {
type: 'doughnut',
data: {
labels: chart3labels,
datasets: [{
data: chart3percent,
backgroundColor: chart3color,
borderColor: 'black',
circumference: 10,
borderWidth: 1
}]
},
options: {
legend: {
display: false
},
tooltips: {
callbacks: {
label: function(tooltipItem, data) {
var allData = data.datasets[tooltipItem.datasetIndex].data;
var tooltipLabel = data.labels[tooltipItem.index];
var tooltipData = allData[tooltipItem.index];
var total = 0;
for (var i in allData) {
total += allData[i];
}
var tooltipPercentage = Math.round((tooltipData / total) * 100);
//return tooltipLabel + ': ' + tooltipData + ' (' + tooltipPercentage + '%)';
return tooltipLabel + ': ' + tooltipData + '%';
}
}
}
}
});
chart3.options.deferred.enabled = true;
chart3.options.deferred.delay = 10000;
from chartjs-plugin-deferred.
Thanks for quick feedback Simon,
it's working perfectly now ;)
from chartjs-plugin-deferred.
Just noticed it was almost a duplicate of #5 (I will keep that one open until releasing 1.0.0)
from chartjs-plugin-deferred.
Version 1.0.0 released!
https://chartjs-plugin-deferred.netlify.com/installation
from chartjs-plugin-deferred.
Related Issues (20)
- Doesn't work with fullPage.js HOT 8
- Error with global plugins HOT 3
- Having trouble getting plugin working inside of Vue.js HOT 2
- Deferred update causes an uncaught error if `canvas` is destroyed HOT 6
- Will this be updated to be compatible with ChartJS 3.0? HOT 7
- TypeError: Cannot set property 'font' of null HOT 2
- Question about performance HOT 1
- Uncaught TypeError: Cannot read property 'plugins' of undefined HOT 3
- Unable to es6 import plugin HOT 28
- Add support for an inView callbaack HOT 1
- Uncaught TypeError: e.defaults.global is undefined HOT 2
- Additional Index to Draw Count
- ERR_PACKAGE_PATH_NOT_EXPORTED Server error HOT 2
- $exports is not defined HOT 3
- Add method to remove event listeners/cleanup HOT 7
- Error with global options HOT 3
- Uncaught TypeError: Cannot read property 'ticking' HOT 6
- Unable to get property 'ticking' of undefined or null reference HOT 5
- Deferred animation not working in React HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chartjs-plugin-deferred.