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

cleaned up examples

parent 7f24cc91
No related branches found
No related tags found
No related merge requests found
Showing
with 31 additions and 120 deletions
......@@ -26,13 +26,20 @@ Now go ahead and [study some more examples](http://xeiam.com/xchart_examplecode.
## Features
* No additional dependencies
* ~50KB Jar
* ~85KB Jar
* Line charts
* Scatter charts
* Area Charts
* Bar Charts
* Error bars
* Date x-axis
* Logarithmic axes
* Date and category X-Axis
* Multiple series
* Extensive customization
* Themes
* Right-click, Save-As...
* User-defined axes range
* Custom legend placement
## Getting Started
### Non-Maven
......@@ -46,7 +53,7 @@ Add the XChart library as a dependency to your pom.xml file:
<dependency>
<groupId>com.xeiam.xchart</groupId>
<artifactId>xchart</artifactId>
<version>1.3.1</version>
<version>2.0.0</version>
</dependency>
For snapshots, add the following to your pom.xml file:
......@@ -60,7 +67,7 @@ For snapshots, add the following to your pom.xml file:
<dependency>
<groupId>com.xeiam</groupId>
<artifactId>xchart</artifactId>
<version>1.3.2-SNAPSHOT</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>
## Building
......@@ -69,7 +76,7 @@ mvn javadoc:aggregate
## Running Demo
cd /path/to/xchart-demo/jar/
java -cp xchart-demo-1.3.1.jar:xchart-1.3.1.jar com.xeiam.xchart.demo.XChartDemo
java -cp xchart-demo-2.0.0.jar:xchart-2.0.0.jar com.xeiam.xchart.demo.XChartDemo
## Bugs
Please report any bugs or submit feature requests to [XChart's Github issue tracker](https://github.com/timmolter/XChart/issues).
......
......@@ -23,9 +23,13 @@ import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* 3-Series
*
* @author timmolter
* Area Chart with 3 series
* <p>
* Demonstrates the following:
* <ul>
* <li>Area Chart
* <li>Place legend at Inside-NW position
* <li>ChartBuilder
*/
public class AreaChart01 implements ExampleChart {
......
......@@ -26,12 +26,13 @@ import java.util.Arrays;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.ChartBuilder;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.StyleManager.ChartTheme;
import com.xeiam.xchart.StyleManager.ChartType;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* Multiple series Bar Chart
* <p>
* Demonstrates the following:
* <ul>
......
......@@ -30,8 +30,6 @@ import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* Second Scale
*
* @author timmolter
*/
public class DateChart02 implements ExampleChart {
......
......@@ -30,8 +30,6 @@ import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* Minute Scale
*
* @author timmolter
*/
public class DateChart03 implements ExampleChart {
......
......@@ -30,8 +30,6 @@ import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* Hour Scale
*
* @author timmolter
*/
public class DateChart04 implements ExampleChart {
......
......@@ -30,8 +30,6 @@ import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* Day Scale
*
* @author timmolter
*/
public class DateChart05 implements ExampleChart {
......
......@@ -30,8 +30,6 @@ import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* Month scale
*
* @author timmolter
*/
public class DateChart06 implements ExampleChart {
......
......@@ -30,8 +30,6 @@ import com.xeiam.xchart.demo.charts.ExampleChart;
/**
* Year scale
*
* @author timmolter
*/
public class DateChart07 implements ExampleChart {
......
......@@ -20,9 +20,9 @@ import java.util.List;
import java.util.Random;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.StyleManager.ChartType;
import com.xeiam.xchart.StyleManager.LegendPosition;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.demo.charts.ExampleChart;
/**
......@@ -58,6 +58,7 @@ public class ScatterChart01 implements ExampleChart {
// Customize Chart
chart.getStyleManager().setChartTitleVisible(false);
chart.getStyleManager().setLegendPosition(LegendPosition.InsideSW);
// Series
chart.addSeries("Gaussian Blob", xData, yData);
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.chart;
package com.xeiam.xchart.standalone;
import com.xeiam.xchart.BitmapEncoder;
import com.xeiam.xchart.Chart;
......@@ -21,9 +21,7 @@ import com.xeiam.xchart.QuickChart;
import com.xeiam.xchart.SwingWrapper;
/**
* Creates a simple Chart using {@link com.xeiam.xchart.QuickChart}
*
* @author timmolter
* Creates a simple Chart using QuickChart
*/
public class Example0 {
......
......@@ -13,15 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.chart;
package com.xeiam.xchart.standalone;
import com.xeiam.xchart.BitmapEncoder;
import com.xeiam.xchart.Chart;
/**
* Creates a simple Chart and saves it as a PNG and JPEG image file.
*
* @author timmolter
*/
public class Example1 {
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.chart;
package com.xeiam.xchart.standalone;
import java.util.ArrayList;
import java.util.List;
......
......@@ -19,7 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.xeiam.xchart.unit;
package com.xeiam.xchart;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
......
......@@ -19,7 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.xeiam.xchart.unit;
package com.xeiam.xchart;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
......
......@@ -19,7 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.xeiam.xchart.unit;
package com.xeiam.xchart;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
......
......@@ -19,7 +19,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.xeiam.xchart.unit;
package com.xeiam.xchart;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
......
/**
* Copyright 2011-2013 Xeiam LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.chart;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.SwingWrapper;
/**
* Vertical and horizontal lines
*
* @author timmolter
*/
public class LineChart05 {
public static void main(String[] args) {
// Create Chart
Chart chart = new Chart(800, 600);
// Customize Chart
chart.setChartTitle("LineChart05");
chart.setXAxisTitle("X");
chart.setYAxisTitle("Y");
chart.addSeries("vertical", new double[] { 1, 1 }, new double[] { -10, 10 });
chart.addSeries("horizontal", new double[] { -10, 10 }, new double[] { 0, 0 });
new SwingWrapper(chart).displayChart();
}
}
/**
* Copyright 2011-2013 Xeiam LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.chart;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.SwingWrapper;
/**
* Single point
*
* @author timmolter
*/
public class LineChart06 {
public static void main(String[] args) {
// Create Chart
Chart chart = new Chart(800, 600);
// Customize Chart
chart.setChartTitle("LineChart06");
chart.setXAxisTitle("X");
chart.setYAxisTitle("Y");
chart.addSeries("single point (1,1)", new double[] { 1 }, new double[] { 1 });
new SwingWrapper(chart).displayChart();
}
}
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