public XChartPanel<XYChart> buildPanel() throws IOException { System.out.println("fetching data..."); updateData(); // create chart chart = new XYChartBuilder() .width(800) .height(400) .title("Real-time Bitcoinium Order Book - BITSTAMP_BTC_USD") .xAxisTitle("BTC") .yAxisTitle("USD") .build(); // Customize Chart chart.getStyler().setLegendPosition(LegendPosition.InsideNE); chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Area); // add series XYSeries series = chart.addSeries(BIDS_SERIES_NAME, xAxisBidData, yAxisBidData); series.setMarker(SeriesMarkers.NONE); series = chart.addSeries(ASKS_SERIES_NAME, xAxisAskData, yAxisAskData); series.setMarker(SeriesMarkers.NONE); return new XChartPanel<>(chart); }
th2Data.add((1.1 * i) * (1.1 * i)); XYChart c = new XYChartBuilder().title("Test Data").xAxisTitle("Time").build(); c.setYAxisGroupTitle(0, "A"); c.setYAxisGroupTitle(1, "B");
public static void main(String[] args) throws IOException { final XYChart chart = new XYChartBuilder().build(); final double[] x = {1, 2, 3}; // final double[] y = { 40.16064257028113, 40.16064257028115, Double.NaN }; // final double[] y = { 40.16064257028113, 40.16064257028115, Double.NEGATIVE_INFINITY }; // final double[] y = { 40.16064257028113, 40.16064257028115, Double.POSITIVE_INFINITY }; // final double[] y = { 40.16064257028113, 40.16064257028115, -Double.MAX_VALUE + 1e308 }; final double[] y = {40.16064257028113, 40.16064257028115, -1 * Double.MAX_VALUE}; chart.addSeries("Values", x, y); new SwingWrapper(chart).displayChart(); } }
public void setVarChart(int variable1, int variable2) { this.variable1 = variable1; this.variable2 = variable2; this.varChart = new XYChartBuilder().xAxisTitle("Variable " + this.variable1) .yAxisTitle("Variable " + this.variable2).build(); this.varChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5); double[] xData = new double[] { 0 }; double[] yData = new double[] { 0 }; XYSeries varChartSeries = this.varChart.addSeries(this.name, xData, yData); varChartSeries.setMarkerColor(Color.blue); this.charts.put("VAR", this.varChart); }
new XYChartBuilder() .width(800) .height(600) .title("Real-time Bitstamp Price vs. Time") .xAxisTitle("Time") .yAxisTitle("Price") .build();
public static void main(String[] args) { // Create Chart XYChart chart = new XYChartBuilder().width(600).height(400).build(); // Customize Chart // Series double[] xData1 = new double[] {0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15}; double[] yData1 = new double[] {106, 44, 26, 10, 11, 19, 25, Double.NaN, 30, 21, 36, 32, 30}; double[] xData2 = new double[] {6, 7, 8, 9, 10, 11}; double[] yData2 = new double[] {25, 54, 43, 56, 33, 30}; chart.addSeries("A", xData1, yData1); chart.addSeries("B", xData2, yData2); new SwingWrapper<XYChart>(chart).displayChart(); } }
public void addIndicatorChart(String indicator) { XYChart indicatorChart = new XYChartBuilder().xAxisTitle("n").yAxisTitle(indicator).build(); indicatorChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5); List<Integer> indicatorIterations = new ArrayList<Integer>(); indicatorIterations.add(0); List<Double> indicatorValues = new ArrayList<Double>(); indicatorValues.add(0.0); XYSeries indicatorSeries = indicatorChart.addSeries(this.name, indicatorIterations, indicatorValues); indicatorSeries.setMarkerColor(Color.blue); this.iterations.put(indicator, indicatorIterations); this.indicatorValues.put(indicator, indicatorValues); this.charts.put(indicator, indicatorChart); }
new XYChartBuilder() .width(800) .height(600) .title("Mercado Order Book") .xAxisTitle("BTC") .yAxisTitle("BRL") .build();
XYChart chart = new XYChartBuilder().width(800).height(600).title("Year Scale").build();
public void setFrontChart(int objective1, int objective2, String referenceFrontFileName) throws FileNotFoundException { this.objective1 = objective1; this.objective2 = objective2; this.frontChart = new XYChartBuilder().xAxisTitle("Objective " + this.objective1) .yAxisTitle("Objective " + this.objective2).build(); this.frontChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5); if (referenceFrontFileName != null) { this.displayReferenceFront(referenceFrontFileName); } double[] xData = new double[] { 0 }; double[] yData = new double[] { 0 }; XYSeries frontChartSeries = this.frontChart.addSeries(this.name, xData, yData); frontChartSeries.setMarkerColor(Color.blue); this.charts.put("Front", this.frontChart); }
new XYChartBuilder() .width(800) .height(600) .title("Bitstamp Price vs. Date") .xAxisTitle("Date") .yAxisTitle("Price") .build();
XYChart chart = new XYChartBuilder().width(800).height(600).title("Day Scale").build();
public void setFrontChart(int objective1, int objective2, String referenceFrontFileName) throws FileNotFoundException { this.objective1 = objective1; this.objective2 = objective2; this.frontChart = new XYChartBuilder().xAxisTitle("Objective " + this.objective1) .yAxisTitle("Objective " + this.objective2).build(); this.frontChart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter).setMarkerSize(5); if (referenceFrontFileName != null) { this.displayReferenceFront(referenceFrontFileName); } double[] xData = new double[] { 0 }; double[] yData = new double[] { 0 }; XYSeries frontChartSeries = this.frontChart.addSeries(this.name, xData, yData); frontChartSeries.setMarkerColor(Color.blue); this.charts.put("Front", this.frontChart); }
new XYChartBuilder() .width(800) .height(600) .title("Bitstamp Order Book") .xAxisTitle("BTC") .yAxisTitle("EUR") .build();
XYChart chart = new XYChartBuilder().width(800).height(600).title("Month Scale").build();
/** * Plot a data set. This method will produce a scatter plot of the data values against the integers * from 0 to n - 1, where n is the size of the data set. * * @param dataSet the data set to plot. */ public static void plot(final DataSet dataSet) { Thread plotThread = new Thread(() -> { final double[] indices = new double[dataSet.size()]; for (int i = 0; i < indices.length; i++) { indices[i] = i; } XYChart chart = new XYChartBuilder().theme(Styler.ChartTheme.GGPlot2). title("Scatter Plot").xAxisTitle("Index").yAxisTitle("Values").build(); chart.getStyler().setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter). setChartFontColor(Color.BLACK).setSeriesColors(new Color[]{Color.BLUE}); chart.addSeries("com/github/signaflo/data", indices, dataSet.asArray()); JPanel panel = new XChartPanel<>(chart); JFrame frame = new JFrame("Data Set"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(panel); frame.pack(); frame.setVisible(true); }); plotThread.start(); }
new XYChartBuilder() .width(800) .height(600) .title("Cryptopia Order Book") .xAxisTitle("BTC") .yAxisTitle("ETH") .build();
@Override public XYChart getChart() { // Create Chart XYChart chart = new XYChartBuilder().width(800).height(600).title("Logarithmic Data").build(); // Customize Chart chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Scatter); chart.getStyler().setXAxisLogarithmic(true); chart.getStyler().setLegendPosition(LegendPosition.InsideN); // Series List<Double> xData = new ArrayList<Double>(); List<Double> yData = new ArrayList<Double>(); Random random = new Random(); int size = 400; for (int i = 0; i < size; i++) { double nextRandom = random.nextDouble(); xData.add(Math.pow(10, nextRandom * 10)); yData.add(1000000000.0 + nextRandom); } chart.addSeries("logarithmic data", xData, yData); return chart; } }
private static XYChart getChart(String title, EvaluationReport er) { // Create Chart XYChart chart = new XYChartBuilder().title("Performance").xAxisTitle("Evaluation").yAxisTitle("Value").build(); // Customize Chart chart.getStyler().setLegendPosition(LegendPosition.OutsideS); chart.getStyler().setDefaultSeriesRenderStyle(XYSeriesRenderStyle.Line); chart.getStyler().setYAxisLabelAlignment(Styler.TextAlignment.Right); chart.getStyler().setPlotMargin(0); chart.getStyler().setPlotContentSize(.95); String[] labels = er.getSeriesLabels(); int lines = labels.length; int lineSize = er.getSeries(labels[0]).size(); double[] xAges = new double[lineSize]; for(int i=0; i<lineSize; i++) xAges[i] = i; for( int l=0; l<lines; l++) { Double[] line = er.getSeries(labels[l]).toArray(new Double[0]); chart.addSeries(labels[l], xAges, ArrayUtils.toPrimitive(line)); } return chart; }