當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。