Libraryless. Click here for Pure Java version (3507L/19K).
1 | static BufferedImage simpleGraph(int w, int h, IF1<Int, Double> f, double fMin, double fMax) { |
2 | BufferedImage graph = whiteImage(w, h); |
3 | double graphScale = doubleRatio(1, fMax); |
4 | int zeroY = iround(transformBetweenDoubleRanges(0, doubleRange(fMin, fMax), doubleRange(h-1, 0))); |
5 | for (int x = 0; x < w; x++) |
6 | drawLine(graph, x, zeroY, x, |
7 | iround(transformBetweenDoubleRanges(f.get(x), doubleRange(fMin, fMax), doubleRange(h-1, 0))), Color.red); |
8 | ret graph; |
9 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1031944 |
Snippet name: | simpleGraph |
Eternal ID of this version: | #1031944/3 |
Text MD5: | 6625b74f0c12693d36bdfe62606be837 |
Transpilation MD5: | 41c9b4ae02d9490767999eb021e2883b |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-03 17:49:00 |
Source code size: | 481 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 195 / 248 |
Version history: | 2 change(s) |
Referenced in: | [show references] |