当前位置: 首页>>代码示例>>Java>>正文


Java SwingWrapper类代码示例

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


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

示例1: getContainer

import com.xeiam.xchart.SwingWrapper; //导入依赖的package包/类
/**
 * Container for chart.
 *
 * @param chart
 *            chart
 * @return Container
 */
public static Container getContainer(final Chart chart) {
	// Wrap the chart in a JFrame and hide the frame
	JFrame frame = new SwingWrapper(chart).displayChart();
	frame.addWindowListener(new HideWindowAdapter());

	return frame.getContentPane();
}
 
开发者ID:adamIqbal,项目名称:Health,代码行数:15,代码来源:FreqBar.java

示例2: drawGraph

import com.xeiam.xchart.SwingWrapper; //导入依赖的package包/类
/**
 * Draw a graph of the loss values as a functions of the iterations
 * @param scores an array list of the loss values
 * @param save a flag indicates whether or not to save the img
 */
public void drawGraph(ArrayList<Double> scores, boolean save) {
    try {
        // setting the data fit for the plotting
        double[] xData = new double[scores.size()];
        double[] yData = new double[scores.size()];

        for(int i=0 ; i<scores.size() ; i++){
            yData[i] = scores.get(i);
            xData[i] = i+1;
        }

        // Create Chart
        Chart chart = QuickChart.getChart(TITLE, X_TITLE, Y_TITLE, SERIES_NAME, xData, yData);
        // Show it
        new SwingWrapper(chart).displayChart();
        if (save) {
            // or save it in high-res
            Logger.info("=========================");
            Logger.info("Saving image: " + IMG_PATH);
            Logger.info("=========================");

            File imgDir = new File(IMG_DIR);
            // if the directory does not exist, create it
            if (!imgDir.exists()) {
                Logger.info("creating directory: img/");
                boolean result = false;
                try{
                    result = imgDir.mkdir();
                }
                catch(SecurityException se){
                    Logger.error("There is no permission to write the error image.");
                }
                if(result) {
                    Logger.info("DIR created");
                    BitmapEncoder.saveBitmapWithDPI(chart, IMG_PATH, BitmapEncoder.BitmapFormat.PNG.PNG, 300);
                }
            }
            BitmapEncoder.saveBitmapWithDPI(chart, IMG_PATH, BitmapEncoder.BitmapFormat.PNG.PNG, 300);
        }
    }catch (Exception e){
        e.printStackTrace();
    }
}
 
开发者ID:adiyoss,项目名称:StructED,代码行数:49,代码来源:Graph.java

示例3: show

import com.xeiam.xchart.SwingWrapper; //导入依赖的package包/类
public static void show() {
    new SwingWrapper(CHART).displayChart();
}
 
开发者ID:talkvip,项目名称:Bitraac,代码行数:4,代码来源:ComparativeChart.java


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