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


Java JFreeChart.setTitle方法代码示例

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


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

示例1: getChart

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
@Override
public JFreeChart getChart() throws IOException {

    final JFreeChart chart = overlaid_analyzer.getChart();
    chart.setTitle(getName());
    return chart;
}
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:8,代码来源:OverlaidCrossRepetitionPerPropertyAnalyzer.java

示例2: DialDemo3

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
/** 
 * Creates a new instance.
 * 
 * @param title  the frame title.
 */
public DialDemo3(String title) {
    super(title);
    
    this.dataset = new DefaultValueDataset(50);
    // get data for diagrams
    DialPlot plot = new DialPlot();
    plot.setView(0.21, 0.0, 0.58, 0.30);
    plot.setDataset(this.dataset);
    
    StandardDialFrame dialFrame = new StandardDialFrame(60.0, 60.0);
    dialFrame.setInnerRadius(0.60);
    dialFrame.setOuterRadius(0.90);
    dialFrame.setForegroundPaint(Color.darkGray);
    dialFrame.setStroke(new BasicStroke(3.0f));
    plot.setDialFrame(dialFrame);
    
    GradientPaint gp = new GradientPaint(new Point(), 
            new Color(255, 255, 255), new Point(), 
            new Color(240, 240, 240));
    DialBackground sdb = new DialBackground(gp);
    sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer(
            GradientPaintTransformType.VERTICAL));
    plot.addLayer(sdb);
    
    StandardDialScale scale = new StandardDialScale(0, 100, 115.0, -50.0);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.07);
    scale.setMajorTickIncrement(25.0);
    scale.setTickLabelPaint(null);
    plot.addScale(0, scale);
    
    DialPointer needle = new DialPointer.Pin();
    needle.setRadius(0.82);
    plot.addLayer(needle);
    JFreeChart chart1 = new JFreeChart(plot);
    chart1.setTitle("Dial Demo 3");
    ChartPanel cp1 = new ChartPanel(chart1);

    cp1.setPreferredSize(new Dimension(400, 250));
    this.slider = new JSlider(0, 100);
    this.slider.setMajorTickSpacing(10);
    this.slider.setPaintLabels(true);
    this.slider.addChangeListener(this);
    JPanel content = new JPanel(new BorderLayout());
    content.add(cp1);
    content.add(this.slider, BorderLayout.SOUTH);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setContentPane(content);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:56,代码来源:DialDemo3.java

示例3: DialDemo1

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
/** 
 * Creates a new instance.
 *
 * @param title  the frame title.
 */
public DialDemo1(String title) {
    super(title);
    
    this.dataset = new DefaultValueDataset(10.0);
    
    // get data for diagrams
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    plot.setDataset(this.dataset);
    SimpleDialFrame dialFrame = new SimpleDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.darkGray);
    plot.setDialFrame(dialFrame);
    
    GradientPaint gp = new GradientPaint(new Point(), 
            new Color(255, 255, 255), new Point(), 
            new Color(170, 170, 220));
    DialBackground db = new DialBackground(gp);
    db.setGradientPaintTransformer(new StandardGradientPaintTransformer(
            GradientPaintTransformType.VERTICAL));
    plot.setBackground(db);
    
    DialTextAnnotation annotation1 = new DialTextAnnotation("Temperature");
    annotation1.setFont(new Font("Dialog", Font.BOLD, 14));
    annotation1.setRadius(0.7);
    
    plot.addLayer(annotation1);

    DialValueIndicator dvi = new DialValueIndicator(0, "c");
    plot.addLayer(dvi);
    
    StandardDialScale scale = new StandardDialScale(-40, 60, -120, -300);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14));
    plot.addScale(0, scale);
    
    StandardDialRange range = new StandardDialRange(40.0, 60.0, Color.red);
    range.setInnerRadius(0.52);
    range.setOuterRadius(0.55);
    plot.addLayer(range);
    
    StandardDialRange range2 = new StandardDialRange(10.0, 40.0, 
            Color.orange);
    range2.setInnerRadius(0.52);
    range2.setOuterRadius(0.55);
    plot.addLayer(range2);

    StandardDialRange range3 = new StandardDialRange(-40.0, 10.0, 
            Color.green);
    range3.setInnerRadius(0.52);
    range3.setOuterRadius(0.55);
    plot.addLayer(range3);

    DialPointer needle = new DialPointer.Pointer();
    plot.addLayer(needle);
    
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    plot.setCap(cap);
    
    JFreeChart chart1 = new JFreeChart(plot);
    chart1.setTitle("Demo Dial 1");
    ChartPanel cp1 = new ChartPanel(chart1);
    cp1.setPreferredSize(new Dimension(400, 400));
    this.slider = new JSlider(-40, 60);
    this.slider.setMajorTickSpacing(10);
    this.slider.setPaintLabels(true);
    this.slider.addChangeListener(this);
    JPanel content = new JPanel(new BorderLayout());
    content.add(cp1);
    content.add(this.slider, BorderLayout.SOUTH);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setContentPane(content);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:81,代码来源:DialDemo1.java

示例4: DialDemo4

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
/** 
 * Creates a new instance.
 * 
 * @param title  the frame title.
 */
public DialDemo4(String title) {
    super(title);
    
    this.dataset = new DefaultValueDataset(50);
    // get data for diagrams
    DialPlot plot = new DialPlot();
    plot.setView(0.78, 0.37, 0.22, 0.26);
    plot.setDataset(this.dataset);
    
    StandardDialFrame dialFrame = new StandardDialFrame(-10.0, 20.0);
    dialFrame.setInnerRadius(0.70);
    dialFrame.setOuterRadius(0.90);
    dialFrame.setForegroundPaint(Color.darkGray);
    dialFrame.setStroke(new BasicStroke(3.0f));
    plot.setDialFrame(dialFrame);
    
    GradientPaint gp = new GradientPaint(new Point(), 
            new Color(255, 255, 255), new Point(), 
            new Color(240, 240, 240));
    DialBackground sdb = new DialBackground(gp);
    sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer(
            GradientPaintTransformType.VERTICAL));
    plot.addLayer(sdb);
    
    StandardDialScale scale = new StandardDialScale(0, 100, -8, 16.0);
    scale.setTickRadius(0.82);
    scale.setTickLabelOffset(-0.04);
    scale.setMajorTickIncrement(25.0);
    scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14));
    
    plot.addScale(0, scale);
    
    DialPointer needle = new DialPointer.Pin();
    needle.setRadius(0.84);
    plot.addLayer(needle);
    JFreeChart chart1 = new JFreeChart(plot);
    chart1.setTitle("Dial Demo 4");
    ChartPanel cp1 = new ChartPanel(chart1);

    cp1.setPreferredSize(new Dimension(400, 250));
    this.slider = new JSlider(0, 100);
    this.slider.setMajorTickSpacing(10);
    this.slider.setPaintLabels(true);
    this.slider.addChangeListener(this);
    JPanel content = new JPanel(new BorderLayout());
    content.add(cp1);
    content.add(this.slider, BorderLayout.SOUTH);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setContentPane(content);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:57,代码来源:DialDemo4.java

示例5: GraphGenerator

import org.jfree.chart.JFreeChart; //导入方法依赖的package包/类
public GraphGenerator(final String title, AthenaFeatures athenaFeatures, String feature) {
        super(title);
        this.feature = feature;
        final XYDataset dataset = createDatasetFromFeatureData(athenaFeatures, feature);
        final JFreeChart chart = createChart(dataset);
        chart.setTitle("");
        LegendTitle legend = (LegendTitle) chart.getLegend();
        chart.removeLegend();
        Font nwfont = new Font("Arial",1,12);
        legend.setItemFont(nwfont);
        legend.setPosition(RectangleEdge.TOP);
//        legend.setWidth(200);
        legend.setItemLabelPadding(new RectangleInsets(3, 3, 3, 3));
        legend.setHeight(10);
//        legend.setPadding(new RectangleInsets(10, 10, 10, 10));
        XYTitleAnnotation ta = new XYTitleAnnotation(0.99, 0.98, legend, RectangleAnchor.TOP_RIGHT);
        ta.setMaxWidth(0.95);
//        chart.addLegend(legend);

        XYPlot plot = (XYPlot) chart.getPlot();
        plot.setBackgroundPaint(Color.white);
        plot.setDomainZeroBaselinePaint(Color.gray);
        plot.setDomainGridlinePaint(Color.gray);
        plot.setDomainGridlineStroke(new BasicStroke(0.7f));
        plot.setRangeGridlinePaint(Color.gray);
        plot.setRangeGridlineStroke(new BasicStroke(0.7f));
        plot.setDomainMinorGridlinePaint(Color.black);
        plot.addAnnotation(ta);
        final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
        renderer.setSeriesPaint(0, Color.black);
        renderer.setSeriesShape(0, ShapeUtilities.createDiamond(5));
        renderer.setSeriesPaint(1, Color.red);
        renderer.setSeriesShape(1, ShapeUtilities.createUpTriangle(5));
        renderer.setSeriesPaint(2, Color.blue);
        Shape shape  = new Ellipse2D.Double(-5.0,-5.0,10,10);
        renderer.setSeriesShape(2, shape);
        renderer.setShapesFilled(false);
//        renderer.setSeriesShapesVisible(1, false);

        //apply theme
//        StandardChartTheme.createJFreeTheme().apply(chart);

        plot.setRenderer(renderer);
        NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
        yAxis.setLabel(feature + " (K)");
        yAxis.setAxisLineVisible(false);
        yAxis.setTickUnit(new NumberTickUnit(50000));
        yAxis.setNumberFormatOverride(new ByteFormat());
        yAxis.setRange(new Range(0, 160000));
        plot.getRenderer().setBaseItemLabelsVisible(true);
        DateAxis xAxis = (DateAxis) plot.getDomainAxis();
        xAxis.setAxisLineVisible(false);
        xAxis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"));
        xAxis.setTickUnit(new DateTickUnit(DateTickUnit.MINUTE, 3));
        xAxis.setLabelFont(new Font("Arial",1,12));
        final ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new java.awt.Dimension(631, 381));
        chartPanel.setMouseZoomable(true, true);
        setContentPane(chartPanel);
        try { 
            ChartUtilities.saveChartAsPNG(new File("result.png"), chart, 631, 381);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
 
开发者ID:shlee89,项目名称:athena,代码行数:67,代码来源:GraphGenerator.java


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