Example usage for org.jfree.chart.plot XYPlot setBackgroundPaint

List of usage examples for org.jfree.chart.plot XYPlot setBackgroundPaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setBackgroundPaint.

Prototype

public void setBackgroundPaint(Paint paint) 

Source Link

Document

Sets the background color of the plot area and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.locationtech.udig.processingtoolbox.tools.ScatterPlotDialog.java

private void createGraphTab(final CTabFolder parentTabFolder) {
    plotTab = new CTabItem(parentTabFolder, SWT.NONE);
    plotTab.setText(Messages.ScatterPlotDialog_Graph);

    XYPlot plot = new XYPlot();
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(java.awt.Color.WHITE);
    plot.setDomainPannable(false);//  w ww.j  ava2  s .  c o m
    plot.setRangePannable(false);
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    JFreeChart chart = new JFreeChart(EMPTY, JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    chart.setBackgroundPaint(java.awt.Color.WHITE);
    chart.setBorderVisible(false);

    chartComposite = new ChartComposite2(parentTabFolder, SWT.NONE | SWT.EMBEDDED, chart, true);
    chartComposite.setLayout(new FillLayout());
    chartComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    chartComposite.setDomainZoomable(false);
    chartComposite.setRangeZoomable(false);
    chartComposite.setMap(map);
    chartComposite.addChartMouseListener(new PlotMouseListener());

    plotTab.setControl(chartComposite);

    chartComposite.pack();
}

From source file:edu.ucla.stat.SOCR.chart.demo.XYBarChartDemo1.java

protected JFreeChart createChart(IntervalXYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYBarChart(chartTitle, domainLabel, true, rangeLabel, dataset,
            PlotOrientation.VERTICAL, !legendPanelOn, true, false);

    // then customise it a little...
    // chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setRenderer(new ClusteredXYBarRenderer());
    XYItemRenderer renderer = plot.getRenderer();

    StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator("{1} = {2}",
            new SimpleDateFormat("yyyy"), new DecimalFormat("0"));
    renderer.setBaseToolTipGenerator(generator);
    renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    axis.setLowerMargin(0.01);/*  ww w.  j av  a2s.  c  o  m*/
    axis.setUpperMargin(0.01);
    //      setXSummary(dataset);  X  is time
    return chart;
}

From source file:edu.mit.fss.examples.member.gui.CommSubsystemPanel.java

/**
 * Instantiates a new communications subsystem panel for a subsystem. 
 * Signals are sent via the associated {@link federate}.
 *
 * @param federate the federate// www . j a v  a 2 s .co m
 * @param subsystem the subsystem
 */
public CommSubsystemPanel(Federate federate, CommSubsystem subsystem) {
    this.subsystem = subsystem;

    logger.trace("Creating and adding receiver panel.");
    receiverPanel = new ReceiverPanel(subsystem.getReceiver());
    logger.trace("Adding receiver panel as an object listener.");
    listenerList.add(ObjectChangeListener.class, receiverPanel);
    addTab("Receiver", receiverPanel);

    logger.trace("Creating and adding transmitter panel.");
    transmitterPanel = new TransmitterPanel(federate, subsystem.getTransmitter());
    logger.trace("Adding transmitter panel as an object listener.");
    listenerList.add(ObjectChangeListener.class, transmitterPanel);
    addTab("Transmitter", transmitterPanel);

    logger.trace("Creating and adding connectivity chart panel.");
    connectivityChart = ChartFactory.createTimeSeriesChart(null, "Time", "Connectivity", connectDataset, true,
            false, false);
    connectivityChart.setBackgroundPaint(getBackground());
    if (connectivityChart.getPlot() instanceof XYPlot) {
        XYPlot xyPlot = (XYPlot) connectivityChart.getPlot();
        XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES);
        renderer.setSeriesShape(0, new Ellipse2D.Double(-2, -2, 4, 4));
        xyPlot.setRenderer(renderer);
        xyPlot.setBackgroundPaint(Color.WHITE);
        xyPlot.setDomainGridlinePaint(Color.GRAY);
        xyPlot.setRangeGridlinePaint(Color.GRAY);
    }
    JPanel chartPanel = new JPanel(new BorderLayout());
    chartPanel.add(new ChartPanel(connectivityChart), BorderLayout.CENTER);
    chartPanel.add(new JButton(exportAction), BorderLayout.SOUTH);
    addTab("Connectivity", chartPanel);
}

From source file:MSUmpire.DIA.MixtureModelKDESemiParametric.java

public void GeneratePlot(String pngfile) throws IOException {
    String modelfile = FilenameUtils.getFullPath(pngfile) + "/" + FilenameUtils.getBaseName(pngfile)
            + "_ModelPoints.txt";
    FileWriter writer = new FileWriter(modelfile);

    double[] IDObs = new double[IDEmpiricalDist.getN()];
    double[] DecoyObs = new double[DecoyEmpiricalDist.getN()];

    for (int i = 0; i < IDEmpiricalDist.getN(); i++) {
        IDObs[i] = IDEmpiricalDist.getObs(i);
    }/*from   w w  w  .  ja  v a  2s . c o  m*/
    for (int i = 0; i < DecoyEmpiricalDist.getN(); i++) {
        DecoyObs[i] = DecoyEmpiricalDist.getObs(i);
    }

    XYSeries model1 = new XYSeries("Incorrect matches");
    XYSeries model2 = new XYSeries("Correct matches");
    XYSeries model3 = new XYSeries("All target hits");

    writer.write("UScore\tModel\tCorrect\tDecoy\n");
    for (int i = 0; i < NoBinPoints; i++) {
        model1.add(model_kde_x[i], decoy_kde_y[i]);
        model2.add(model_kde_x[i], correct_kde_y[i]);
        model3.add(model_kde_x[i], model_kde_y[i]);
        writer.write(model_kde_x[i] + "\t" + model_kde_y[i] + "\t" + correct_kde_y[i] + "\t" + decoy_kde_y[i]
                + "\n");
    }
    writer.close();

    MixtureModelProb = new float[NoBinPoints + 1][3];
    float positiveaccu = 0f;
    float negativeaccu = 0f;

    MixtureModelProb[0][0] = (float) model2.getMaxX() + Float.MIN_VALUE;
    MixtureModelProb[0][1] = 1f;
    MixtureModelProb[0][2] = 1f;

    for (int i = 1; i < NoBinPoints + 1; i++) {
        double positiveNumber = correct_kde_y[NoBinPoints - i];
        double negativeNumber = decoy_kde_y[NoBinPoints - i];
        MixtureModelProb[i][0] = (float) model_kde_x[NoBinPoints - i];
        positiveaccu += positiveNumber;
        negativeaccu += negativeNumber;
        MixtureModelProb[i][2] = 0.999999f * (float) (positiveNumber / (negativeNumber + positiveNumber));
        MixtureModelProb[i][1] = 0.999999f * (float) (positiveaccu / (negativeaccu + positiveaccu));
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(model1);
    dataset.addSeries(model2);
    dataset.addSeries(model3);

    HistogramDataset histogramDataset = new HistogramDataset();
    histogramDataset.setType(HistogramType.SCALE_AREA_TO_1);
    histogramDataset.addSeries("ID hits", IDObs, 100);
    histogramDataset.addSeries("Decoy hits", DecoyObs, 100);
    //histogramDataset.addSeries("Model hits", ModelObs, 100);

    JFreeChart chart = ChartFactory.createHistogram(FilenameUtils.getBaseName(pngfile), "Score", "Hits",
            histogramDataset, PlotOrientation.VERTICAL, true, false, false);
    XYPlot plot = chart.getXYPlot();

    NumberAxis domain = (NumberAxis) plot.getDomainAxis();
    domain.setRange(min, max);
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setForegroundAlpha(0.8f);
    chart.setBackgroundPaint(Color.white);

    XYLineAndShapeRenderer render = new XYLineAndShapeRenderer();

    plot.setDataset(1, dataset);
    plot.setRenderer(1, render);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    try {
        ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
    } catch (IOException e) {
    }
}

From source file:visualizer.projection.distance.view.DistanceHistogram.java

private JFreeChart createChart(IntervalXYDataset intervalxydataset) {
    JFreeChart chart = ChartFactory.createHistogram("Distance Histogram", "Distances Values", "Occurences",
            intervalxydataset, PlotOrientation.VERTICAL, true, true, false);

    //        JFreeChart chart = ChartFactory.createHistogram("Histograma das Distncias",
    //                "Valores", "Ocorrncias", intervalxydataset,
    //                PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot xyplot = (XYPlot) chart.getPlot();

    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);

    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    xyplot.setOutlinePaint(Color.BLACK);
    xyplot.setOutlineStroke(new BasicStroke(1.0f));
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setDrawBarOutline(false);

    return chart;
}

From source file:be.nbb.demetra.dfm.output.ConfidenceGraph.java

@Override
protected void onColorSchemeChange() {
    highValueColour = themeSupport.getLineColor(CONFIDENCE_COLOR);
    lowValueColour = themeSupport.getPlotColor();
    updateColourDistance();//from  ww  w .j a va  2 s .c  o  m
    XYPlot plot = chartPanel.getChart().getXYPlot();
    plot.setBackgroundPaint(themeSupport.getPlotColor());
    plot.setDomainGridlinePaint(themeSupport.getGridColor());
    plot.setRangeGridlinePaint(themeSupport.getGridColor());
    chartPanel.getChart().setBackgroundPaint(themeSupport.getBackColor());

    XYLineAndShapeRenderer main = (XYLineAndShapeRenderer) plot.getRenderer(MAIN_INDEX);
    main.setBasePaint(themeSupport.getLineColor(MAIN_COLOR));
    XYLineAndShapeRenderer original = (XYLineAndShapeRenderer) plot.getRenderer(ORIGINAL_DATA_INDEX);
    original.setBasePaint(themeSupport.getLineColor(ORIGINAL_DATA_COLOR));

    for (int i = 0; i < indexes.length; i++) {
        XYDifferenceRenderer confidence = ((XYDifferenceRenderer) plot.getRenderer(indexes[i]));
        Color diffArea = getCellColour(indexes[i]);
        confidence.setPositivePaint(diffArea);
        confidence.setNegativePaint(diffArea);
        confidence.setBasePaint(diffArea);
        if (i != indexes.length - 1) {
            for (int j = 1; j < intermediateValues; j++) {
                confidence = ((XYDifferenceRenderer) plot.getRenderer(indexes[i] - j));
                diffArea = getCellColour(indexes[i] - ((10 / intermediateValues) * j));
                confidence.setPositivePaint(diffArea);
                confidence.setNegativePaint(diffArea);
                confidence.setBasePaint(diffArea);
            }
        }
    }
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.blockcharts.TimeBlockChart.java

@Override
public JFreeChart createChart(DatasetMap datasets) {
    logger.debug("IN");
    super.createChart(datasets);
    DefaultXYZDataset dataset = (DefaultXYZDataset) datasets.getDatasets().get("1");

    DateAxis xAxis = new DateAxis(yLabel);
    xAxis.setLowerMargin(0.0);/* w  w  w .j  ava2  s .  c  o  m*/
    xAxis.setUpperMargin(0.0);
    xAxis.setInverted(false);
    xAxis.setDateFormatOverride(new SimpleDateFormat("dd/MM/yyyy"));
    if (dateAutoRange) {
        xAxis.setAutoRange(true);
    } else {
        DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
        DateTickUnit unit = new DateTickUnit(DateTickUnit.DAY, 1, formatter);
        xAxis.setTickUnit(unit);
    }

    if (dateMin != null && dateMax != null) {
        xAxis.setRange(dateMin, addDay(dateMax));
    } else {
        xAxis.setRange(minDateFound, addDay(maxDateFound));
    }

    //      Calendar c=new GregorianCalendar();
    //      c.set(9 + 2000, Calendar.JANUARY, 1);
    //      java.util.Date minima=c.getTime();
    //      Calendar c1=new GregorianCalendar();
    //      c1.set(9 + 2000, Calendar.FEBRUARY, 1);
    //      java.util.Date massima=c1.getTime();

    NumberAxis yAxis = new NumberAxis(xLabel);
    yAxis.setUpperMargin(0.0);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setRange(hourMin, hourMax);

    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth(BLOCK_HEIGHT);
    // one block for each minute!
    renderer.setBlockHeight(0.017);
    //renderer.setBlockWidth(1);
    renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT);

    //      MyXYItemLabelGenerator my=new MyXYItemLabelGenerator();
    //      renderer.setItemLabelsVisible(null);
    //      renderer.setSeriesItemLabelGenerator(0, my);
    //      renderer.setSeriesItemLabelsVisible(0, true);

    //      XYTextAnnotation annotation1 = new XYTextAnnotation(
    //      "P_",1.2309372E12, 14.3);
    //      XYTextAnnotation annotation2 = new XYTextAnnotation(
    //      "P_",1.2308508E12, 16.3);

    for (Iterator iterator = annotations.keySet().iterator(); iterator.hasNext();) {
        String annotationCode = (String) iterator.next();
        AnnotationBlock annotationBlock = annotations.get(annotationCode);
        XYTextAnnotation xyAnnotation = new XYTextAnnotation(annotationBlock.getAnnotation(),
                annotationBlock.getXPosition() + ANNOTATION_HEIGHT, annotationBlock.getYPosition());
        if (styleAnnotation != null) {
            xyAnnotation.setFont(new Font(styleAnnotation.getFontName(), Font.BOLD, styleAnnotation.getSize()));
            xyAnnotation.setPaint(styleAnnotation.getColor());
        } else {
            xyAnnotation.setFont(new Font("Nome", Font.BOLD, 8));
            xyAnnotation.setPaint(Color.BLACK);
        }

        xyAnnotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
        renderer.addAnnotation(xyAnnotation);
    }

    logger.debug("Annotation set");

    LookupPaintScale paintScale = new LookupPaintScale(0.5, ranges.size() + 0.5, color);
    String[] labels = new String[ranges.size() + 1];
    labels[0] = "";

    // ******************** SCALE ****************************
    for (Iterator iterator = ranges.iterator(); iterator.hasNext();) {
        RangeBlocks range = (RangeBlocks) iterator.next();
        Integer index = patternRangeIndex.get(range.getPattern());
        Color color = range.getColor();
        if (color != null) {
            //Paint colorTransparent=new Color(color.getRed(), color.getGreen(), color.getBlue(), 50);         
            Paint colorTransparent = null;
            if (addTransparency == true) {
                colorTransparent = new Color(color.getRed(), color.getGreen(), color.getBlue(), 50);
            } else {
                colorTransparent = new Color(color.getRed(), color.getGreen(), color.getBlue());
            }
            paintScale.add(index + 0.5, colorTransparent);
        }
        //String insertLabel="            "+range.getLabel();
        String insertLabel = range.getLabel();
        labels[index + 1] = insertLabel;
    }
    renderer.setPaintScale(paintScale);

    SymbolAxis scaleAxis = new SymbolAxis(null, labels);
    scaleAxis.setRange(0.5, ranges.size() + 0.5);
    scaleAxis.setPlot(new PiePlot());
    scaleAxis.setGridBandsVisible(false);

    org.jfree.chart.title.PaintScaleLegend psl = new PaintScaleLegend(paintScale, scaleAxis);
    psl.setMargin(new RectangleInsets(3, 10, 3, 10));
    psl.setPosition(RectangleEdge.BOTTOM);
    psl.setAxisOffset(5.0);
    // ******************** END SCALE ****************************

    logger.debug("Scale Painted");

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));

    logger.debug("Plot set");

    JFreeChart chart = new JFreeChart(name, plot);
    if (styleTitle != null) {
        TextTitle title = setStyleTitle(name, styleTitle);
        chart.setTitle(title);
    }
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);
    chart.addSubtitle(psl);

    logger.debug("OUT");

    return chart;

}

From source file:org.n52.server.sos.render.DiagramRenderer.java

protected JFreeChart renderPreChart(Map<String, OXFFeatureCollection> entireCollMap,
        String[] observedProperties, ArrayList<TimeSeriesCollection> timeSeries, Calendar begin, Calendar end) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(null, // title
            "Date", // x-axis label
            observedProperties[0], // y-axis label
            timeSeries.get(0), // data
            true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );// w  ww  .  ja  va  2 s. com

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);

    // add additional datasets:
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setRange(begin.getTime(), end.getTime());
    axis.setDateFormatOverride(new SimpleDateFormat());
    for (int i = 1; i < observedProperties.length; i++) {
        XYDataset additionalDataset = timeSeries.get(i);
        plot.setDataset(i, additionalDataset);
        plot.setRangeAxis(i, new NumberAxis(observedProperties[i]));
        // plot.getRangeAxis(i).setRange((Double)
        // overAllSeriesCollection.getMinimum(i),
        // (Double) overAllSeriesCollection.getMaximum(i));
        plot.mapDatasetToRangeAxis(i, i);
        // plot.getDataset().getXValue(i, i);
    }
    return chart;
}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformXYScatterChart.java

/**
 * Creates a chart.//from  ww  w  . jav  a  2s. com
 * 
 * @param dataset  the data for the chart.
 * 
 * @return a chart.
 */
protected JFreeChart createChart(XYDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, //"Power Transformed XYScatter Chart",      // chart title
            domainLabel, // x axis label
            rangeLabel, // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    // renderer.setLinesVisible(false);
    renderer.setSeriesLinesVisible(1, true);
    renderer.setSeriesShapesVisible(1, true);
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesShapesVisible(0, true);
    renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

    // change the auto tick unit selection to integer units only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(false);
    rangeAxis.setUpperMargin(0);
    rangeAxis.setLowerMargin(0);

    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    domainAxis.setAutoRangeIncludesZero(false);
    domainAxis.setUpperMargin(0);
    domainAxis.setLowerMargin(0);

    // OPTIONAL CUSTOMISATION COMPLETED.
    setXSummary(dataset);
    return chart;

}

From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java

public void dataDistributed(CQRowSetEvent e) {
    try {//from   w  w  w .ja  va2 s . co m
        base = 0;
        CQRowSet rs = (CQRowSet) e.getSource();

        CQRowSetMetaData meta = rs.getMetaData();

        if (chart == null) {
            c = new TimeSeriesCollection();
            boolean first_loop = true;
            rs.beforeFirst();
            String[] t_obj = new String[meta.getColumnCount()];
            String[] t_val = new String[meta.getColumnCount()];

            while (rs.next()) {
                for (int i = 1; i <= meta.getColumnCount(); i++) {
                    double val = 0;

                    t_obj[i - 1] = meta.getColumnName(i);

                    if (meta.getColumnTypeName(i).equals(DataTypes.STRING)) {
                        t_val[i - 1] = rs.getString(i);
                        continue;
                    }
                    if (meta.getColumnTypeName(i).equals(DataTypes.OBJECT)) {
                        t_val[i - 1] = rs.getObject(i).toString();
                        continue;
                    }
                    if (meta.getColumnTypeName(i).equals(DataTypes.LONG)) {
                        long lval = rs.getLong(i);
                        val = (double) lval;
                        t_val[i - 1] = String.valueOf(lval);
                    } else if (meta.getColumnTypeName(i).equals(DataTypes.DOUBLE)) {
                        val = rs.getDouble(i);
                        t_val[i - 1] = String.valueOf(val);
                    } else {
                        t_val[i - 1] = rs.getString(i);
                        continue;
                    }

                    if (val < 1000000 || Double.isNaN(val)) {
                        TimeSeries ts = updateTimeSeries(meta.getColumnName(i), i, val);
                    }

                }
                if (model == null) {
                    model = new DefaultTableModel(t_obj, 0);
                    getJTable().setModel(model);
                }

                model.addRow(t_val);
                while (model.getRowCount() > 100) {
                    model.removeRow(0);
                }

                first_loop = false;
            }

            chart = ChartFactory.createTimeSeriesChart("", "", "", c, true, true, true);

            XYPlot plot = chart.getXYPlot();
            plot.setBackgroundPaint(Color.BLACK);
            plot.setRangeGridlinePaint(Color.WHITE);
            plot.getDomainAxis().setAutoRange(true);
            plot.getRangeAxis().setAutoRange(true);

            ValueAxis axis = plot.getDomainAxis();
            axis.setLowerMargin(0.03);
            axis.setUpperMargin(0.03);

            ChartPanel panel = (ChartPanel) getJPanel();
            panel.setChart(chart);
        } else {
            String[] t_val = new String[meta.getColumnCount()];
            rs.beforeFirst();
            while (rs.next()) {
                for (int i = 1; i <= meta.getColumnCount(); i++) {
                    double val = 0;

                    if (meta.getColumnTypeName(i).equals(DataTypes.STRING)) {
                        t_val[i - 1] = rs.getString(i);
                        continue;
                    }
                    if (meta.getColumnTypeName(i).equals(DataTypes.OBJECT)) {
                        t_val[i - 1] = rs.getObject(i).toString();
                        continue;
                    }
                    if (meta.getColumnTypeName(i).equals(DataTypes.LONG)) {
                        long lval = rs.getLong(i);
                        val = (double) lval;
                        t_val[i - 1] = String.valueOf(lval);
                    } else if (meta.getColumnTypeName(i).equals(DataTypes.DOUBLE)) {
                        val = rs.getDouble(i);
                        t_val[i - 1] = String.valueOf(val);
                    } else {
                        t_val[i - 1] = rs.getString(i);
                        continue;
                    }

                    if (val < 1000000 || Double.isNaN(val)) {
                        TimeSeries ts = updateTimeSeries(meta.getColumnName(i), i, val);
                    }
                }

                model.addRow(t_val);
                while (model.getRowCount() > 100) {
                    model.removeRow(0);
                }
            }
            repaint();
        }
    } catch (CQException ce) {
        ce.printStackTrace();
    }
}