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

Java XYChart类代码示例

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

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



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

示例1: plot99

import org.knowm.xchart.XYChart; //导入依赖的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


示例2: show

import org.knowm.xchart.XYChart; //导入依赖的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


示例3: plot90

import org.knowm.xchart.XYChart; //导入依赖的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.XYChart; //导入依赖的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.XYChart; //导入依赖的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.XYChart; //导入依赖的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.XYChart; //导入依赖的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: addIndicatorChart

import org.knowm.xchart.XYChart; //导入依赖的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


示例9: main

import org.knowm.xchart.XYChart; //导入依赖的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


示例10: saveChart

import org.knowm.xchart.XYChart; //导入依赖的package包/类
private void saveChart(XYChart chart, String filename) {
    try {
        String base = "src/test/charts";
        String fullPath = String.format("%s/%s", base, filename);
        File f = new File(fullPath);
        f.getParentFile().mkdirs();

        BitmapEncoder.saveBitmapWithDPI(chart, fullPath, BitmapEncoder.BitmapFormat.PNG, 300);
    }
    catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:supersede-project,项目名称:replan_optimizer_v2,代码行数:14,代码来源:AlgorithmPerformanceTest.java


示例11: AveragePlannedFeaturesTest

import org.knowm.xchart.XYChart; //导入依赖的package包/类
private void AveragePlannedFeaturesTest()
{
    NextReleaseProblem base = random.all(7, 20, 5, 4, 40.0);
    SolverNRP solver = new SolverNRP(SolverNRP.AlgorithmType.NSGAII);

    List<Integer> iterations = new ArrayList<>();
    List<Integer> nbPlannedFeatures = new ArrayList<>();

    int totalPlannedFeatures = 0;
    int nbIterations = 20;
    for (int i = 0; i < nbIterations; ++i) {

        NextReleaseProblem problem = new NextReleaseProblem(base);
        PlanningSolution solution = execute(problem, solver);

        iterations.add(i+1);
        nbPlannedFeatures.add(solution.getPlannedFeatures().size());

        totalPlannedFeatures += solution.getPlannedFeatures().size();
    }
    String title = String.format("Algorithm: %s. Test set: %s", solver.getAlgorithmType().getName(), "Random");
    XYChart chart = new XYChartBuilder().width(1024).height(512).title(title)
            .xAxisTitle("Iteration").yAxisTitle("Number of features planned").build();
    chart.addSeries("Number of planned features", iterations, nbPlannedFeatures);

    List<Double> average = new ArrayList<>();
    for (int i = 0; i < nbIterations; ++i)
        average.add((double) totalPlannedFeatures/nbIterations);

    chart.addSeries("Average planned features", iterations, average);
    chart.getStyler().setXAxisMin(0.0).setYAxisMin(0.0)
            .setXAxisMax((double) iterations.size()).setYAxisMax((double) base.getFeatures().size());

    saveChart(chart, String.format("AveragePlannedFeatures_%s_%s", algorithmName(solver), timestamp()));
}
 
开发者ID:supersede-project,项目名称:replan_optimizer_v2,代码行数:36,代码来源:AlgorithmPerformanceTest.java


示例12: populationSizeTest

import org.knowm.xchart.XYChart; //导入依赖的package包/类
public void populationSizeTest() {
    for (int k = 0; k < 5; ++k) {
        NextReleaseProblem base = random.all(7, 20, 5, 4, 40.0);
        SolverNRP solver = new SolverNRP(SolverNRP.AlgorithmType.NSGAII);

        List<Integer> populationSize = new ArrayList<>();
        List<Double> executionTime = new ArrayList<>();
        List<Integer> plannedFeatures = new ArrayList<>();
        for (int i = 0; i < 15; ++i) {
            AlgorithmParameters params = new AlgorithmParameters(SolverNRP.AlgorithmType.NSGAII);
            params.setPopulationSize(params.getPopulationSize() + ++i * 10);

            NextReleaseProblem problem = new NextReleaseProblem(base);
            problem.setAlgorithmParameters(params);

            long start = System.currentTimeMillis();
            PlanningSolution solution = execute(problem, solver);
            long elapsed = System.currentTimeMillis() - start;

            populationSize.add(params.getPopulationSize());
            executionTime.add(elapsed / 1000.0);
            plannedFeatures.add(solution.size());
        }

        XYChart chart = new XYChartBuilder().width(1024).height(512).title("Population/Performance chart")
                .xAxisTitle("Population size").build();
        chart.addSeries("Execution time (seconds)", populationSize, executionTime);
        chart.addSeries("Number of planned features", populationSize, plannedFeatures);

        saveChart(chart, String.format("PopulationSizeTest_%s_%s", algorithmName(solver), timestamp()));
    }
}
 
开发者ID:supersede-project,项目名称:replan_optimizer_v2,代码行数:33,代码来源:AlgorithmPerformanceTest.java


示例13: buildCommonChart

import org.knowm.xchart.XYChart; //导入依赖的package包/类
private XYChart buildCommonChart() {

        // Create Chart
        XYChart chart = new XYChartBuilder()
                .width(outputWidth)
                .height(outputHeight)
                .title(chartProperties.getTitle())
                .xAxisTitle(null)
                .yAxisTitle(chartProperties.getyTitle())
                .build();

        chart.getStyler().setPlotBackgroundColor(ChartColor.getAWTColor(ChartColor.WHITE));
        chart.getStyler().setChartBackgroundColor(Color.WHITE);
        chart.getStyler().setChartTitleBoxBackgroundColor(new Color(0, 222, 0));

        chart.getStyler().setPlotGridLinesVisible(plotGridLinesVisible);

        chart.getStyler().setYAxisTickMarkSpacingHint(15);
        chart.getStyler().setXAxisTickMarkSpacingHint(10);

        chart.getStyler().setXAxisMax(100.0);
        chart.getStyler().setXAxisLabelRotation(45);

        chart.getStyler().setAxisTickMarkLength(15);
        chart.getStyler().setPlotMargin(0);
        chart.getStyler().setPlotContentSize(.99);

        chart.getStyler().setChartTitleFont(new Font("Verdana", Font.BOLD, 14));
        chart.getStyler().setLegendFont(new Font("Verdana", Font.PLAIN, 12));
        chart.getStyler().setAxisTitleFont(new Font("Verdana", Font.PLAIN, 12));
        chart.getStyler().setAxisTickLabelsFont(new Font("Verdana", Font.PLAIN, 10));

        return chart;

    }
 
开发者ID:orpiske,项目名称:hdr-histogram-plotter,代码行数:36,代码来源:HdrPlotter.java


示例14: afterReportInit

import org.knowm.xchart.XYChart; //导入依赖的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


示例15: show

import org.knowm.xchart.XYChart; //导入依赖的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


示例16: ChartContainer

import org.knowm.xchart.XYChart; //导入依赖的package包/类
public ChartContainer(String name, int delay) {
    this.name = name;
    this.delay = delay;
    this.charts = new LinkedHashMap<String, XYChart>();
    this.iterations = new HashMap<String, List<Integer>>();
    this.indicatorValues = new HashMap<String, List<Double>>();
}
 
开发者ID:jMetal,项目名称:jMetal,代码行数:8,代码来源:ChartContainer.java


示例17: ChartObserver

import org.knowm.xchart.XYChart; //导入依赖的package包/类
public ChartObserver(XYChart chart, JPanel chartPanel) {
    this.chart = chart;
    this.chartPanel = chartPanel;
}
 
开发者ID:rjaros87,项目名称:pm-home-station,代码行数:5,代码来源:ChartObserver.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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