(d, hovermode)
| 2158 | } |
| 2159 | |
| 2160 | function cleanPoint(d, hovermode) { |
| 2161 | var index = d.index; |
| 2162 | var trace = d.trace || {}; |
| 2163 | var cd0 = d.cd[0]; |
| 2164 | var cd = d.cd[index] || {}; |
| 2165 | |
| 2166 | function pass(v) { |
| 2167 | return v || (isNumeric(v) && v === 0); |
| 2168 | } |
| 2169 | |
| 2170 | var getVal = Array.isArray(index) |
| 2171 | ? function (calcKey, traceKey) { |
| 2172 | var v = Lib.castOption(cd0, index, calcKey); |
| 2173 | return pass(v) ? v : Lib.extractOption({}, trace, '', traceKey); |
| 2174 | } |
| 2175 | : function (calcKey, traceKey) { |
| 2176 | return Lib.extractOption(cd, trace, calcKey, traceKey); |
| 2177 | }; |
| 2178 | |
| 2179 | function fill(key, calcKey, traceKey) { |
| 2180 | var val = getVal(calcKey, traceKey); |
| 2181 | if (pass(val)) d[key] = val; |
| 2182 | } |
| 2183 | |
| 2184 | fill('hoverinfo', 'hi', 'hoverinfo'); |
| 2185 | fill('bgcolor', 'hbg', 'hoverlabel.bgcolor'); |
| 2186 | fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); |
| 2187 | fill('fontFamily', 'htf', 'hoverlabel.font.family'); |
| 2188 | fill('fontSize', 'hts', 'hoverlabel.font.size'); |
| 2189 | fill('fontColor', 'htc', 'hoverlabel.font.color'); |
| 2190 | fill('fontWeight', 'htw', 'hoverlabel.font.weight'); |
| 2191 | fill('fontStyle', 'hty', 'hoverlabel.font.style'); |
| 2192 | fill('fontVariant', 'htv', 'hoverlabel.font.variant'); |
| 2193 | fill('nameLength', 'hnl', 'hoverlabel.namelength'); |
| 2194 | fill('textAlign', 'hta', 'hoverlabel.align'); |
| 2195 | |
| 2196 | d.posref = |
| 2197 | hovermode === 'y' || (hovermode === 'closest' && trace.orientation === 'h') |
| 2198 | ? d.xa._offset + (d.x0 + d.x1) / 2 |
| 2199 | : d.ya._offset + (d.y0 + d.y1) / 2; |
| 2200 | |
| 2201 | // then constrain all the positions to be on the plot |
| 2202 | d.x0 = Lib.constrain(d.x0, 0, d.xa._length); |
| 2203 | d.x1 = Lib.constrain(d.x1, 0, d.xa._length); |
| 2204 | d.y0 = Lib.constrain(d.y0, 0, d.ya._length); |
| 2205 | d.y1 = Lib.constrain(d.y1, 0, d.ya._length); |
| 2206 | |
| 2207 | // and convert the x and y label values into formatted text |
| 2208 | if (d.xLabelVal !== undefined) { |
| 2209 | d.xLabel = 'xLabel' in d ? d.xLabel : Axes.hoverLabelText(d.xa, d.xLabelVal, trace.xhoverformat); |
| 2210 | d.xVal = d.xa.c2d(d.xLabelVal); |
| 2211 | } |
| 2212 | if (d.yLabelVal !== undefined) { |
| 2213 | d.yLabel = 'yLabel' in d ? d.yLabel : Axes.hoverLabelText(d.ya, d.yLabelVal, trace.yhoverformat); |
| 2214 | d.yVal = d.ya.c2d(d.yLabelVal); |
| 2215 | } |
| 2216 | |
| 2217 | // Traces like heatmaps generate the zLabel in their hoverPoints function |
no test coverage detected
searching dependent graphs…