Uses 180K of libraries. Click here for Pure Java version (817L/7K/21K).
1 | !759 |
2 | !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 java.awt.Color; |
9 | import java.awt.Shape; |
10 | |
11 | static S title = "Eleutheria's Popularity!", valuesTitle = "Woot?"; |
12 | |
13 | answer { |
14 | if "test chart" { |
15 | // Make values |
16 | |
17 | final int NUM_POINTS = 25; |
18 | final double[] values = new double[NUM_POINTS]; |
19 | for (int i = 0; i < NUM_POINTS; i++) |
20 | values[i] = (Math.cos(30*i*Math.PI/180)*10 + 50)*i/20; |
21 | |
22 | Line line1 = Plots.newLine(Data.newData(values), com.googlecode.charts4j.Color.newColor("CA3D05"), valuesTitle); |
23 | line1.setLineStyle(LineStyle.newLineStyle(3, 1, 0)); |
24 | line1.addShapeMarkers(DIAMOND, newColor("CA3D05"), 12); |
25 | line1.addShapeMarkers(DIAMOND, WHITE, 8); |
26 | |
27 | // Defining chart. |
28 | LineChart chart = GCharts.newLineChart(line1); |
29 | chart.setSize(600, 450); |
30 | chart.setTitle(title, WHITE, 14); |
31 | chart.addHorizontalRangeMarker(40, 60, newColor(RED, 30)); |
32 | chart.addVerticalRangeMarker(70, 90, newColor(GREEN, 30)); |
33 | chart.setGrid(25, 25, 3, 2); |
34 | |
35 | // Defining axis info and styles |
36 | |
37 | AxisStyle axisStyle = AxisStyle.newAxisStyle(WHITE, 12, AxisTextAlignment.CENTER); |
38 | AxisLabels xAxis = AxisLabelsFactory.newAxisLabels("Nov", "Dec", "Jan", "Feb", "Mar"); |
39 | xAxis.setAxisStyle(axisStyle); |
40 | AxisLabels xAxis2 = AxisLabelsFactory.newAxisLabels("2007", "2007", "2008", "2008", "2008"); |
41 | xAxis2.setAxisStyle(axisStyle); |
42 | AxisLabels yAxis = AxisLabelsFactory.newAxisLabels("", "25", "50", "75", "100"); |
43 | AxisLabels xAxis3 = AxisLabelsFactory.newAxisLabels("Month", 50.0); |
44 | xAxis3.setAxisStyle(AxisStyle.newAxisStyle(WHITE, 14, AxisTextAlignment.CENTER)); |
45 | yAxis.setAxisStyle(axisStyle); |
46 | AxisLabels yAxis2 = AxisLabelsFactory.newAxisLabels("Hits", 50.0); |
47 | yAxis2.setAxisStyle(AxisStyle.newAxisStyle(WHITE, 14, AxisTextAlignment.CENTER)); |
48 | yAxis2.setAxisStyle(axisStyle); |
49 | |
50 | // Adding axis info to chart. |
51 | |
52 | chart.addXAxisLabels(xAxis); |
53 | chart.addXAxisLabels(xAxis2); |
54 | chart.addXAxisLabels(xAxis3); |
55 | chart.addYAxisLabels(yAxis); |
56 | chart.addYAxisLabels(yAxis2); |
57 | |
58 | // Defining background and chart fills. |
59 | |
60 | chart.setBackgroundFill(Fills.newSolidFill(newColor("1F1D1D"))); |
61 | LinearGradientFill fill = Fills.newLinearGradientFill(0, newColor("363433"), 100); |
62 | fill.addColorAndOffset(newColor("2E2B2A"), 0); |
63 | chart.setAreaFill(fill); |
64 | |
65 | String url = chart.toURLString(); |
66 | ret "Lookie here: " + url; |
67 | } |
68 | } |
Began life as a copy of #1002469
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002471 |
Snippet name: | Charts Bot (test) |
Eternal ID of this version: | #1002471/1 |
Text MD5: | 8667d56c0c3a0f1ca245c076468b90e4 |
Transpilation MD5: | 4cb089692a38825752246a67808ee8aa |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-01-25 03:21:00 |
Source code size: | 2670 bytes / 68 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 694 / 1237 |
Referenced in: | [show references] |