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