Example usage for org.jfree.chart.title DateTitle DateTitle

List of usage examples for org.jfree.chart.title DateTitle DateTitle

Introduction

In this page you can find the example usage for org.jfree.chart.title DateTitle DateTitle.

Prototype

public DateTitle() 

Source Link

Document

Creates a new chart title that displays the current date in the default (LONG) format for the locale, positioned to the bottom right of the chart.

Usage

From source file:org.martus.client.swingui.actions.ActionMenuCharts.java

private void runChart(ChartAnswers answers) {
    try {//from  www .j av a 2s . c om
        SearchTreeNode searchTree = getMainWindow().askUserForSearchCriteria();
        if (searchTree == null)
            return;

        MiniFieldSpec fieldToCount = answers.getFieldToCount();
        MiniFieldSpec[] extraSpecs = new MiniFieldSpec[] { fieldToCount };
        SortableBulletinList sortableList = doSearch(searchTree, extraSpecs, new MiniFieldSpec[] {},
                "ReportSearchProgress");
        if (sortableList == null)
            return;

        HashMap<String, Integer> counts = extractBulletinCounts(fieldToCount, sortableList);

        // TODO: Use or delete these
        //         ChartRenderingInfo info = new ChartRenderingInfo();
        //         EntityCollection entities = new StandardEntityCollection();

        //         JFreeChart bar3dChart = create3DBarChart(counts, labelText);

        JFreeChart chart = createChart(answers, fieldToCount, counts);

        chart.removeSubtitle(new DateTitle());

        UiChartPreviewDlg preview = new UiChartPreviewDlg(getMainWindow(), chart);
        preview.setVisible(true);
        if (preview.wasCancelButtonPressed())
            return;
        boolean sendToDisk = preview.wantsPrintToDisk();

        boolean didPrint = false;
        if (sendToDisk)
            didPrint = printToDisk(chart);
        else
            didPrint = printToPrinter(chart);

        if (didPrint)
            mainWindow.notifyDlg("ChartCompleted");
    } catch (Exception e) {
        MartusLogger.logException(e);
        getMainWindow().notifyDlg("ChartUnknownError");
    }
}