Comments (4)
The functions in https://www.chartjs.org/docs/4.4.0/samples/bar/horizontal.html seems to work fine. Can you give an example where it does not work, what happens and what did you expect?
from chart.js.
Sorry, I should have been more specific. It's the code on this docs page: https://www.chartjs.org/docs/4.4.0/developers/updates.html#adding-or-removing-data
Specifically these two functions:
function addData(chart, label, newData) {
chart.data.labels.push(label);
chart.data.datasets.forEach((dataset) => {
dataset.data.push(newData);
});
chart.update();
}
function removeData(chart) {
chart.data.labels.pop();
chart.data.datasets.forEach((dataset) => {
dataset.data.pop();
});
chart.update();
}
With a chart that has more than one element in chart.data.labels, removeData only removes one, so the chart ends up with leftover stale data.
from chart.js.
The current functions work as expected. They are not meant to replace or remove all the data.
They are meant to add a data entry to each dataset or remove a data entry from each dataset and that is exactly what the example is showing
from chart.js.
Ah ok thanks for clarifying. I misunderstood the intent of the functions. I'll close this.
from chart.js.
Related Issues (20)
- Legend: boxPadding does nothing
- A tooltip appears in the center of the chart on chart hover after hiding all data via legend click HOT 1
- Legend: maxHeight does nothing for positions left & right, maxWidth does nothing for positions top & bottom
- Labels: textDirection does nothing
- How to disable hiding of tooltips on hover? HOT 5
- Improve Chart update performance with many datasets
- In category axis, the last tick is not drawn if either maxTicksLimit or autoSkipPadding is specified.
- can't run on firefox HOT 2
- More detailed doc on how to contribute HOT 11
- Radial Graph Improvement
- Chart grows forever when maintainAspectRatio is false HOT 1
- Horizontal legend multiline labels overlaps
- Forced re-layout (reflow) when canvas has no fixed width/height
- add click (and other) event handle to labels HOT 2
- Image-Based Unit Tests Fail on Mac
- When defining an External implementation for Tooltip, chart.canvas.offsetLeft doesn't work when chart in a table HOT 1
- Custom bundle build HOT 5
- Chart is not responsive inside flexbox HOT 1
- Line fill in a bar/line combo chart is not working or inconsistent HOT 2
- How to have line span from 2 points in chartjs? 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 chart.js.