我正在尝试添加更改图表“日期”范围的功能,并且我添加了一个按钮回调来更改 xAxes 的最小值,然后调用 chart.update(),但图表没有改变。我试过手动输入一个数字,除非它是为表格给出的数据中的一个值,否则它不会更新图表。this.analysisChart = new Chart(context, { // The type of chart we want to create type: 'line', // The data for our dataset data: { labels: calculations.rollingTimestamps, datasets: [ { label: 'Cycle Times', data: calculations.rollingCycleTimesXY, borderColor: 'rgb(0,255,0,1)', backgroundColor: 'rgb(0,255,0,0.5)', type: 'scatter', showLine: false, labels: calculations.rollingAliases }, { label: 'Rolling μ', borderColor: 'rgb(255, 99, 132, 1)', backgroundColor: 'rgb(255, 99, 132, 0.5)', data: calculations.rollingAverage, fill: false, pointRadius: 0 }, { label: 'Overall μ', data: calculations.overallAverageArr, fill: false, borderColor: 'rgb(0,0,0,1)', backgroundColor: 'rgb(0,0,0,0.5)', pointRadius: 0, showLine: true }, { label: 'μ + σ', data: calculations.rollingMaxStandardDeviation, fill: 4, backgroundColor: 'rgb(50,50,255,0.35)', borderColor: 'rgb(50,50,255,0)', pointRadius: 0, showLine: true }, 我想要做的是给出一个任意数字,并让它greater than对数据执行检查以确定要切断的内容,而不是执行 afind然后切断数组中该索引之后的任何内容。我怎样才能做到这一点?
1 回答

慕斯王
TA贡献1864条经验 获得超2个赞
作为解决方案,我只是编写了一个函数来遍历数组并找到大于或等于我想要的值的第一个值,然后将 xAxes 的最小值设置为该值。不是很理想,但嘿,至少它有效。
我在文档中找不到关于最小值回调的任何内容。
添加回答
举报
0/150
提交
取消