Skip to content
Snippets Groups Projects
Commit ce7abcb7 authored by Tim Molter's avatar Tim Molter
Browse files

Roughed in 3.0.0

parent d2973bc3
No related branches found
No related tags found
No related merge requests found
Showing
with 137 additions and 134 deletions
Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
Licensed under the Apache License, Version 2.0 (the "License");
......
......@@ -109,7 +109,7 @@ For snapshots, add the following to your pom.xml file:
<dependency>
<groupId>org.knowm.xchart</groupId>
<artifactId>xchart</artifactId>
<version>2.7.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
```
......
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.knowm.xchart</groupId>
<artifactId>xchart-parent</artifactId>
<version>2.7.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>XChart Parent</name>
<description>XChart is a light weight Java library for plotting data.</description>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.knowm.xchart</groupId>
<artifactId>xchart-parent</artifactId>
<version>2.6.2-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>xchart-demo</artifactId>
......@@ -17,7 +17,7 @@
<dependency>
<groupId>org.knowm.xchart</groupId>
<artifactId>xchart</artifactId>
<version>2.6.2-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -16,7 +16,7 @@
*/
package org.knowm.xchart.demo;
import org.knowm.xchart.Chart;
import org.knowm.xchart.internal.chartpart.Chart;
/**
* @author timmolter
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -16,10 +16,10 @@
*/
package org.knowm.xchart.demo.charts;
import org.knowm.xchart.Chart;
import org.knowm.xchart.internal.chartpart.Chart;
public interface ExampleChart {
public interface ExampleChart<C extends Chart> {
public Chart getChart();
public C getChart();
}
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -16,12 +16,13 @@
*/
package org.knowm.xchart.demo.charts.area;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.ChartBuilderXY;
import org.knowm.xchart.Chart_XY;
import org.knowm.xchart.Series_XY.ChartXYSeriesRenderStyle;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Area Chart with 3 series
......@@ -29,7 +30,7 @@ import org.knowm.xchart.demo.charts.ExampleChart;
* Demonstrates the following:
* <ul>
* <li>Area Chart
* <li>Place legend at Inside-NW position
* <li>Place legend at Inside-NE position
* <li>ChartBuilder
*/
public class AreaChart01 implements ExampleChart {
......@@ -45,15 +46,15 @@ public class AreaChart01 implements ExampleChart {
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_XY chart = new ChartBuilderXY().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().setLegendPosition(LegendPosition.InsideNE);
chart.getStyleManager().setAxisTitlesVisible(false);
chart.getStyleManager().setChartXYSeriesRenderStyle(ChartXYSeriesRenderStyle.Area);
return chart;
}
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -19,12 +19,13 @@ package org.knowm.xchart.demo.charts.area;
import java.util.ArrayList;
import java.util.List;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.ChartBuilderXY;
import org.knowm.xchart.Chart_XY;
import org.knowm.xchart.Series_XY.ChartXYSeriesRenderStyle;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Null Y-Axis Data Points
......@@ -48,7 +49,7 @@ public class AreaChart02 implements ExampleChart {
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_XY chart = new ChartBuilderXY().width(800).height(600).title(getClass().getSimpleName()).xAxisTitle("X").yAxisTitle("Y").build();
List<Integer> xData = new ArrayList<Integer>();
List<Integer> yData = new ArrayList<Integer>();
......@@ -73,6 +74,7 @@ public class AreaChart02 implements ExampleChart {
chart.addSeries("a", xData, yData);
// Customize Chart
chart.getStyleManager().setChartXYSeriesRenderStyle(ChartXYSeriesRenderStyle.Area);
chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
return chart;
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -16,14 +16,15 @@
*/
package org.knowm.xchart.demo.charts.area;
import org.knowm.xchart.Chart;
import org.knowm.xchart.Series;
import org.knowm.xchart.Chart_XY;
import org.knowm.xchart.SeriesMarker;
import org.knowm.xchart.StyleManager;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.Series_XY;
import org.knowm.xchart.Series_XY.ChartXYSeriesRenderStyle;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Combination Line & Area Chart
......@@ -47,14 +48,14 @@ public class AreaLineChart03 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new Chart(800, 600);
Chart_XY chart = new Chart_XY(800, 600);
// Customize Chart
chart.setChartTitle(getClass().getSimpleName());
chart.setTitle(getClass().getSimpleName());
chart.setXAxisTitle("Age");
chart.setYAxisTitle("Amount");
chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
chart.getStyleManager().setChartType(ChartType.Line);
chart.getStyleManager().setChartXYSeriesRenderStyle(ChartXYSeriesRenderStyle.Line);
// @formatter:off
double[] xAges = new double[] { 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
......@@ -77,17 +78,17 @@ public class AreaLineChart03 implements ExampleChart {
565197, 496959, 421280, 358113, 276518, 195571, 109514, 13876, 29, 0, 0, 0, 0 };
// @formatter:on
Series seriesLiability = chart.addSeries("Liability", xAges, yLiability);
Series_XY seriesLiability = chart.addSeries("Liability", xAges, yLiability);
seriesLiability.setMarker(SeriesMarker.NONE);
seriesLiability.setSeriesType(Series.SeriesType.Area);
seriesLiability.setChartXYSeriesRenderStyle(Series_XY.ChartXYSeriesRenderStyle.Area);
Series seriesPercentile75th = chart.addSeries("75th Percentile", xAges, yPercentile75th);
Series_XY seriesPercentile75th = chart.addSeries("75th Percentile", xAges, yPercentile75th);
seriesPercentile75th.setMarker(SeriesMarker.NONE);
Series seriesPercentile50th = chart.addSeries("50th Percentile", xAges, yPercentile50th);
Series_XY seriesPercentile50th = chart.addSeries("50th Percentile", xAges, yPercentile50th);
seriesPercentile50th.setMarker(SeriesMarker.NONE);
Series seriesPercentile25th = chart.addSeries("25th Percentile", xAges, yPercentile25th);
Series_XY seriesPercentile25th = chart.addSeries("25th Percentile", xAges, yPercentile25th);
seriesPercentile25th.setMarker(SeriesMarker.NONE);
chart.getStyleManager().setYAxisLabelAlignment(StyleManager.TextAlignment.Right);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -18,19 +18,19 @@ package org.knowm.xchart.demo.charts.bar;
import java.util.Arrays;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Basic Bar Chart
* <p>
* Demonstrates the following:
* <ul>
* <li>Number categories
* <li>Integer categories as List
* <li>All positive values
* <li>Single series
* <li>Place legend at Inside-NW position
......@@ -48,8 +48,8 @@ public class BarChart01 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("Score Histogram").xAxisTitle("Score").yAxisTitle("Number").build();
chart.addCategorySeries("test 1", Arrays.asList(new Integer[] { 0, 1, 2, 3, 4 }), Arrays.asList(new Integer[] { 4, 5, 9, 6, 5 }));
Chart_Category chart = new ChartBuilder_Category().width(800).height(600).title("Score Histogram").xAxisTitle("Score").yAxisTitle("Number").build();
chart.addSeries("test 1", Arrays.asList(new Integer[] { 0, 1, 2, 3, 4 }), Arrays.asList(new Integer[] { 4, 5, 9, 6, 5 }));
// Customize Chart
chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -24,21 +24,21 @@ import java.util.Date;
import java.util.List;
import java.util.Random;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.Series;
import org.knowm.xchart.StyleManager.ChartTheme;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.Series_Category;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.MatlabTheme;
import org.knowm.xchart.internal.style.StyleManager.ChartTheme;
/**
* Date Categories
* <p>
* Demonstrates the following:
* <ul>
* <li>Date categories
* <li>Date categories as List
* <li>All negative values
* <li>Single series
* <li>No horizontal plot gridlines
......@@ -58,7 +58,7 @@ public class BarChart02 implements ExampleChart {
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();
Chart_Category chart = new ChartBuilder_Category().theme(ChartTheme.Matlab).width(800).height(600).title("Units Sold Per Year").xAxisTitle("Year").yAxisTitle("Units Sold").build();
List<Date> xData = new ArrayList<Date>();
List<Number> yData = new ArrayList<Number>();
......@@ -75,7 +75,7 @@ public class BarChart02 implements ExampleChart {
xData.add(date);
yData.add(-1 * 0.00000001 * ((random.nextInt(i) + 1)));
}
Series series = chart.addCategorySeries("Model 77", xData, yData);
Series_Category series = chart.addSeries("Model 77", xData, yData);
series.setLineColor(MatlabTheme.RED);
chart.getStyleManager().setPlotGridLinesVisible(false);
chart.getStyleManager().setBarFilled(false);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -16,20 +16,18 @@
*/
package org.knowm.xchart.demo.charts.bar;
import java.util.Arrays;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
/**
* Positive and Negative
* <p>
* Demonstrates the following:
* <ul>
* <li>Number categories
* <li>int categories as array
* <li>Positive and negative values
* <li>Single series
*/
......@@ -46,8 +44,8 @@ public class BarChart03 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("Score vs. Age").xAxisTitle("Age").yAxisTitle("Score").build();
chart.addCategorySeries("males", Arrays.asList(new Integer[] { 10, 20, 30, 40 }), Arrays.asList(new Integer[] { 40, -30, -20, -60 }));
Chart_Category chart = new ChartBuilder_Category().width(800).height(600).title("Score vs. Age").xAxisTitle("Age").yAxisTitle("Score").build();
chart.addSeries("males", new int[] { 10, 20, 30, 40 }, new int[] { 40, -30, -20, -60 });
return chart;
}
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -18,11 +18,11 @@ package org.knowm.xchart.demo.charts.bar;
import java.util.Arrays;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
/**
* Missing Point in Series
......@@ -48,9 +48,9 @@ public class BarChart04 implements ExampleChart {
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.addCategorySeries("female", Arrays.asList(new Integer[] { 10, 20, 30, 40, 50 }), Arrays.asList(new Integer[] { 50, 10, 20, 40, 35 }));
chart.addCategorySeries("male", Arrays.asList(new Integer[] { 10, 20, 30, 40, 50 }), Arrays.asList(new Integer[] { 40, 30, 20, null, 60 }));
Chart_Category chart = new ChartBuilder_Category().width(800).height(600).title("XFactor vs. Age").xAxisTitle("Age").yAxisTitle("XFactor").build();
chart.addSeries("female", Arrays.asList(new Integer[] { 10, 20, 30, 40, 50 }), Arrays.asList(new Integer[] { 50, 10, 20, 40, 35 }));
chart.addSeries("male", Arrays.asList(new Integer[] { 10, 20, 30, 40, 50 }), Arrays.asList(new Integer[] { 40, 30, 20, null, 60 }));
chart.getStyleManager().setYAxisMin(5);
chart.getStyleManager().setYAxisMax(70);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -19,12 +19,12 @@ package org.knowm.xchart.demo.charts.bar;
import java.util.ArrayList;
import java.util.Arrays;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.StyleManager.ChartTheme;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.ChartTheme;
/**
* GGPlot2 Theme
......@@ -48,17 +48,17 @@ public class BarChart05 implements ExampleChart {
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.addCategorySeries("fish", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { -40, 30, 20,
60, 60 })));
chart.addCategorySeries("worms", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { 50, 10, -20,
40, 60 })));
chart.addCategorySeries("birds", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { 13, 22, -23,
-34, 37 })));
chart.addCategorySeries("ants", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { 50, 57, -14,
-20, 31 })));
chart.addCategorySeries("slugs", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { -2, 29, 49,
-16, -43 })));
Chart_Category chart = new ChartBuilder_Category().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", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { -40, 30, 20, 60,
60 })));
chart.addSeries("worms", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { 50, 10, -20, 40,
60 })));
chart.addSeries("birds", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { 13, 22, -23, -34,
37 })));
chart.addSeries("ants", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { 50, 57, -14, -20,
31 })));
chart.addSeries("slugs", new ArrayList<String>(Arrays.asList(new String[] { "Blue", "Red", "Green", "Yellow", "Orange" })), new ArrayList<Number>(Arrays.asList(new Number[] { -2, 29, 49, -16,
-43 })));
return chart;
}
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.Histogram;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Histogram Overlapped
......@@ -49,12 +49,12 @@ public class BarChart06 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("Score Histogram").xAxisTitle("Mean").yAxisTitle("Count").build();
Chart_Category chart = new ChartBuilder_Category().width(800).height(600).title("Score Histogram").xAxisTitle("Mean").yAxisTitle("Count").build();
Histogram histogram1 = new Histogram(getGaussianData(10000), 30, -30, 30);
Histogram histogram2 = new Histogram(getGaussianData(5000), 30, -30, 30);
chart.addCategorySeries("histogram 1", histogram1.getxAxisData(), histogram1.getyAxisData());
chart.addCategorySeries("histogram 2", histogram2.getxAxisData(), histogram2.getyAxisData());
chart.addSeries("histogram 1", histogram1.getxAxisData(), histogram1.getyAxisData());
chart.addSeries("histogram 2", histogram2.getxAxisData(), histogram2.getyAxisData());
// Customize Chart
chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.Histogram;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Histogram Not Overlapped
......@@ -50,12 +50,12 @@ public class BarChart07 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("Score Histogram").xAxisTitle("Mean").yAxisTitle("Count").build();
Chart_Category chart = new ChartBuilder_Category().width(800).height(600).title("Score Histogram").xAxisTitle("Mean").yAxisTitle("Count").build();
Histogram histogram1 = new Histogram(getGaussianData(1000), 10, -30, 30);
chart.addCategorySeries("histogram 1", histogram1.getxAxisData(), histogram1.getyAxisData());
chart.addSeries("histogram 1", histogram1.getxAxisData(), histogram1.getyAxisData());
Histogram histogram2 = new Histogram(getGaussianData(1000), 10, -30, 30);
chart.addCategorySeries("histogram 2", histogram2.getxAxisData(), histogram2.getyAxisData());
chart.addSeries("histogram 2", histogram2.getxAxisData(), histogram2.getyAxisData());
// Customize Chart
chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.Histogram;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Histogram with Error Bars
......@@ -49,10 +49,10 @@ public class BarChart08 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("Histogram").xAxisTitle("Mean").yAxisTitle("Count").build();
Chart_Category chart = new ChartBuilder_Category().width(800).height(600).title("Histogram").xAxisTitle("Mean").yAxisTitle("Count").build();
Histogram histogram1 = new Histogram(getGaussianData(10000), 10, -10, 10);
chart.addCategorySeries("histogram", histogram1.getxAxisData(), histogram1.getyAxisData(), getFakeErrorData(histogram1.getxAxisData().size()));
chart.addSeries("histogram", histogram1.getxAxisData(), histogram1.getyAxisData(), getFakeErrorData(histogram1.getxAxisData().size()));
// Customize Chart
chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -19,15 +19,15 @@ package org.knowm.xchart.demo.charts.bar;
import java.util.ArrayList;
import java.util.Arrays;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.Series;
import org.knowm.xchart.Series.SeriesType;
import org.knowm.xchart.StyleManager.ChartTheme;
import org.knowm.xchart.StyleManager.ChartType;
import org.knowm.xchart.StyleManager.LegendPosition;
import org.knowm.xchart.ChartBuilder_Category;
import org.knowm.xchart.Chart_Category;
import org.knowm.xchart.Series_Category;
import org.knowm.xchart.Series_Category.ChartCategorySeriesRenderStyle;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
import org.knowm.xchart.internal.style.StyleManager.ChartTheme;
import org.knowm.xchart.internal.style.StyleManager.LegendPosition;
/**
* Category chart with Bar, Line and Scatter Series
......@@ -50,14 +50,14 @@ public class BarChart09 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).title("Value vs. Letter").xAxisTitle("Letter").yAxisTitle("Value").theme(ChartTheme.GGPlot2).build();
chart.addCategorySeries("China", new ArrayList<String>(Arrays.asList(new String[] { "A", "B", "C", "D", "E" })), new ArrayList<Number>(Arrays.asList(new Number[] { 11, 23, 20, 36, 5 })));
Series series2 = chart.addCategorySeries("Korea", new ArrayList<String>(Arrays.asList(new String[] { "A", "B", "C", "D", "E" })), new ArrayList<Number>(Arrays.asList(new Number[] { 13, 25, 22, 38,
7 })), new ArrayList<Number>(Arrays.asList(new Number[] { 1, 3, 2, 1, 2 })));
series2.setSeriesType(SeriesType.Line);
Series series3 = chart.addCategorySeries("World Ave.", new ArrayList<String>(Arrays.asList(new String[] { "A", "B", "C", "D", "E" })), new ArrayList<Number>(Arrays.asList(new Number[] { 20, 22,
Chart_Category chart = new ChartBuilder_Category().width(800).height(600).title("Value vs. Letter").xAxisTitle("Letter").yAxisTitle("Value").theme(ChartTheme.GGPlot2).build();
chart.addSeries("China", new ArrayList<String>(Arrays.asList(new String[] { "A", "B", "C", "D", "E" })), new ArrayList<Number>(Arrays.asList(new Number[] { 11, 23, 20, 36, 5 })));
Series_Category series2 = chart.addSeries("Korea", new ArrayList<String>(Arrays.asList(new String[] { "A", "B", "C", "D", "E" })), new ArrayList<Number>(Arrays.asList(new Number[] { 13, 25, 22,
38, 7 })), new ArrayList<Number>(Arrays.asList(new Number[] { 1, 3, 2, 1, 2 })));
series2.setChartCategorySeriesRenderStyle(ChartCategorySeriesRenderStyle.Line);
Series_Category series3 = chart.addSeries("World Ave.", new ArrayList<String>(Arrays.asList(new String[] { "A", "B", "C", "D", "E" })), new ArrayList<Number>(Arrays.asList(new Number[] { 20, 22,
18, 36, 32 })));
series3.setSeriesType(SeriesType.Scatter);
series3.setChartCategorySeriesRenderStyle(ChartCategorySeriesRenderStyle.Scatter);
// Customize Chart
chart.getStyleManager().setLegendPosition(LegendPosition.InsideNW);
......
/**
* Copyright 2015 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2015-2016 Knowm Inc. (http://knowm.org) and contributors.
* Copyright 2011-2015 Xeiam LLC (http://xeiam.com) and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -24,12 +24,13 @@ import java.util.Date;
import java.util.List;
import java.util.Random;
import org.knowm.xchart.Chart;
import org.knowm.xchart.ChartBuilder;
import org.knowm.xchart.Series;
import org.knowm.xchart.ChartBuilderXY;
import org.knowm.xchart.Chart_XY;
import org.knowm.xchart.SeriesMarker;
import org.knowm.xchart.Series_XY;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.demo.charts.ExampleChart;
import org.knowm.xchart.internal.chartpart.Chart;
/**
* Millisecond Scale
......@@ -52,7 +53,7 @@ public class DateChart01 implements ExampleChart {
public Chart getChart() {
// Create Chart
Chart chart = new ChartBuilder().width(800).height(600).title("Millisecond Scale").build();
Chart_XY chart = new ChartBuilderXY().width(800).height(600).title("Millisecond Scale").build();
chart.getStyleManager().setLegendVisible(false);
Random random = new Random();
......@@ -76,7 +77,7 @@ public class DateChart01 implements ExampleChart {
yData.add(Math.random() * i);
}
Series series = chart.addSeries("blah", xData, yData);
Series_XY series = chart.addSeries("blah", xData, yData);
series.setMarker(SeriesMarker.NONE);
return chart;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment