yassilah / chart-js-fabric Goto Github PK
View Code? Open in Web Editor NEWchart.js + fabric.js = ❤️
License: MIT License
chart.js + fabric.js = ❤️
License: MIT License
please move demo/
to separate branch, like gh-pages, and remove from git history .. its a waste of space and traffic
Is it possible to replace option/data dynamically? Right now the options are merged.
If I have an array of data of length 5, setting the data like object.set({ chart: { data: [2] })
will not remove the other 4 entries.
Thanks for the nice package.
Hi, i've tried to set a label using callbacks funcction, but i'm getting errors. Am i doing something wrong or is it an issue with library?
const chart = new fabric.Chart(options as fabric.IChartConfiguration);
chart.set({
chart: {
options: {
tooltips: {
callbacks: {
label: function (tooltipItem, data) {
let total = 0;
data.datasets[tooltipItem.datasetIndex].data.forEach((item) => {
total += Number(item);
});
const label = data.datasets[tooltipItem.datasetIndex].label;
return `${label}: ${tooltipItem.yLabel} of ${total}`;
},
},
},
},
},
});
Hello, thank you for your great work.
I am able to connect fabric.js with chart.js by using your library. The chart is rendered pretty smooth.
Now I want to update the chart's data dynamically by user input, but the chart is not re-rendered again.
I have checked the chart's chart
property and can see that all the data are updated correctly, but for some reason it is not displayed in the canvas.
Here is the function I am using for update data. Is there anything missed, thank you for your help 😄
updateChartData: function(dataset, labels){
const canvas = CommonHandlers.getCanvas();
const currentChart = canvas.getActiveObject();
if (currentChart) {
currentChart.set('chart', {
data: {
labels: labels,
datasets: dataset.map(row => ({
label: '# of Votes',
data: row.map(item => parseFloat(item.value)),
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)'
],
borderWidth: 1
})),
}
});
}
canvas.renderAll();
}
Hi,
Thanks for the great package.
Can you add latest chart-js version ? I noticed the version is in this library is - "chart.js": "^2.9.3"
.
Is there any way i can update the version of chart js used in this package to the current version - "chart.js": "^4.2.1"
?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.