chart.js

Chart.js yAxes Ticks stepSize not working (fiddle)

半世苍凉 提交于 2020-08-11 20:43:54
问题 I have created a line chart with these options for the yAxis: yAxes: [{ ticks: { precision: 1, stepSize: 18.1, min: 148.5, max: 220.9 } }] I would like, therefore, the yAxis scales to be like this: 220.9 202.8 184.7 166.6 148.5 However, when I provide this code, I am getting this data. Please see this fiddle for an example: https://jsfiddle.net/wxLzdrcm/ How can I make the yAxis ticks add up like I have described? 回答1: This question was asked at least twice (1, 2). The solution is to use min

Chart.js yAxes Ticks stepSize not working (fiddle)

巧了我就是萌 提交于 2020-08-11 20:38:06
问题 I have created a line chart with these options for the yAxis: yAxes: [{ ticks: { precision: 1, stepSize: 18.1, min: 148.5, max: 220.9 } }] I would like, therefore, the yAxis scales to be like this: 220.9 202.8 184.7 166.6 148.5 However, when I provide this code, I am getting this data. Please see this fiddle for an example: https://jsfiddle.net/wxLzdrcm/ How can I make the yAxis ticks add up like I have described? 回答1: This question was asked at least twice (1, 2). The solution is to use min

Auto-Remove old Datapoints in Chart.js

为君一笑 提交于 2020-08-10 18:17:05
问题 I have a Chart for Real time data, which is updated by Javascript. But if the script runs to long, the data is getting crammed up. The old Data would have to be shifted to the left side an then be deleted. Live Demo: https://codepen.io/benni_de/pen/ajGood Code: function reLoad() { adddata(Math.random() * 100, Math.random() * 10); setTimeout(reLoad, 1000); } var canvas = document.getElementById('myChart'); var data = { datasets: [{ label: 'Download', borderColor: 'rgb(237, 18, 237)', fill:

Chart JS Zoom Pan

被刻印的时光 ゝ 提交于 2020-08-09 17:24:28
问题 I am using the Chart JS Zoom/Pan Plugin (https://github.com/chartjs/chartjs-plugin-zoom) and was wondering if there is a way to disable it when there is no data present. The current basic options settings are pan: { enabled: true, mode: 'x' }, zoom: { enabled: true, mode: 'x' } 回答1: Yes, you can change this by setting "enabled" to false and/or use chart.resetZoom() link 回答2: Try this: // since myChart.update() is not working. You need to do this. var myChartOptions = myChart.options; // need

How update option without reload chart (ng2-chart)

前提是你 提交于 2020-08-08 05:54:54
问题 I need to update option in the chart and I need to show the chart with new option. I WANT that the chart IS NOT RELOAD this is my ts. @ViewChild(BaseChartDirective) chart: any; lineChartOptions: any = { responsive: true, zoom:{ // Boolean to enable zooming enabled: false, sensitivity: 0.5, // Enable drag-to-zoom behavior drag: true, // Zooming directions. Remove the appropriate direction to disable // Eg. 'y' would only allow zooming in the y direction mode: 'xy', rangeMin: { // Format of min

Set Animation speed - ChartJS?

断了今生、忘了曾经 提交于 2020-08-06 14:24:20
问题 I am trying to set the animation speed of a pie chart in chartJS. I've tried the following: numSteps: Number, animationSteps: Number 3.Chart.defaults.global.animationSteps = Number; None of these have changed the speed. Any advice? var myNewChart; var data = [ { value: 30, label: "hello", color: "#F7464A" }, { value: 50, color: "#E2EAE9" }, { value: 100, color: "#D4CCC5" }, { value: 40, color: "#949FB1" }, { value: 100, color: "#4D5360" }, ]; var options = { animation: true, animationEasing: