GithubHelp home page GithubHelp logo

Comments (6)

simonbrunel avatar simonbrunel commented on May 18, 2024 1

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.

simonbrunel avatar simonbrunel commented on May 18, 2024

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.

romain-granai avatar romain-granai commented on May 18, 2024

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.

romain-granai avatar romain-granai commented on May 18, 2024

Thanks for quick feedback Simon,

it's working perfectly now ;)

from chartjs-plugin-deferred.

simonbrunel avatar simonbrunel commented on May 18, 2024

Just noticed it was almost a duplicate of #5 (I will keep that one open until releasing 1.0.0)

from chartjs-plugin-deferred.

simonbrunel avatar simonbrunel commented on May 18, 2024

Version 1.0.0 released!

https://chartjs-plugin-deferred.netlify.com/installation

from chartjs-plugin-deferred.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.