(text)
| 374 | } |
| 375 | |
| 376 | function measureText(text) { |
| 377 | var fontSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : config.fontSize; |
| 378 | text = String(text); |
| 379 | var text = text.split(''); |
| 380 | var width = 0; |
| 381 | for (let i = 0; i < text.length; i++) { |
| 382 | let item = text[i]; |
| 383 | if (/[a-zA-Z]/.test(item)) { |
| 384 | width += 7; |
| 385 | } else if (/[0-9]/.test(item)) { |
| 386 | width += 5.5; |
| 387 | } else if (/\./.test(item)) { |
| 388 | width += 2.7; |
| 389 | } else if (/-/.test(item)) { |
| 390 | width += 3.25; |
| 391 | } else if (/[\u4e00-\u9fa5]/.test(item)) { |
| 392 | width += 10; |
| 393 | } else if (/\(|\)/.test(item)) { |
| 394 | width += 3.73; |
| 395 | } else if (/\s/.test(item)) { |
| 396 | width += 2.5; |
| 397 | } else if (/%/.test(item)) { |
| 398 | width += 8; |
| 399 | } else { |
| 400 | width += 10; |
| 401 | } |
| 402 | } |
| 403 | return width * fontSize / 10; |
| 404 | } |
| 405 | |
| 406 | function dataCombine(series) { |
| 407 | return series.reduce(function(a, b) { |
no outgoing calls
no test coverage detected