• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XYSeries类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.knowm.xchart.XYSeries的典型用法代码示例。如果您正苦于以下问题:Java XYSeries类的具体用法?Java XYSeries怎么用?Java XYSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XYSeries类属于org.knowm.xchart包,在下文中一共展示了XYSeries类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: show

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
public static void show(String chartTitle, NumericColumn xColumn, NumericColumn yColumn, ViewGroup group) {
    XYChart chart = new XYChart(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    chart.setTitle(chartTitle);
    chart.setXAxisTitle(xColumn.name());
    chart.setYAxisTitle(yColumn.name());
    chart.getStyler().setTheme(new TablesawTheme());

    chart.getStyler().setMarkerSize(5);

    chart.getStyler().setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter);

    for (TemporaryView view : group) {
        double[] xData = view.numericColumn(xColumn.name()).toDoubleArray();
        double[] yData = view.numericColumn(yColumn.name()).toDoubleArray();

        chart.addSeries(view.name(), Arrays.copyOf(xData, xData.length), Arrays.copyOf(yData, yData.length));
    }
    new SwingWrapper<>(chart).displayChart(WINDOW_TITLE);
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:20,代码来源:XchartScatter.java


示例2: plot99

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
private void plot99(List<Double> xData, List<Double> yData) throws IOException {
    XYChart chart = buildCommonChart();

    /*
     * This shows only the > 90 percentile, so set te minimum
     * accordingly.
     */

    chart.getStyler().setXAxisMin(99.0);

    // Series
    XYSeries series = chart.addSeries(chartProperties.getSeriesName(), xData, yData);

    series.setLineColor(XChartSeriesColors.BLUE);
    series.setMarkerColor(Color.LIGHT_GRAY);
    series.setMarker(SeriesMarkers.NONE);
    series.setLineStyle(SeriesLines.SOLID);

    BitmapEncoder.saveBitmap(chart, baseName + "_99.png", BitmapEncoder.BitmapFormat.PNG);
}
 
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:21,代码来源:HdrPlotter.java


示例3: plot90

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
private void plot90(List<Double> xData, List<Double> yData) throws IOException {
    XYChart chart = buildCommonChart();

    /*
     * This shows only the > 90 percentile, so set te minimum
     * accordingly.
     */

    chart.getStyler().setXAxisMin(90.0);

    // Series
    XYSeries series = chart.addSeries(chartProperties.getSeriesName(), xData, yData);

    series.setLineColor(XChartSeriesColors.BLUE);
    series.setMarkerColor(Color.LIGHT_GRAY);
    series.setMarker(SeriesMarkers.NONE);
    series.setLineStyle(SeriesLines.SOLID);

    BitmapEncoder.saveBitmap(chart, baseName + "_90.png", BitmapEncoder.BitmapFormat.PNG);
}
 
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:21,代码来源:HdrPlotter.java


示例4: plotAll

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
private void plotAll(List<Double> xData, List<Double> yData) throws IOException {

        // Create Chart
        XYChart chart = buildCommonChart();


         /*
         * This shows almost everything so set te minimum
         * accordingly.
         */
        chart.getStyler().setXAxisMin(5.0);

        // Series
        XYSeries series = chart.addSeries(chartProperties.getSeriesName(), xData, yData);

        series.setLineColor(XChartSeriesColors.BLUE);
        series.setMarkerColor(Color.LIGHT_GRAY);
        series.setMarker(SeriesMarkers.NONE);
        series.setLineStyle(SeriesLines.SOLID);

        BitmapEncoder.saveBitmap(chart, baseName + "_all.png", BitmapEncoder.BitmapFormat.PNG);
    }
 
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:23,代码来源:HdrPlotter.java


示例5: plot

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
/**
 * Plot a time series, connecting the observation times to the measurements.
 *
 * @param timeSeries the series to plot.
 * @param title      the title of the plot.
 * @param seriesName the name of the series to display.
 */
public static void plot(final TimeSeries timeSeries, final String title, final String seriesName) {
    Thread plotThread = new Thread(() -> {
        final List<Date> xAxis = new ArrayList<>(timeSeries.observationTimes().size());
        for (OffsetDateTime dateTime : timeSeries.observationTimes()) {
            xAxis.add(Date.from(dateTime.toInstant()));
        }
        List<Double> seriesList = Doubles.asList(round(timeSeries.asArray(), 2));
        final XYChart chart = new XYChartBuilder().theme(Styler.ChartTheme.GGPlot2)
                                                  .height(600)
                                                  .width(800)
                                                  .title(title)
                                                  .build();
        XYSeries residualSeries = chart.addSeries(seriesName, xAxis, seriesList);
        residualSeries.setXYSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter);
        residualSeries.setMarker(new Circle()).setMarkerColor(Color.RED);

        JPanel panel = new XChartPanel<>(chart);
        JFrame frame = new JFrame(title);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.add(panel);
        frame.pack();
        frame.setVisible(true);
    });
    plotThread.start();
}
 
开发者ID:signaflo,项目名称:java-timeseries,代码行数:33,代码来源:Plots.java


示例6: show

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
public static void show(String chartTitle, NumericColumn xColumn, NumericColumn yColumn, ViewGroup group) {
    XYChart chart = new XYChart(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    chart.setTitle(chartTitle);
    chart.setXAxisTitle(xColumn.name());
    chart.setYAxisTitle(yColumn.name());
    chart.getStyler().setTheme(new TablesawTheme());

    chart.getStyler().setMarkerSize(5);

    chart.getStyler().setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter);

    for (TemporaryView view : group) {
        double[] xData = view.numericColumn(xColumn.name()).toDoubleArray();
        double[] yData = view.numericColumn(yColumn.name()).toDoubleArray();
        chart.addSeries(view.name(), Arrays.copyOf(xData, xData.length), Arrays.copyOf(yData, yData.length));
    }
    new SwingWrapper<>(chart).displayChart(WINDOW_TITLE);
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:19,代码来源:XchartLine.java


示例7: main

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
public static void main(String[] args) {
	XYChart chart = new XYChartBuilder().width(800).height(600).build();

	// Customize Chart
	chart.getStyler().setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter);
	chart.getStyler().setChartTitleVisible(false);
	chart.getStyler().setLegendPosition(Styler.LegendPosition.InsideSW);
	chart.getStyler().setXAxisMax(5.0);
	chart.getStyler().setXAxisMin(-5.0);
	chart.getStyler().setYAxisMax(5.0);
	chart.getStyler().setYAxisMin(-5.0);
	chart.getStyler().setMarkerSize(2);

	// Series
	double[] xData = normal(0, 1, 1000);
	double[] yData = normal(0, 1, 1000);
	chart.addSeries("Gaussian Blob", xData, yData);
	new SwingWrapper<>(chart).displayChart();
}
 
开发者ID:parrt,项目名称:AniML,代码行数:20,代码来源:TestXChart.java


示例8: setFrontChart

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
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);
}
 
开发者ID:jMetal,项目名称:jMetal,代码行数:19,代码来源:ChartContainer.java


示例9: addIndicatorChart

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
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);
}
 
开发者ID:jMetal,项目名称:jMetal,代码行数:17,代码来源:ChartContainer.java


示例10: main

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
public static void main(String[] args) {
       int row=0;
        CSVReader fileReader = new CSVReader();
        try {
            fileReader.read(plotChanelArray);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        int numCharts = 4;

        List<XYChart> charts = new ArrayList<XYChart>();
double[] array = new double[22000];

        for (int i=0;i<21000;i++){
            array[i]=plotChanelArray[i][0];
        }




        for (int i = 0; i < numCharts; i++) {
            XYChart chart = new XYChartBuilder().xAxisTitle("X").yAxisTitle("Y").width(600).height(400).build();
            //chart.getStyler().setYAxisMin((double) -10);
           // chart.getStyler().setYAxisMax((double) 10);

            //XYSeries series = chart.addSeries("" + i, null, getRandomWalk(200));
            XYSeries series = chart.addSeries("" + i, null, array);

            series.setMarker(SeriesMarkers.NONE);
            charts.add(chart);
        }
        new SwingWrapper<XYChart>(charts).displayChartMatrix();
        //new ZoomManager(charts);
        final StackPane pane = new StackPane();
        pane.getChildren().add((Node) charts);
        final Scene scene = new Scene(pane, 500, 400);

    }
 
开发者ID:gransort,项目名称:Java-oscilloscope-project,代码行数:40,代码来源:Example2.java


示例11: afterReportInit

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
@Override
public void afterReportInit() throws JRScriptletException 
{
	try 
	{
	    XYChart xyChart = new XYChartBuilder()
	    		.width(515)
	    		.height(400)
	    		.title("Fruits Order")
	    		.xAxisTitle("Day of Week")
	    		.yAxisTitle("Quantity (t)")
	    		.build();

	    xyChart.addSeries("Apples", new double[] { 1, 3, 5}, new double[] {4, 10, 7});
	    xyChart.addSeries("Bananas", new double[] { 1, 2, 3, 4, 5}, new double[] {6, 8, 4, 4, 6});
	    xyChart.addSeries("Cherries", new double[] { 1, 3, 4, 5}, new double[] {2, 6, 1, 9});
	    XYStyler styler = xyChart.getStyler();
	    styler.setLegendPosition(Styler.LegendPosition.InsideNW);
	    styler.setAxisTitlesVisible(true);
	    styler.setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Area);
	    styler.setChartBackgroundColor(Color.WHITE);
	   
		BufferedImage bufferedImage = BitmapEncoder.getBufferedImage(xyChart);
		super.setVariableValue("ChartImage", bufferedImage);
	}
	catch(Exception e) 
	{
		throw new JRScriptletException(e);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:31,代码来源:XChartScriptlet.java


示例12: show

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
public static void show(String chartTitle, double[] xData, NumericColumn yColumn, int width, int height) {
    double[] yData = yColumn.toDoubleArray();

    // Create Chart
    XYChart chart = new XYChart(width, height);
    chart.setTitle(chartTitle);
    chart.setYAxisTitle(yColumn.name());
    chart.getStyler().setTheme(new TablesawTheme());
    chart.getStyler().setMarkerSize(2);
    chart.getStyler().setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter);

    XYSeries series = chart.addSeries("Ranked: " + yColumn.name(), xData, yData);
    series.setMarker(SeriesMarkers.CIRCLE);
    new SwingWrapper<>(chart).displayChart(WINDOW_TITLE);
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:16,代码来源:XchartQuantile.java


示例13: setReferencePoint

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
public void setReferencePoint(List<Double> referencePoint){
    double rp1 = referencePoint.get(this.objective1);
    double rp2 = referencePoint.get(this.objective2);
    XYSeries referencePointSeries = this.frontChart.addSeries("Reference Point ["+ rp1 + ", " + rp2 + "]",
                                                              new double[] { rp1 },
                                                              new double[] { rp2 });
    referencePointSeries.setMarkerColor(Color.green);
}
 
开发者ID:jMetal,项目名称:jMetal,代码行数:9,代码来源:ChartContainer.java


示例14: setVarChart

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
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);
}
 
开发者ID:jMetal,项目名称:jMetal,代码行数:16,代码来源:ChartContainer.java


示例15: displayFront

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
private void displayFront(String name, String fileName, int objective1, int objective2)
        throws FileNotFoundException {
    ArrayFront front = new ArrayFront(fileName);
    double[][] data = FrontUtils.convertFrontToArray(front);
    double[] xData = getObjectiveValues(data, objective1);
    double[] yData = getObjectiveValues(data, objective2);
    XYSeries referenceFront = this.frontChart.addSeries(name, xData, yData);
    referenceFront.setMarkerColor(Color.red);
}
 
开发者ID:jMetal,项目名称:jMetal,代码行数:10,代码来源:ChartContainer.java


示例16: copy

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
protected void copy(JRPrintImage image)
{
	dataset.finishDataset();
	
	JRComponentElement element = fillContext.getComponentElement();
	
    XYChart xyChart = new XYChartBuilder()
    		.width(element.getWidth())
    		.height(element.getHeight())
    		.title(chartTitle == null ? "" : chartTitle)
    		.xAxisTitle(xAxisTitle == null ? "" : xAxisTitle)
    		.yAxisTitle(yAxisTitle == null ? "" : yAxisTitle)
    		.build();
    XYStyler styler = xyChart.getStyler();
    styler.setLegendPosition(Styler.LegendPosition.InsideNE);
    styler.setAxisTitlesVisible(true);
    styler.setDefaultSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Area);
    styler.setChartBackgroundColor(element.getBackcolor() == null ? Color.WHITE : element.getBackcolor());
    
    List<Comparable<?>> xySeriesNames = dataset.getXYSeriesNames();
	Map<Comparable<?>, XYSeriesData> xySeriesMap = dataset.getXYSeriesMap();
	if(xySeriesMap != null && !xySeriesMap.isEmpty())
	{
		int i = 0;
		for(Comparable<?> name : xySeriesNames)
		{
			XYSeriesData data = xySeriesMap.get(name);
			org.knowm.xchart.XYSeries series = xyChart.addSeries(name.toString(), data.getXData(), data.getYData());
			Color color = data.getColor();
			if(color != null)
			{
				series.setLineColor(color);
				styler.getSeriesColors()[i] = color;
				//series.setFillColor(color);
			}
			i++;
		}
	}
	try
	{
		BufferedImage img = BitmapEncoder.getBufferedImage(xyChart);
		Renderable renderable = RendererUtil
				.getInstance(fillContext.getFiller().getJasperReportsContext())
				.getRenderable(img, ImageTypeEnum.PNG, OnErrorTypeEnum.ERROR);
		image.setRenderer(renderable);
	}
	catch(Exception e)
	{
		throw new JRRuntimeException(e);
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:52,代码来源:FillXYChart.java


示例17: plotAcf

import org.knowm.xchart.XYSeries; //导入依赖的package包/类
/**
 * Plot the sample autocorrelations of the given time series up to the given lag.
 *
 * @param timeSeries the series to plot.
 * @param k the maximum lag to include in the acf plot.
 */
public static void plotAcf(TimeSeries timeSeries, final int k) {
    final double[] acf = timeSeries.autoCorrelationUpToLag(k);
    final double[] lags = new double[k + 1];
    for (int i = 1; i < lags.length; i++) {
        lags[i] = i;
    }
    final double upper = (-1 / timeSeries.size()) + (2 / Math.sqrt(timeSeries.size()));
    final double lower = (-1 / timeSeries.size()) - (2 / Math.sqrt(timeSeries.size()));
    final double[] upperLine = new double[lags.length];
    final double[] lowerLine = new double[lags.length];
    for (int i = 0; i < lags.length; i++) {
        upperLine[i] = upper;
    }
    for (int i = 0; i < lags.length; i++) {
        lowerLine[i] = lower;
    }

    Thread plotThread = new Thread(() -> {
        XYChart chart = new XYChartBuilder().theme(Styler.ChartTheme.GGPlot2)
                                            .height(800)
                                            .width(1200)
                                            .title("Autocorrelations By Lag")
                                            .build();
        XYSeries series = chart.addSeries("Autocorrelation", lags, acf);
        XYSeries series2 = chart.addSeries("Upper Bound", lags, upperLine);
        XYSeries series3 = chart.addSeries("Lower Bound", lags, lowerLine);
        chart.getStyler()
             .setChartFontColor(Color.BLACK)
             .setSeriesColors(new Color[]{Color.BLACK, Color.BLUE, Color.BLUE});

        series.setXYSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Scatter);
        series2.setXYSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Line)
               .setMarker(SeriesMarkers.NONE)
               .setLineStyle(SeriesLines.DASH_DASH);
        series3.setXYSeriesRenderStyle(XYSeries.XYSeriesRenderStyle.Line)
               .setMarker(SeriesMarkers.NONE)
               .setLineStyle(SeriesLines.DASH_DASH);
        JPanel panel = new XChartPanel<>(chart);
        JFrame frame = new JFrame("Autocorrelation by Lag");
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.add(panel);
        frame.pack();
        frame.setVisible(true);
    });
    plotThread.start();
}
 
开发者ID:signaflo,项目名称:java-timeseries,代码行数:53,代码来源:Plots.java



注:本文中的org.knowm.xchart.XYSeries类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LoginBehavior类代码示例发布时间:2022-05-23
下一篇:
Java Properties类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap