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

68
LINES

< > BotCompany Repo | #1002471 // Charts Bot (test)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 180K of libraries. Click here for Pure Java version (817L/7K/21K).

!759

!1001955 // charts4j

import com.googlecode.charts4j.*;
import static com.googlecode.charts4j.Color.*;
import static com.googlecode.charts4j.Shape.*;
import static com.googlecode.charts4j.UrlUtil.normalize;
import java.awt.Color;
import java.awt.Shape;

static S title = "Eleutheria's Popularity!", valuesTitle = "Woot?";

answer {
  if "test chart" {
    // Make values
    
    final int NUM_POINTS = 25;
    final double[] values = new double[NUM_POINTS];
    for (int i = 0; i < NUM_POINTS; i++)
        values[i] = (Math.cos(30*i*Math.PI/180)*10 + 50)*i/20;
        
    Line line1 = Plots.newLine(Data.newData(values), com.googlecode.charts4j.Color.newColor("CA3D05"), valuesTitle);
    line1.setLineStyle(LineStyle.newLineStyle(3, 1, 0));
    line1.addShapeMarkers(DIAMOND, newColor("CA3D05"), 12);
    line1.addShapeMarkers(DIAMOND, WHITE, 8);
    
    // Defining chart.
    LineChart chart = GCharts.newLineChart(line1);
    chart.setSize(600, 450);
    chart.setTitle(title, WHITE, 14);
    chart.addHorizontalRangeMarker(40, 60, newColor(RED, 30));
    chart.addVerticalRangeMarker(70, 90, newColor(GREEN, 30));
    chart.setGrid(25, 25, 3, 2);
  
    // Defining axis info and styles
    
    AxisStyle axisStyle = AxisStyle.newAxisStyle(WHITE, 12, AxisTextAlignment.CENTER);
    AxisLabels xAxis = AxisLabelsFactory.newAxisLabels("Nov", "Dec", "Jan", "Feb", "Mar");
    xAxis.setAxisStyle(axisStyle);
    AxisLabels xAxis2 = AxisLabelsFactory.newAxisLabels("2007", "2007", "2008", "2008", "2008");
    xAxis2.setAxisStyle(axisStyle);
    AxisLabels yAxis = AxisLabelsFactory.newAxisLabels("", "25", "50", "75", "100");
    AxisLabels xAxis3 = AxisLabelsFactory.newAxisLabels("Month", 50.0);
    xAxis3.setAxisStyle(AxisStyle.newAxisStyle(WHITE, 14, AxisTextAlignment.CENTER));
    yAxis.setAxisStyle(axisStyle);
    AxisLabels yAxis2 = AxisLabelsFactory.newAxisLabels("Hits", 50.0);
    yAxis2.setAxisStyle(AxisStyle.newAxisStyle(WHITE, 14, AxisTextAlignment.CENTER));
    yAxis2.setAxisStyle(axisStyle);
  
    // Adding axis info to chart.
    
    chart.addXAxisLabels(xAxis);
    chart.addXAxisLabels(xAxis2);
    chart.addXAxisLabels(xAxis3);
    chart.addYAxisLabels(yAxis);
    chart.addYAxisLabels(yAxis2);
  
    // Defining background and chart fills.
    
    chart.setBackgroundFill(Fills.newSolidFill(newColor("1F1D1D")));
    LinearGradientFill fill = Fills.newLinearGradientFill(0, newColor("363433"), 100);
    fill.addColorAndOffset(newColor("2E2B2A"), 0);
    chart.setAreaFill(fill);
    
    String url = chart.toURLString();
    ret "Lookie here: " + url;
  }
}

Author comment

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: 693 / 1235
Referenced in: #1002496 - Simple Charts Bot (LIVE)
#3000179 - Answer for stefanreich
#3000180 - Answer for stefanreich
#3000181 - Answer for stefanreich
#3000182 - Answer for stefanreich
#3000184 - Answer for stefanreich
#3000185 - Answer for stefanreich
#3000190 - Answer for stefanreich(>> t 20 questions)
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000203 - Answer for stefanreich (>> timing hello bot)
#3000208 - Answer for bgrgndz (>> list sub bots)
#3000209 - Answer for bgrgndz (>> list sub bots)
#3000238 - Answer for stefanreich (>> t power bot)
#3000369 - Answer for Stefan (>> list sub bots)
#3000376 - Answer for stefanreich (>> list sub bots)
#3000377 - Answer for stefanreich (>> timing eleu?)
#3000380 - Answer for stefanreich (>> list sub bots)
#3000381 - Answer for speedforce (>> list sub bots)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)