- var label = formatter(tickV, 0, opts, dygraph);
- if (k_labels.length > 0) {
- // TODO(danvk): should this be integrated into the axisLabelFormatter?
- // Round up to an appropriate unit.
- var n = pow(k, k_labels.length);
- for (j = k_labels.length - 1; j >= 0; j--, n /= k) {
- if (absTickV >= n) {
- label = Dygraph.round_(tickV / n, digitsAfterDecimal) + k_labels[j];
- break;
- }
- }
- }
- if(opts("labelsKMG2")){
- tickV = String(tickV.toExponential());
- if(tickV.split('e-').length === 2 && tickV.split('e-')[1] >= 3 && tickV.split('e-')[1] <= 24){
- if(tickV.split('e-')[1] % 3 > 0) {
- label = Dygraph.round_(tickV.split('e-')[0] /
- pow(10,(tickV.split('e-')[1] % 3)),
- digitsAfterDecimal);
- } else {
- label = Number(tickV.split('e-')[0]).toFixed(2);
- }
- label += m_labels[Math.floor(tickV.split('e-')[1] / 3) - 1];
- }
- }
- ticks[i].label = label;
+ ticks[i].label = formatter(ticks[i].v, 0, opts, dygraph);