score:1
Accepted answer
you don't need to call buildchartobject(...)
again when you are trying to just update the data for the chart. if you held onto a reference of the chart you would be fine to skip that call. doing this will allow chart.js to just update the chart when you call chart.update()
instead of creating a new chart and then updating it.
...
let returnschart = buildchartobject($('#chart'), 'bar', timeaxis, percentaxis);
let loadcharts = function () {
let params = {
convertto: $('#convert-to').val()
};
loadchartdata('endpoint', returnschart, params);
}
loadcharts();
$('#convert-to').on('change', function() {
loadcharts();
});
...
Source: stackoverflow.com
Related Query
- Updating Chartjs with new data
- Updating chartJS with dynamic data
- Updating chart.js not working after recieved new data from database with ajax
- Updating Chartjs to 2.5 with custom code
- ChartJS 3.7 data not dynamically updating with data streaming into CSV
- Updating Chartjs Data with Response from POST Call?
- Chartjs random colors for each part of pie chart with data dynamically from database
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- ChartJS - Draw chart with label by month, data by day
- React ChartJS prevent new data from being added into state after it's redrawn?
- Chartjs - data format for bar chart with multi-level x-axes
- ChartJs line chart - display permanent icon above some data points with text on hover
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to create chartjs chart with data from database C#
- Graph streaming real-time data with react and chartjs
- How can I load multiple Chartjs charts with different data on the same page?
- Chartjs not working with d3 from csv source
- ChartJS datasets with one data value
- How to display chart using Chartjs with JSON data in Laravel
- How to create a custom tooltip for chartJS graph with data in JSON array in JavaScript?
- Show dynamic data with dynamic colours in chartjs
- How to plot Firebase data with Chartjs in angular
- chartjs xaxis ticks with round values from shifted input data
- How to add new data point and remove leftmost data point dynamically in Chartjs
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- Update Chart vue3-chart with new data
- Chart isn't updating with Response data (Chart.js 3.2.1, ng2-charts 3.0.0-beta.9)
- chartjs is issue with large amount data
- Change data onclick with ChartJS
- How to properly feed data to ChartJS with different number of x(labels) and y(data) points
More Query from same tag
- Age pyramid: 3.5.1 chartjs
- ChartsJS bar chart with HH:MM:SS format
- Displaying JSON in Chart.js
- How to put implement chart.js into an existing page django
- Chart.js: Widen hover distance for points
- Line Chart is not setting backgroundColor when created dynamically Chart.js
- Disable chartJS tool tip on one dataset only
- I need help on Optimization of Laravel Controller
- Do not rotate scale title at xAxis
- how to remove odd number from yaxes in chartjs using angular?
- How to make data appear on the rightmost edge of line graph Chart.js
- ChartJS horizontal bar with numbers on both scales
- Can you do regions in line charts with Chart.js?
- Add custom data scale to Chart.js
- Remove Decimal values in Yaxis Linechart -Primefaces
- How to have more controls over the borderColor per arc segment for chart.js pie charts
- Count up values in Chart JS
- Chartjs custom dynamic legend overflowing
- Why is the child component updating but not re-render Reactjs
- Chart.js angular8 Y axis ticks
- Error on Chart.js with Electron - Failed to create chart: can't acquire context from the given item
- Chart js x-axis values getting repeated twice
- Update Chart.js plugin
- ChartJS bubble plot categorical y-labels with numbers in string plot issue
- How to remove excess lines on X axis using chartjs?
- Unable to create Stacked Grouped Bar Chart with chart.js / react-chartjs-2 in React
- Chart.js chart by passing data through the controller MVC
- Error: "category" is not a registered scale
- Datalabels not showing on Chart.js
- Unable to use MyChart function