]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Add min/max to performance documentation (#6785)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sat, 23 Nov 2019 22:39:12 +0000 (00:39 +0200)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 23 Nov 2019 22:39:12 +0000 (17:39 -0500)
* Add min/max to performance documentation

* Review1

* Review2

docs/general/performance.md

index a1b344a8766c87726900ed77d948d494ae5a62ac..9aba3175f67848d33a597bd7b6ae372b7dd852df 100644 (file)
@@ -34,6 +34,31 @@ new Chart(ctx, {
 });
 ```
 
+## Specify `min` and `max` for scales
+
+If you specify the `min` and `max`, the scale does not have to compute the range from the data.
+
+```javascript
+new Chart(ctx, {
+    type: 'line',
+    data: data,
+    options: {
+        scales: {
+            x: {
+                type: 'time',
+                min: new Date('2019-01-01').valueOf(),
+                max: new Date('2019-12-31').valueOf()
+            },
+            y: {
+                type: 'linear',
+                min: 0,
+                max: 100
+            }
+        }
+    }
+});
+```
+
 ## Data Decimation
 
 Decimating your data will achieve the best results. When there is a lot of data to display on the graph, it doesn't make sense to show tens of thousands of data points on a graph that is only a few hundred pixels wide.