ZkCharts Change color of crosshair lines

asked 2014-05-19 11:21:27 +0800

enixser gravatar image enixser
185 3

updated 2014-05-19 11:23:12 +0800

How can I change the color of the crosshair lines? Only found a boolean flag in Tooltip class for switching crosshairs on/off.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-05-20 02:49:06 +0800

RaymondChao gravatar image RaymondChao
386 1 4


The color of the crosshair lines can be customized by setCrosshairs(List) in Tooltip. 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");

// 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");

link publish delete flag offensive edit


Hi Raymond, great example!!! It works perfectly. Thank you! Such a little piece of code would be very helpful in the API docs of the setCrosshairs() method :-)

enixser ( 2014-05-20 06:49:56 +0800 )edit

answered 2014-05-20 00:39:04 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

Hello enixser, i believe that you need override some css icon. Searching the net i found that: .z-icon-crosshairs:before{content:"\f05b"}. I'm not sure if it's possible, but maybe you should try.

links found:



link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2014-05-19 11:21:27 +0800

Seen: 16 times

Last updated: May 20 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More