(series, opts, config, context)
| 2295 | } |
| 2296 | |
| 2297 | function drawAreaDataPoints(series, opts, config, context) { |
| 2298 | var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; |
| 2299 | var areaOption = assign({},{ |
| 2300 | type: 'straight', |
| 2301 | opacity: 0.2, |
| 2302 | addLine: false, |
| 2303 | width: 2 |
| 2304 | },opts.extra.area); |
| 2305 | |
| 2306 | let ranges = [].concat(opts.chartData.yAxisData.ranges); |
| 2307 | let xAxisData = opts.chartData.xAxisData, |
| 2308 | xAxisPoints = xAxisData.xAxisPoints, |
| 2309 | eachSpacing = xAxisData.eachSpacing; |
| 2310 | |
| 2311 | let minRange = ranges.pop(); |
| 2312 | let maxRange = ranges.shift(); |
| 2313 | let endY = opts.height - opts.area[2]; |
| 2314 | let calPoints = []; |
| 2315 | |
| 2316 | context.save(); |
| 2317 | if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { |
| 2318 | context.translate(opts._scrollDistance_, 0); |
| 2319 | } |
| 2320 | |
| 2321 | series.forEach(function(eachSeries, seriesIndex) { |
| 2322 | let data = eachSeries.data; |
| 2323 | let points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); |
| 2324 | calPoints.push(points); |
| 2325 | |
| 2326 | let splitPointList = splitPoints(points); |
| 2327 | |
| 2328 | for (let i = 0; i < splitPointList.length; i++) { |
| 2329 | let points = splitPointList[i]; |
| 2330 | // 绘制区域数 |
| 2331 | context.beginPath(); |
| 2332 | context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity)); |
| 2333 | context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity)); |
| 2334 | context.setLineWidth(areaOption.width * opts.pixelRatio); |
| 2335 | if (points.length > 1) { |
| 2336 | let firstPoint = points[0]; |
| 2337 | let lastPoint = points[points.length - 1]; |
| 2338 | |
| 2339 | context.moveTo(firstPoint.x, firstPoint.y); |
| 2340 | if (areaOption.type === 'curve') { |
| 2341 | points.forEach(function(item, index) { |
| 2342 | if (index > 0) { |
| 2343 | let ctrlPoint = createCurveControlPoints(points, index - 1); |
| 2344 | context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x, item.y); |
| 2345 | } |
| 2346 | }); |
| 2347 | } else { |
| 2348 | points.forEach(function(item, index) { |
| 2349 | if (index > 0) { |
| 2350 | context.lineTo(item.x, item.y); |
| 2351 | } |
| 2352 | }); |
| 2353 | } |
| 2354 |
no test coverage detected