Example usage for org.jfree.data Values2D getColumnCount

List of usage examples for org.jfree.data Values2D getColumnCount

Introduction

In this page you can find the example usage for org.jfree.data Values2D getColumnCount.

Prototype

public int getColumnCount();

Source Link

Document

Returns the number of columns in the table.

Usage

From source file:org.jfree.data.DataUtils.java

/**
 * Returns the total of the values in one row of the supplied data
 * table.//from w  w  w  .j  a  v a  2  s  . c om
 *
 * @param data  the table of values ({@code null} not permitted).
 * @param row  the row index (zero-based).
 *
 * @return The total of the values in the specified row.
 */
public static double calculateRowTotal(Values2D data, int row) {
    Args.nullNotPermitted(data, "data");
    double total = 0.0;
    int columnCount = data.getColumnCount();
    for (int c = 0; c < columnCount; c++) {
        Number n = data.getValue(row, c);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

From source file:org.jfree.data.DataUtilities.java

/**
 * Returns the total of the values in one row of the supplied data
 * table.//from  www. j ava2s .co m
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 *
 * @return The total of the values in the specified row.
 */
public static double calculateRowTotal(Values2D data, int row) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int columnCount = data.getColumnCount();
    for (int c = 0; c < columnCount; c++) {
        Number n = data.getValue(row, c);
        if (n != null) {
            total += n.doubleValue();
        }
    }
    return total;
}

From source file:org.jfree.data.DataUtils.java

/**
 * Returns the total of the values in one row of the supplied data
 * table by taking only the column numbers in the array into account.
 *
 * @param data  the table of values ({@code null} not permitted).
 * @param row  the row index (zero-based).
 * @param validCols the array with valid cols (zero-based).
 *
 * @return The total of the valid values in the specified row.
 *
 * @since 1.0.13//from ww w. j a  v a2s  . co m
 */
public static double calculateRowTotal(Values2D data, int row, int[] validCols) {
    Args.nullNotPermitted(data, "data");
    double total = 0.0;
    int colCount = data.getColumnCount();
    for (int v = 0; v < validCols.length; v++) {
        int col = validCols[v];
        if (col < colCount) {
            Number n = data.getValue(row, col);
            if (n != null) {
                total += n.doubleValue();
            }
        }
    }
    return total;
}

From source file:org.jfree.data.DataUtilities.java

/**
 * Returns the total of the values in one row of the supplied data
 * table by taking only the column numbers in the array into account.
 *
 * @param data  the table of values (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param validCols the array with valid cols (zero-based).
 *
 * @return The total of the valid values in the specified row.
 *
 * @since 1.0.13//w  w w. j  av a  2s  .  c  o  m
 */
public static double calculateRowTotal(Values2D data, int row, int[] validCols) {
    ParamChecks.nullNotPermitted(data, "data");
    double total = 0.0;
    int colCount = data.getColumnCount();
    for (int v = 0; v < validCols.length; v++) {
        int col = validCols[v];
        if (col < colCount) {
            Number n = data.getValue(row, col);
            if (n != null) {
                total += n.doubleValue();
            }
        }
    }
    return total;
}

From source file:org.sonar.api.charts.AbstractChart.java

/**
 * Helper to set color of series. If the parameter colorsHex is null, then default Sonar colors are used.
 *//*from ww  w .  jav a 2s.c  o  m*/
protected void configureColors(Values2D dataset, CategoryPlot plot, String[] colorsHex) {
    Color[] colors = COLORS;
    if (colorsHex != null && colorsHex.length > 0) {
        colors = new Color[colorsHex.length];
        for (int i = 0; i < colorsHex.length; i++) {
            colors[i] = Color.decode("#" + colorsHex[i]);
        }
    }

    dataset.getColumnCount();
    AbstractRenderer renderer = (AbstractRenderer) plot.getRenderer();
    for (int i = 0; i < dataset.getColumnCount(); i++) {
        renderer.setSeriesPaint(i, colors[i % colors.length]);

    }
}