Hitachi Vantara Pentaho Community Wiki
Child pages
  • Adding New Chart Styles

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Since a new style is needed, a new style name will need to be created. By convention (and an easy way to avoid conflicting style names), the new style should start with -x- and have the format -x-{company}-{category}-{style-name} and all spaces should be replaced with dashes (minus) .

...

libcss will need to know that is it needs to load the new Initial Style Sheet that was created. This is accomplished by adding an entry in the libcss.properties file in the root directory of the source tree. The property name must start with org.pentaho.reporting.libraries.css.styles.initial. and the value will be the location of the Initial Style Sheet.

...

Info
titleChartStyleKeys

Since the style we are using supports a list of values, we extended the OneOfConstantsReadHandler and only had to provide the set of valid values.

Code Block
titleLineStyleReadHandler
package org.pentaho.experimental.chart.css.parser.stylehandler;

import org.pentaho.reporting.libraries.css.parser.stylehandler.OneOfConstantsReadHandler;
import org.pentaho.experimental.chart.css.styles.ChartLineStyle;

/**
 * The style parser for the <code>-x-pentaho-chart-line-style</code> style.
 */
public class LineStyleReadHandler extends OneOfConstantsReadHandler {
  public LineStyleReadHandler() {
    super(false); // does not support the "auto" functionality
     addValue(ChartLineStyle.SOLID);
    addValue(ChartLineStyle.DASHED);
    addValue(ChartLineStyle.DOTTED);
    addValue(ChartLineStyle.DOT_DASH);
    addValue(ChartLineStyle.DOT_DOT_DASH);
  }
}

...