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


Java ChartPanel类代码示例

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


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

示例1: MultiLineChart

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public MultiLineChart(final String title, List<Users> tpaverficationUserList) {
	super(title);
	this.tpaverficationUserList = tpaverficationUserList;
	XYDataset dataset = null;
	try {
		dataset = createDataset();
	} catch (Exception e) {
		System.out.println("MultiLineChart -- Constructor" + e);
	}
	final JFreeChart chart = createChart(dataset);
	final ChartPanel chartPanel = new ChartPanel(chart);
	chartPanel.setPreferredSize(new java.awt.Dimension(700, 470));
	setContentPane(chartPanel);
	this.pack();
	RefineryUtilities.centerFrameOnScreen(this);
	this.setVisible(true);

}
 
开发者ID:cyberheartmi9,项目名称:Mona-Secure-Multi-Owner-Data-Sharing-for-Dynamic-Group-in-the-Cloud,代码行数:19,代码来源:MultiLineChart.java

示例2: _getPointForCandlestick

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
private Point2D.Double _getPointForCandlestick(int plotIndex, int seriesIndex, int dataIndex) {
    final ChartPanel chartPanel = this.chartJDialog.getChartPanel();
    final XYPlot plot = this.chartJDialog.getPlot(plotIndex);
    final ValueAxis domainAxis = plot.getDomainAxis();
    final RectangleEdge domainAxisEdge = plot.getDomainAxisEdge();
    final ValueAxis rangeAxis = plot.getRangeAxis();
    final RectangleEdge rangeAxisEdge = plot.getRangeAxisEdge();

    final org.jfree.data.xy.DefaultHighLowDataset defaultHighLowDataset = (org.jfree.data.xy.DefaultHighLowDataset)plot.getDataset(seriesIndex);

    if (dataIndex >= defaultHighLowDataset.getItemCount(0)) {
        /* Not ready yet. */
        return null;
    }

    final double xValue = defaultHighLowDataset.getXDate(0, dataIndex).getTime();
    final double yValue = defaultHighLowDataset.getCloseValue(0, dataIndex);
    final Rectangle2D plotArea = chartPanel.getChartRenderingInfo().getPlotInfo().getSubplotInfo(plotIndex).getDataArea();
    final double xJava2D = domainAxis.valueToJava2D(xValue, plotArea, domainAxisEdge);
    final double yJava2D = rangeAxis.valueToJava2D(yValue, plotArea, rangeAxisEdge);
    // Use Double version, to avoid from losing precision.
    return new Point2D.Double(xJava2D, yJava2D);
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:24,代码来源:ChartLayerUI.java

示例3: draw

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
private static void draw(final Type type,
                         final String title,
                         final String xlabel,
                         final String ylabel,
                         final DefaultCategoryDataset dataset) {
    final JFrame frame = getFrame();

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            ChartPanel chartPanel = getChart(type).createChart(title, dataset, xlabel, ylabel);
            frame.getContentPane().add(chartPanel);
            frame.setVisible(true);
        }
    });
}
 
开发者ID:Fanping,项目名称:iveely.ml,代码行数:17,代码来源:VisualizeUtils.java

示例4: TimeandCostGraph

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public TimeandCostGraph(String title, int one, int two) {

		super(title);
		XYDataset dataset = null;
		try {
			dataset = createDataset();
		} catch (Exception e) {
			System.out.println("MultiLineChart -- Constructor" + e);
		}
		final JFreeChart chart = createChart(dataset);
		final ChartPanel chartPanel = new ChartPanel(chart);
		chartPanel.setPreferredSize(new java.awt.Dimension(700, 470));
		setContentPane(chartPanel);
		this.pack();
		RefineryUtilities.centerFrameOnScreen(this);
		this.setVisible(true);
		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
	}
 
开发者ID:cyberheartmi9,项目名称:Mona-Secure-Multi-Owner-Data-Sharing-for-Dynamic-Group-in-the-Cloud,代码行数:19,代码来源:TimeandCostGraph.java

示例5: updateTraceInfosIfPossible

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
private void updateTraceInfosIfPossible(int dataOffset) {
    // Do we have a valid mainTraceInfo?
    if (this.mainTraceInfo.point == null) {
        // Nope. Returns early.
        return;
    }
    final int newDataIndex = dataOffset + this.mainTraceInfo.dataIndex;
    if (newDataIndex < 0) {
        // We try to offset beyond chart boundary. Returns early.
    }
    
    /* Try to get correct main chart area. */
    final ChartPanel chartPanel = this.chartJDialog.getChartPanel();
    final Rectangle2D _plotArea = chartPanel.getChartRenderingInfo().getPlotInfo().getSubplotInfo(0).getDataArea();

    final Point2D tmpPoint = this.getPoint(0, 0, newDataIndex);
    if (tmpPoint == null || _plotArea.contains(tmpPoint) == false) {
        return;
    }

    this.mainTraceInfo = TraceInfo.newInstance(tmpPoint, 0, 0, newDataIndex);
    this.updateTraceInfos();
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:24,代码来源:ChartLayerUI.java

示例6: PieChart

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public PieChart() {
    DefaultPieDataset data = getDataSet();
    JFreeChart chart = ChartFactory.createPieChart3D("水果产量", data, true, false, false);
    //设置百分比
    PiePlot pieplot = (PiePlot) chart.getPlot();
    DecimalFormat df = new DecimalFormat("0.00%");//获得一个DecimalFormat对象,主要是设置小数问题
    NumberFormat nf = NumberFormat.getNumberInstance();//获得一个NumberFormat对象
    StandardPieSectionLabelGenerator sp1 = new StandardPieSectionLabelGenerator("{0}  {2}", nf, df);//获得StandardPieSectionLabelGenerator对象
    pieplot.setLabelGenerator(sp1);//设置饼图显示百分比

    //没有数据的时候显示的内容
    pieplot.setNoDataMessage("无数据显示");
    pieplot.setCircular(false);
    pieplot.setLabelGap(0.02D);

    pieplot.setIgnoreNullValues(true);//设置不显示空值
    pieplot.setIgnoreZeroValues(true);//设置不显示负值
    frame1 = new ChartPanel(chart, true);
    chart.getTitle().setFont(new Font("宋体", Font.BOLD, 20));//设置标题字体
    PiePlot piePlot = (PiePlot) chart.getPlot();//获取图表区域对象
    piePlot.setLabelFont(new Font("宋体", Font.BOLD, 10));//解决乱码
    chart.getLegend().setItemFont(new Font("黑体", Font.BOLD, 10));
}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:24,代码来源:PieChart.java

示例7: displayChart

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
/**
 * Displays a chart in a frame.
 * @param chart the chart to be displayed
 */
private static void displayChart(JFreeChart chart) {
    // Chart panel
    ChartPanel panel = new ChartPanel(chart);
    panel.setFillZoomRectangle(true);
    panel.setMouseWheelEnabled(true);
    panel.setPreferredSize(new Dimension(1024, 400));
    // Application frame
    ApplicationFrame frame = new ApplicationFrame("Ta4j example - Cash flow to chart");
    frame.setContentPane(panel);
    frame.pack();
    RefineryUtilities.centerFrameOnScreen(frame);
    frame.setVisible(true);
}
 
开发者ID:ta4j,项目名称:ta4j,代码行数:18,代码来源:CashFlowToChart.java

示例8: createComponent

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
@Override
public JComponent createComponent() {
    ChartDataPlugin plugin = chartDataFramework
            .getChartDataPlugin(chartSource.getChartType());
    try {
        chartPanel = new ChartPanel(plugin.createChart(element));
        chartPanel.setPopupMenu(null);
    } catch (ChartNotSetupedException e) {
        JOptionPane.showMessageDialog(framework.getMainFrame(),
                ChartResourceManager.getString("Error.chartNotSetuped"));
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                close();
            }
        });
        return new JPanel();
    }
    return chartPanel;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:22,代码来源:ChartView.java

示例9: WaveChart

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public WaveChart(String chartContent,String title,String yaxisName)
{
    super();
    this.chart=createChart(chartContent,title,yaxisName);
    addChart(this.chart);

    // 将JFreeChart放在专用的图表容器ChartPanel中
    this.chartPanel = new ChartPanel(this.chart);
    this.chartPanel.setPreferredSize(new Dimension(500, 350));

    // 设置chartPanel容器边框
    CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(1, 1,1, 1),
            BorderFactory.createEtchedBorder());
    this.chartPanel.setBorder(compoundBorder);

    // 将chartPanel加入到本容器中
    add(this.chartPanel);
}
 
开发者ID:ZingBug,项目名称:NystagmusJava,代码行数:20,代码来源:WaveChart.java

示例10: raster

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public void raster(Collection<Spike> spikes,String title)
{   
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time"));
    
    // Build a plot for each layer
    for (int i=0; i<net.nLayers(); i++)
        plot.add(layerRaster(spikes,net.lay(i)),1);
            
    JFreeChart chart= new JFreeChart("Raster: "+title,JFreeChart.DEFAULT_TITLE_FONT, plot,true);
    
    // Put it in a frame!
    JFrame fr=new JFrame();
    fr.getContentPane().add(new ChartPanel(chart));
    fr.setSize(1200,1000);
    fr.setVisible(true);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:NetPlotter.java

示例11: createDemoPanel

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
/**
     * Creates a panel for the demo (used by SuperDemo.java).
     *
     * @return A panel.
     */
    public static JPanel createDemoPanel() {
        JFreeChart chart = createChart(createDataset());
        chart.setPadding(new RectangleInsets(4, 8, 2, 2));
        ChartPanel panel = new ChartPanel(chart);
//        panel.setMouseWheelEnabled(true);
        panel.setPreferredSize(new Dimension(600, 300));
        return panel;
    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:14,代码来源:PieChartDemo1.java

示例12: showJFreeChart

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public void showJFreeChart(int coordX, int coordY){
        //Mostrar el chart
        ChartPanel chartPanel = new ChartPanel(chart1);
        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
        setContentPane(chartPanel);           
                
        this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);               
        
        addWindowListener(
        		new WindowAdapter(){
        		        public void WindowClosing (WindowEvent e){
                           System.out.println("No quiero cerrar la ventana !!!\n");
        		        }	
        		}
        );

        
        this.pack();
//        RefineryUtilities.centerFrameOnScreen(this);
        
        this.setLocation(coordX, coordY);
        
        this.setVisible(true);    	    	
    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:25,代码来源:VisualizacionJfreechart.java

示例13: visualizarSerieChartAsignRescateVict

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public void  visualizarSerieChartAsignRescateVict(Color color,CategoryDataset dataset) {
     ChartPanel chartPanel = new ChartPanel(chartNotifAsigResc);
     chartNotifAsigResc.setBackgroundPaint(Color.white);
    CategoryPlot plot = (CategoryPlot) chartNotifAsigResc.getPlot();
     plot.setBackgroundPaint(color);
     plot.setDataset(dataset);
     plot.setDomainGridlinePaint(Color.white);
     plot.setRangeGridlinePaint(Color.white);
     NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
     rangeAxis.setUpperMargin(0.15);
     CategoryItemRenderer renderer = plot.getRenderer();
     renderer.setItemLabelGenerator(new LabelGenerator(50.0));
     renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
     renderer.setItemLabelsVisible(true);
     chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
   setContentPane(chartPanel);
   this.pack();
   RefineryUtilities.centerFrameOnScreen(this);
   this.setVisible(true);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:VisualizacionJfreechart.java

示例14: visualizarSeriesTiemposRescateVictPorRobots

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public void  visualizarSeriesTiemposRescateVictPorRobots(CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(
     "Tiempos de Rescate de Victimas por cada robot ", // chart title
     "Robots en el entorno", // domain axis label
     "Tiempo milisegundos", // range axis label
     dataset, // data
     PlotOrientation.VERTICAL, // orientation
     true, // include legend
     true, // tooltips?
     false // URLs?
     );
     ChartPanel chartPanel = new ChartPanel(chart);
     chart.setBackgroundPaint(Color.white);
     CategoryPlot plot = chart.getCategoryPlot();
     plot.setBackgroundPaint(Color.lightGray);
     plot.setDomainGridlinePaint(Color.white);
     plot.setRangeGridlinePaint(Color.white);
     NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
     rangeAxis.setUpperMargin(0.15);
     CategoryItemRenderer renderer = plot.getRenderer();
     renderer.setItemLabelGenerator(new LabelGenerator(50.0));
     renderer.setItemLabelFont(new Font("Serif", Font.PLAIN, 8));
     renderer.setItemLabelsVisible(true);
     chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
     this.visualizar(chartPanel);
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:27,代码来源:VisualizacionJfreechart.java

示例15: drawTimeSeriesChart

import org.jfree.chart.ChartPanel; //导入依赖的package包/类
public static void drawTimeSeriesChart(final String title,
                                       final String xlabel,
                                       final String ylabel,
                                       final TimeSeriesCollection dataset) {
    final JFrame frame = getFrame();
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            ChartPanel chartPanel = new TimeSeriesChart().createChart(title,
                    xlabel, ylabel, dataset);
            frame.getContentPane().add(chartPanel);
            frame.setVisible(true);
        }
    });
}
 
开发者ID:Fanping,项目名称:iveely.ml,代码行数:16,代码来源:VisualizeUtils.java


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