Search in sources :

Example 6 with ChartFrame

use of org.jfree.chart.ChartFrame in project Gemma by PavlidisLab.

the class VisualizeDataSetApp method showProfilesBubbleChartView.

public void showProfilesBubbleChartView(String title, double[][] dataMatrix, int numProfiles) {
    if (dataMatrix == null)
        throw new RuntimeException("dataMatrix cannot be " + null);
    JFreeChart chart = ChartFactory.createXYLineChart(title, "Platform", "Expression Value", null, PlotOrientation.VERTICAL, false, false, false);
    MatrixSeries series = new MatrixSeries(title, dataMatrix[0].length, dataMatrix.length);
    XYPlot plot = chart.getXYPlot();
    plot.setDataset(new MatrixSeriesCollection(series));
    ChartFrame frame = new ChartFrame(title, chart, true);
    this.showWindow(frame);
}
Also used : ChartFrame(org.jfree.chart.ChartFrame) XYPlot(org.jfree.chart.plot.XYPlot) MatrixSeriesCollection(org.jfree.data.xy.MatrixSeriesCollection) MatrixSeries(org.jfree.data.xy.MatrixSeries) JFreeChart(org.jfree.chart.JFreeChart)

Example 7 with ChartFrame

use of org.jfree.chart.ChartFrame in project Gemma by PavlidisLab.

the class VisualizeDataSetApp method showProfilesLineChartView.

public void showProfilesLineChartView(String title, Collection<double[]> dataCol, int numProfiles) {
    if (dataCol == null)
        throw new RuntimeException("dataCol cannot be " + null);
    if (dataCol.size() < numProfiles) {
        VisualizeDataSetApp.log.info("Collection smaller than number of elements.  Will display first " + VisualizeDataSetApp.DEFAULT_MAX_SIZE + " profiles.");
        numProfiles = VisualizeDataSetApp.DEFAULT_MAX_SIZE;
    }
    XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
    Iterator<double[]> iter = dataCol.iterator();
    for (int j = 0; j < numProfiles; j++) {
        XYSeries series = this.getSeries(j, iter.next());
        xySeriesCollection.addSeries(series);
    }
    JFreeChart chart = ChartFactory.createXYLineChart(title, "Platform", "Expression Value", xySeriesCollection, PlotOrientation.VERTICAL, false, false, false);
    chart.addSubtitle(new TextTitle("(Raw data values)", new Font("SansSerif", Font.BOLD, 14)));
    // XYPlot plot = chart.getXYPlot();
    ChartFrame frame = new ChartFrame(title, chart, true);
    this.showWindow(frame);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) ChartFrame(org.jfree.chart.ChartFrame) TextTitle(org.jfree.chart.title.TextTitle) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) JFreeChart(org.jfree.chart.JFreeChart)

Example 8 with ChartFrame

use of org.jfree.chart.ChartFrame in project Java-Matrix-Benchmark by lessthanoptimal.

the class OperationsVersusSizePlot method displayWindow.

public void displayWindow(int width, int height) {
    ChartFrame window = new ChartFrame(chart.getTitle().getText(), chart);
    window.setMinimumSize(new Dimension(width, height));
    window.setPreferredSize(window.getMinimumSize());
    window.setVisible(true);
}
Also used : ChartFrame(org.jfree.chart.ChartFrame)

Example 9 with ChartFrame

use of org.jfree.chart.ChartFrame in project Energieverbrauchssimulator by duschdas2.

the class Diagramm method erzeuge.

/**
 * Erzeugt ein Linien Diagramm aus der �bergebenden CSV_Datei
 * @param s
 * @throws IOException
 */
public static void erzeuge(String s) throws IOException {
    Reader reader = Files.newBufferedReader(Paths.get(s));
    CSVReader csvReader = new CSVReader(reader, ';');
    String[] header = csvReader.readNext();
    String[] nextLine;
    // Erstellt die Datens�tze f�r den Graphen aus dem Array
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    // Minuten angabe
    int c = 1;
    while ((nextLine = csvReader.readNext()) != null) {
        // f�r jede Zeile ausf�hren
        for (int i = 0; i < header.length; i++) {
            // f�r jede Spalte(Ger�te) einmal ausf�hren
            if (i == 0) {
                // Die Occupancy wird aus anschaulichen Gr�nden mal 10 genommen
                dataset.addValue(Double.valueOf(nextLine[i]) * 10, header[i], Integer.toString(c));
            } else {
                dataset.addValue(Double.valueOf(nextLine[i]), header[i], Integer.toString(c));
            }
        }
        // z�hlt die Minuten hoch
        c++;
    }
    // Erstellt den Graphen
    JFreeChart chart = ChartFactory.createLineChart("Simulierter Haushalt", "Zeit in Minuten", "Verbrauch in Watt", dataset, PlotOrientation.VERTICAL, true, true, false);
    Plot plot = chart.getPlot();
    plot.setBackgroundPaint(Color.black);
    // Erstellt das Frame zum abbilden des Graphen
    ChartFrame frame = new ChartFrame("Diagramm", chart);
    frame.pack();
    frame.setVisible(true);
}
Also used : ChartFrame(org.jfree.chart.ChartFrame) CSVReader(com.opencsv.CSVReader) XYPlot(org.jfree.chart.plot.XYPlot) Plot(org.jfree.chart.plot.Plot) CSVReader(com.opencsv.CSVReader) Reader(java.io.Reader) DefaultCategoryDataset(org.jfree.data.category.DefaultCategoryDataset) JFreeChart(org.jfree.chart.JFreeChart)

Example 10 with ChartFrame

use of org.jfree.chart.ChartFrame in project Energieverbrauchssimulator by duschdas2.

the class Diagramm method erzeuge2.

public static void erzeuge2(String s) throws IOException {
    JFreeChart xylineChart = ChartFactory.createXYLineChart("Simulierter Haushalt", "Zeit in Minuten", "Verbrauch in Watt", erstelleDataset(s), PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = xylineChart.getXYPlot();
    plot.setBackgroundPaint(Color.black);
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);
    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    // Erstellt das Frame zum abbilden des Graphen
    ChartFrame frame = new ChartFrame("Diagramm", xylineChart);
    frame.pack();
    frame.setVisible(true);
}
Also used : ChartFrame(org.jfree.chart.ChartFrame) ChartPanel(org.jfree.chart.ChartPanel) XYPlot(org.jfree.chart.plot.XYPlot) JFreeChart(org.jfree.chart.JFreeChart)

Aggregations

ChartFrame (org.jfree.chart.ChartFrame)10 JFreeChart (org.jfree.chart.JFreeChart)7 XYPlot (org.jfree.chart.plot.XYPlot)4 CSVReader (com.opencsv.CSVReader)2 Reader (java.io.Reader)2 Plot (org.jfree.chart.plot.Plot)2 DefaultCategoryDataset (org.jfree.data.category.DefaultCategoryDataset)2 XYSeries (org.jfree.data.xy.XYSeries)2 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)2 ChartPanel (org.jfree.chart.ChartPanel)1 PolarPlot (org.jfree.chart.plot.PolarPlot)1 TextTitle (org.jfree.chart.title.TextTitle)1 MatrixSeries (org.jfree.data.xy.MatrixSeries)1 MatrixSeriesCollection (org.jfree.data.xy.MatrixSeriesCollection)1