Q:How can I change the color of the crosshair lines? Only found a boolean flag in Tooltip class for switching crosshairs on/off.
Ans:The color of the crosshair lines can be customized by ```setCrosshairs(List)``` in Tooltip .
http://www.zkoss.org/javadoc/latest/zkcharts/org/zkoss/chart/Tooltip.html.
For example:
Tooltip tooltip = chart.getTooltip();
// create a list to store the style maps
List<Map<String, String>> crosshairsStyle = new LinkedList<Map<String, String>>();
// add the first map to customize x axis crosshair style
Map<String, String> xStyle = new LinkedHashMap<String, String>();
xStyle.put("color", "#f39c12");
crosshairsStyle.add(xStyle);
// add the second map to customize y axis crosshair style
Map<String, String> yStyle = new LinkedHashMap<String, String>();
yStyle.put("color", "#27ae60");
yStyle.put("dashStyle", "dash");
yStyle.put("width", "2");
crosshairsStyle.add(yStyle);
tooltip.setCrosshairs(crosshairsStyle);
Ans:The color of the crosshair lines can be customized by ```setCrosshairs(List)``` in Tooltip .
http://www.zkoss.org/javadoc/latest/zkcharts/org/zkoss/chart/Tooltip.html.
For example:
Tooltip tooltip = chart.getTooltip();
// create a list to store the style maps
List<Map<String, String>> crosshairsStyle = new LinkedList<Map<String, String>>();
// add the first map to customize x axis crosshair style
Map<String, String> xStyle = new LinkedHashMap<String, String>();
xStyle.put("color", "#f39c12");
crosshairsStyle.add(xStyle);
// add the second map to customize y axis crosshair style
Map<String, String> yStyle = new LinkedHashMap<String, String>();
yStyle.put("color", "#27ae60");
yStyle.put("dashStyle", "dash");
yStyle.put("width", "2");
crosshairsStyle.add(yStyle);
tooltip.setCrosshairs(crosshairsStyle);
No comments:
Post a Comment