Package com.xeiam.xchart

Examples of com.xeiam.xchart.Chart


  @Override
  public Chart getChart() {

    // Create Chart
    Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("Temperature vs. Color").xAxisTitle("Color").yAxisTitle("Temperature").theme(ChartTheme.GGPlot2).build();
    chart.addSeries("fish", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow" })), new ArrayList<Number>(Arrays.asList(new Number[] { -40, 30, 20, 60 })));
    chart.addSeries("worms", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow" })), new ArrayList<Number>(Arrays.asList(new Number[] { 50, 10, -20, 40 })));

    return chart;
  }
View Full Code Here


  @Override
  public Chart getChart() {

    // Create Chart
    Chart chart = new ChartBuilder().chartType(ChartType.Area).width(800).height(600).title(getClass().getSimpleName()).xAxisTitle("X").yAxisTitle("Y").build();
    chart.addSeries("a", new double[] { 0, 3, 5, 7, 9 }, new double[] { -3, 5, 9, 6, 5 });
    chart.addSeries("b", new double[] { 0, 2, 4, 6, 9 }, new double[] { -1, 6, 4, 0, 4 });
    chart.addSeries("c", new double[] { 0, 1, 3, 8, 9 }, new double[] { -2, -1, 1, 0, 1 });

    // Customize Chart
    chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
    chart.getStyleManager().setAxisTitlesVisible(false);

    return chart;
  }
View Full Code Here

public class LineChart01 implements ExampleChart {

  public static void main(String[] args) {

    ExampleChart exampleChart = new LineChart01();
    Chart chart = exampleChart.getChart();
    new SwingWrapper(chart).displayChart();
  }
View Full Code Here

      xData.add(i);
      yData.add(Math.pow(10, i));
    }

    // Create Chart
    Chart chart = new ChartBuilder().width(800).height(600).build();

    // Customize Chart
    chart.getStyleManager().setChartTitleVisible(false);
    chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
    chart.getStyleManager().setYAxisLogarithmic(true);

    // Series
    chart.addSeries("10^x", xData, yData);

    return chart;
  }
View Full Code Here

public class DateChart01 implements ExampleChart {

  public static void main(String[] args) {

    ExampleChart exampleChart = new DateChart01();
    Chart chart = exampleChart.getChart();
    new SwingWrapper(chart).displayChart();
  }
View Full Code Here

public class BarChart02 implements ExampleChart {

  public static void main(String[] args) {

    ExampleChart exampleChart = new BarChart02();
    Chart chart = exampleChart.getChart();
    new SwingWrapper(chart).displayChart();
  }
View Full Code Here

  @Override
  public Chart getChart() {

    // Create Chart
    Chart chart = new ChartBuilder().width(800).height(600).title("Millisecond Scale").build();
    chart.getStyleManager().setLegendVisible(false);

    Random random = new Random();

    // generate data
    List<Date> xData = new ArrayList<Date>();
    List<Double> yData = new ArrayList<Double>();

    DateFormat sdf = new SimpleDateFormat("HH:mm:ss.S");
    Date date = null;
    for (int i = 1; i <= 14; i++) {

      try {
        date = sdf.parse("23:45:31." + (100 * i + random.nextInt(20)));
      } catch (ParseException e) {
        e.printStackTrace();
      }
      // System.out.println(date.getTime());
      // System.out.println(date.toString());
      xData.add(date);
      yData.add(Math.random() * i);
    }

    Series series = chart.addSeries("blah", xData, yData);
    series.setMarker(SeriesMarker.NONE);

    return chart;

  }
View Full Code Here

  @Override
  public Chart getChart() {

    // Create Chart
    Chart chart = new ChartBuilder().theme(ChartTheme.Matlab).chartType(ChartType.Bar).width(800).height(600).title("Units Sold Per Year").xAxisTitle("Year").yAxisTitle("Units Sold").build();

    List<Date> xData = new ArrayList<Date>();
    Collection<Number> yData = new ArrayList<Number>();

    Random random = new Random();
    DateFormat sdf = new SimpleDateFormat("yyyy");
    Date date = null;
    for (int i = 1; i <= 8; i++) {
      try {
        date = sdf.parse("" + (2000 + i));
      } catch (ParseException e) {
        e.printStackTrace();
      }
      xData.add(date);
      yData.add(-1 * 0.00000001 * ((random.nextInt(i) + 1)));
    }
    Series series = chart.addSeries("Model 77", xData, yData);
    series.setLineColor(SeriesColor.RED);
    chart.getStyleManager().setPlotGridLinesVisible(false);
    chart.getStyleManager().setBarFilled(false);

    return chart;
  }
View Full Code Here

public class BarChart04 implements ExampleChart {

  public static void main(String[] args) {

    ExampleChart exampleChart = new BarChart04();
    Chart chart = exampleChart.getChart();
    new SwingWrapper(chart).displayChart();
  }
View Full Code Here

  @Override
  public Chart getChart() {

    // Create Chart
    Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("XFactor vs. Age").xAxisTitle("Age").yAxisTitle("XFactor").build();
    chart.addSeries("female", new double[] { 10, 20, 30, 40, 50 }, new double[] { 50, 10, 20, 40, 35 });
    chart.addSeries("male", new double[] { 10, 20, 30, 40, 50 }, new double[] { 40, 30, 20, 0, 60 });

    chart.getStyleManager().setYAxisMin(5);
    chart.getStyleManager().setYAxisMax(70);

    return chart;
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchart.Chart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.