We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in <div id="traffic"></div> <input onchange="filterData()" type="date" id="startdate" value="<?php echo $date[0] ?>"> <input onchange="filterData()" type="date" id="enddate" value="<?php echo $date[count($date) - 1] ?>">
<div id="traffic"></div> <input onchange="filterData()" type="date" id="startdate" value="<?php echo $date[0] ?>"> <input onchange="filterData()" type="date" id="enddate" value="<?php echo $date[count($date) - 1] ?>">
in script `const dates = []; const datapoints = []; //set chartist var chart1 = new Chartist.Line('#traffic', { labels: dates, series: [{ name: 'proTotal', data: datapoints }, ] }, { low: 0, showArea: true }); function filterData() { const dates2 = [...dates]; console.log(dates2) const startdate = document.getElementById('startdate'); const enddate = document.getElementById('enddate');
const indexstartdate = dates2.indexOf(startdate.value); const indexendtdate = dates2.indexOf(enddate.value); //console.log(startdate) const filterDate = dates2.slice(indexstartdate, indexendtdate + 1); // replace the labels in the chart chart1.labels = filterDate; //datapoints const datapoints2 = [...datapoints]; const filterDatapoints = datapoints2.slice(indexstartdate, indexendtdate + 1); chart1.series = filterDatapoints; chart1.update(); }`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm using chartist.js to run a chart, but I can't update it when choosing between two time intervals.
in
<div id="traffic"></div> <input onchange="filterData()" type="date" id="startdate" value="<?php echo $date[0] ?>"> <input onchange="filterData()" type="date" id="enddate" value="<?php echo $date[count($date) - 1] ?>">
in script
`const dates = [];
const datapoints = [];
//set chartist
var chart1 = new Chartist.Line('#traffic', {
labels: dates,
series: [{
name: 'proTotal',
data: datapoints
}, ]
}, {
low: 0,
showArea: true
});
function filterData() {
const dates2 = [...dates];
console.log(dates2)
const startdate = document.getElementById('startdate');
const enddate = document.getElementById('enddate');
The text was updated successfully, but these errors were encountered: