Comments (8)
public initialize(options?: fabric.IChartConfiguration) {
super.initialize(options);
this.__createChart();
this.__bindChartEvents();
this.on('scaling', debounce(this.__setChartSize.bind(this), 5));
+ this.on('scaled', _ => {
+ const config = {
+ width: Math.ceil(this.width * this.scaleX),
+ height: Math.ceil(this.height * this.scaleY),
+ scaleX: 1.0,
+ scaleY: 1.0,
+ };
+ Object.keys(config).forEach(k => this.set.apply(this, [k, config[k]]), this);
+ this.__setChartSize.bind(this);
+ });
return this
}
from chart-js-fabric.
Hi! Glad you like the package. Can you simply try to add a currentChart.set('dirty', true)
after setting the data? The package does not force a re-render after updating the data unless you specifically request it.
from chart-js-fabric.
Hi @yassipad,
Thank you for your tip 🤩 It can render new data smoothly now 👍🏻
By the way, I also have faced a problem with chart scaling.
When I try to scale the chart, it sometimes renders a blank object. I think it relates to the responsive
and maintainAspectRatio
options, I have to set these options to true but not working properly. Do you have any idea? 😄
from chart-js-fabric.
This is a bit odd but unfortunately i think it's probably related to the number of rendering requests when scaling... Is cache disabled ?
from chart-js-fabric.
I have set the objectCaching: true
when creating the chart but still face the same problem.
from chart-js-fabric.
Thank you @QJesus, it works amazingly! 😄
from chart-js-fabric.
@QJesus @pnbao Hi, Can you tell me what exactly the above code by @QJesus does? I am facing the same blank object issue on scaling.
from chart-js-fabric.
after scaled, resize width, height and scaleX/Y equals 1, chat cannot be scaled
can change Object.keys(config).forEach(k => this.set.apply(this, [k, config[k]]), this);
to this.set(config)
from chart-js-fabric.
Related Issues (5)
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 chart-js-fabric.