示例#1
0
  /**
   * Helper to set color of series. If the parameter colorsHex is null, then default Sonar colors
   * are used.
   */
  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]);
    }
  }