Search in sources :

Example 1 with TSTable

use of org.spf4j.perf.tsdb.TSTable in project spf4j by zolyfarkas.

the class TSDBViewJInternalFrame method addChartToPanel.

private void addChartToPanel(final String tableName, final JPanel content) throws IOException {
    TSTable info = tsDb.getTSTable(tableName);
    long startTime = ((Date) startDate.getValue()).getTime();
    long endTime = ((Date) endDate.getValue()).getTime();
    if (TimeSeriesDatabase.canGenerateHeatChart(info)) {
        JFreeChart chart = tsDb.createHeatJFreeChart(info.getTableName(), startTime, endTime);
        ChartPanel pannel = new ChartPanel(chart);
        pannel.setPreferredSize(new Dimension(600, 800));
        pannel.setDomainZoomable(false);
        pannel.setMouseZoomable(false);
        pannel.setRangeZoomable(false);
        pannel.setZoomAroundAnchor(false);
        pannel.setZoomInFactor(1);
        pannel.setZoomOutFactor(1);
        content.add(pannel);
    }
    if (TimeSeriesDatabase.canGenerateMinMaxAvgCount(info)) {
        JFreeChart chart = tsDb.createMinMaxAvgJFreeChart(info.getTableName(), startTime, endTime);
        ChartPanel pannel = new ChartPanel(chart);
        pannel.setPreferredSize(new Dimension(600, 600));
        content.add(pannel);
    }
    if (TimeSeriesDatabase.canGenerateCount(info)) {
        JFreeChart chart = tsDb.createCountJFreeChart(info.getTableName(), startTime, endTime);
        ChartPanel pannel = new ChartPanel(chart);
        pannel.setPreferredSize(new Dimension(600, 600));
        content.add(pannel);
    } else {
        List<JFreeChart> createJFreeCharts = tsDb.createJFreeCharts(info.getTableName(), startTime, endTime);
        for (JFreeChart chart : createJFreeCharts) {
            ChartPanel pannel = new ChartPanel(chart);
            pannel.setPreferredSize(new Dimension(600, 600));
            content.add(pannel);
        }
    }
}
Also used : ChartPanel(org.jfree.chart.ChartPanel) TSTable(org.spf4j.perf.tsdb.TSTable) Dimension(java.awt.Dimension) Date(java.util.Date) JFreeChart(org.jfree.chart.JFreeChart)

Aggregations

Dimension (java.awt.Dimension)1 Date (java.util.Date)1 ChartPanel (org.jfree.chart.ChartPanel)1 JFreeChart (org.jfree.chart.JFreeChart)1 TSTable (org.spf4j.perf.tsdb.TSTable)1