Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1031944 // simpleGraph

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3507L/19K).

static BufferedImage simpleGraph(int w, int h, IF1<Int, Double> f, double fMin, double fMax) {
  BufferedImage graph = whiteImage(w, h);
  double graphScale = doubleRatio(1, fMax);
  int zeroY = iround(transformBetweenDoubleRanges(0, doubleRange(fMin, fMax), doubleRange(h-1, 0)));
  for (int x = 0; x < w; x++)
    drawLine(graph, x, zeroY, x,
      iround(transformBetweenDoubleRanges(f.get(x), doubleRange(fMin, fMax), doubleRange(h-1, 0))), Color.red);
  ret graph;
}

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: 108 / 157
Version history: 2 change(s)
Referenced in: [show references]