Uses 180K of libraries. Click here for Pure Java version (6826L/45K/154K).
1 | !7 |
2 | lib 1001955 // charts4j |
3 | |
4 | import com.googlecode.charts4j.*; |
5 | import static com.googlecode.charts4j.Color.*; |
6 | import static com.googlecode.charts4j.Shape.*; |
7 | import static com.googlecode.charts4j.UrlUtil.normalize; |
8 | import com.googlecode.charts4j.Color; |
9 | |
10 | p { |
11 | botIfMain(); |
12 | } |
13 | |
14 | answer { |
15 | if "cpu meter" exceptionToUser { |
16 | double percent = (double) call(getBot("#1001405"), "getInProcessCPU"); |
17 | GoogleOMeter chart = GCharts.newGoogleOMeter(percent, "Utilized", "In-Java CPU Percentage", Color.newColor("1148D4"), Color.newColor("5766DE"), Color.newColor("DB3270"), Color.newColor("D41111")); |
18 | chart.setTitle("Eleu CPU", BLACK, 14); |
19 | chart.setSize(400, 200); |
20 | final LinearGradientFill fill = Fills.newLinearGradientFill(0, BLUE, 100); |
21 | fill.addColorAndOffset(RED, 0); |
22 | chart.setBackgroundFill(fill); |
23 | chart.setAreaFill(Fills.newSolidFill(Color.newColor(GRAY, 70))); |
24 | String url = chart.toURLString(); |
25 | |
26 | ret returnImage(url); |
27 | } |
28 | } |
29 | |
30 | static S returnImage(S imageURL) { |
31 | // TODO: caching |
32 | /* |
33 | byte[] data = loadBinaryPage(imageURL); |
34 | S md5 = md5(data); |
35 | S fileName = "chart-" + md5 + ".png"; |
36 | saveBinaryFile(getProgramFile(fileName), data); |
37 | S newURL = "bots.tinybrain.de/" + getProgramID() + "/raw/" + fileName; |
38 | ret "Lookie here: " + newURL;*/ |
39 | |
40 | imageURL = urlShortener(imageURL); |
41 | ret "Lookie here: " + imageURL; |
42 | } |
Began life as a copy of #1002496
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, vpdwwinrgdga
No comments. add comment
Snippet ID: | #1002592 |
Snippet name: | Graphical CPU Meter (LIVE) |
Eternal ID of this version: | #1002592/2 |
Text MD5: | c046646ec27d7710efc56c108bb4bda0 |
Transpilation MD5: | 1667685ca4e7d33160e9330c7e9436dc |
Author: | stefan |
Category: | eleu |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-26 14:48:27 |
Source code size: | 1396 bytes / 42 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 706 / 1172 |
Version history: | 1 change(s) |
Referenced in: | [show references] |