The CTools are a set of community-driven tools which are installed as a stack on top of the Pentaho BA server. They extend the Pentaho platform capabilities by providing a framework for more flexible development. This blog covers few tips and trick for developing CCC (Community Charting Components) and using the CGG (Community Graphics Generator).
- To debug a CDE dashboard add “debug=true&debuglevel=15” to the generateContent url i.e. http://<<server_name>>:8080/pentaho/api/repos/<<cde_dashboard_path>>.wcdf/generatedContent?debug=true&debuglevel=15
- In browser debug (developer tools) console, pvc.<<chart type>> OPTIONS is the chart definition and should be able to be expanded to show the definition details
- In browser debug (developer tools) console, pvc.<<chart type>> RENDER gives you details of the dataset being used, example data and is where debug steps are logged to.
- As per above diagram, if crosstab mode is turned off, the chart expects the series to be in column 1 of the data, then category column/s, then value columns. Date is seen as a special category column. Category columns should be strings unless it’s a date.
- Enter Dashboards.getComponentByName(‘render_<<chart_name>>’) into debug console to display the DOM object for the chart.
- Dashboards.getComponentByName(‘render__<<chart_name>>’).chart returns the class definition for the chart and it’s internal objects.
- Dashboards.getComponentByName(‘render__<<chart_name>>’).chartDefinition returns the chart definition DOM object.
- For additional debugging messages, use console.log to log messages to pentaho.log. Enable the debug level for the category pt.webdetails.cgg in WEB-INF/classes/log4j.xml:
- To activate the debug level in CCC, supply the following parameters in the url:
- The maximum value for debugLevel is at 16. That will even draw the bounding boxes in the chart. The debugging level needs to be adjusted to the required level.
- Create chart data source (add parameters as necessary)
- Add chart to CDE dashboard
- Choose the chart type that best matches the requirements – the type chart defines the behaviour and the options for customisation
- Set chart data source
- If the chart requires parameters to be passed to it the following needs to be defined:
- For each input parameter add a component from the Generic list (if it’s a text field use “Simple Parameter”)
- For each input parameter define an input component which will have the parameter name and the listener name specified
- In the chart properties select all the relevant listeners in the list of listeners
- If the data source requires parameters to be passed to it then parameters need to be defined in the chart properties (mapping of the data source input parameters to the listeners)
- If there is a need to modify/extend the definition of some chart properties, the functions to achieve that can be defined in the Extension points part of the Advanced properties tab.
- Each extension point name comprises of the [component name] + “_” + [function name].
- The functions defined in the extensions points need to return acceptable values both in format and in range
- Since the chart will need to be converted to CGG so that it can be used in a report, if there are extension points that are referring to Dashboards component, there needs to be an additional part defined so that it works in CGG. For example:
- To convert the dashboard chart to CGG, open the components tab and press Shift+G and tick the box in front of the chart that you would like to create the CGG for and get the URL
- To pass parameters in the URL they need to be prefixed with paramp, for example:
- To set the background colour on a CCC Line chart in Extension points add the following:
- The main CCC documentation is at http://community.pentaho.com/ctools/ccc/
- Protovis doco is at http://mbostock.github.io/protovis/docs/