(series, opts, config, context)
| 2425 | } |
| 2426 | |
| 2427 | function drawLineDataPoints(series, opts, config, context) { |
| 2428 | var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; |
| 2429 | var lineOption = opts.extra.line || { |
| 2430 | type: 'straight', |
| 2431 | width: 2 |
| 2432 | }; |
| 2433 | lineOption.type = lineOption.type ? lineOption.type : 'straight'; |
| 2434 | lineOption.width = lineOption.width ? lineOption.width : 2; |
| 2435 | |
| 2436 | let ranges = [].concat(opts.chartData.yAxisData.ranges); |
| 2437 | let xAxisData = opts.chartData.xAxisData, |
| 2438 | xAxisPoints = xAxisData.xAxisPoints, |
| 2439 | eachSpacing = xAxisData.eachSpacing; |
| 2440 | |
| 2441 | var minRange = ranges.pop(); |
| 2442 | var maxRange = ranges.shift(); |
| 2443 | var calPoints = []; |
| 2444 | |
| 2445 | context.save(); |
| 2446 | if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { |
| 2447 | context.translate(opts._scrollDistance_, 0); |
| 2448 | } |
| 2449 | |
| 2450 | series.forEach(function(eachSeries, seriesIndex) { |
| 2451 | var data = eachSeries.data; |
| 2452 | var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); |
| 2453 | calPoints.push(points); |
| 2454 | var splitPointList = splitPoints(points); |
| 2455 | |
| 2456 | splitPointList.forEach(function(points, index) { |
| 2457 | context.beginPath(); |
| 2458 | context.setStrokeStyle(eachSeries.color); |
| 2459 | context.setLineWidth(lineOption.width * opts.pixelRatio); |
| 2460 | if (points.length === 1) { |
| 2461 | context.moveTo(points[0].x, points[0].y); |
| 2462 | context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI); |
| 2463 | } else { |
| 2464 | context.moveTo(points[0].x, points[0].y); |
| 2465 | if (lineOption.type === 'curve') { |
| 2466 | points.forEach(function(item, index) { |
| 2467 | if (index > 0) { |
| 2468 | var ctrlPoint = createCurveControlPoints(points, index - 1); |
| 2469 | context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, |
| 2470 | item.x, item |
| 2471 | .y); |
| 2472 | } |
| 2473 | }); |
| 2474 | } else { |
| 2475 | points.forEach(function(item, index) { |
| 2476 | if (index > 0) { |
| 2477 | context.lineTo(item.x, item.y); |
| 2478 | } |
| 2479 | }); |
| 2480 | } |
| 2481 | context.moveTo(points[0].x, points[0].y); |
| 2482 | } |
| 2483 | context.closePath(); |
| 2484 | context.stroke(); |
no test coverage detected