Details
-
New Feature
-
Resolution: Fixed
-
Normal
-
2.0.0.1
-
Security Level: Jimmy
-
None
Description
Problem description
The javadoc,
http://www.zkoss.org/javadoc/latest/zkcharts/org/zkoss/chart/ExportingButton.html#setMenuItems(java.util.List) , said to pass a List<T> into the method. But Users cannot understand which object they should pass.
I have tried the code below that works correctly:
List<JSONObject> menuItems = new ArrayList<JSONObject>(); JSONObject options = new JSONObject(); options.put("text", "Export to PNG (small)"); options.put("onclick", new JavaScriptValue("function(){this.exportChart({width: 250});}")); menuItems.add(options); chart.getExporting().getButtons().setMenuItems(menuItems);
If the method only accepts List<JSONObject>, we should make its signature more explicitly and it can hint users how to use more clearly. If cases are more complicate, e.g. allowing multiple type of list, we can write an example in javadoc.
Similar cases
There are also several methods whose signature is not clear for users to know which type they should pass as a parameters:
In http://www.zkoss.org/javadoc/latest/zkcharts/org/zkoss/chart/Exporting.html
setChartOptions(Map<K,V> chartOptions)
setButtons(Map<String,ExportingButton> buttons)
setFormAttributes(List<T> formAttributes)