(series, opts, config, context)
| 2510 | } |
| 2511 | |
| 2512 | function drawMixDataPoints(series, opts, config, context) { |
| 2513 | let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; |
| 2514 | let ranges = [].concat(opts.chartData.yAxisData.ranges); |
| 2515 | let xAxisData = opts.chartData.xAxisData, |
| 2516 | xAxisPoints = xAxisData.xAxisPoints, |
| 2517 | eachSpacing = xAxisData.eachSpacing; |
| 2518 | |
| 2519 | let minRange = ranges.pop(); |
| 2520 | let maxRange = ranges.shift(); |
| 2521 | let endY = opts.height - opts.area[2]; |
| 2522 | let calPoints = []; |
| 2523 | |
| 2524 | var columnIndex = 0; |
| 2525 | var columnLength = 0; |
| 2526 | series.forEach(function(eachSeries, seriesIndex) { |
| 2527 | if (eachSeries.type == 'column') { |
| 2528 | columnLength += 1; |
| 2529 | } |
| 2530 | }); |
| 2531 | context.save(); |
| 2532 | if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { |
| 2533 | context.translate(opts._scrollDistance_, 0); |
| 2534 | } |
| 2535 | |
| 2536 | series.forEach(function(eachSeries, seriesIndex) { |
| 2537 | var data = eachSeries.data; |
| 2538 | var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); |
| 2539 | calPoints.push(points); |
| 2540 | |
| 2541 | // 绘制柱状数据图 |
| 2542 | if (eachSeries.type == 'column') { |
| 2543 | points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts); |
| 2544 | points.forEach(function(item, index) { |
| 2545 | if (item !== null) { |
| 2546 | context.beginPath(); |
| 2547 | context.setStrokeStyle(item.color || eachSeries.color); |
| 2548 | context.setLineWidth(1) |
| 2549 | context.setFillStyle(item.color || eachSeries.color); |
| 2550 | var startX = item.x - item.width / 2; |
| 2551 | var height = opts.height - item.y - opts.area[2]; |
| 2552 | context.moveTo(startX, item.y); |
| 2553 | context.moveTo(startX-1, item.y); |
| 2554 | context.lineTo(startX+item.width-2,item.y); |
| 2555 | context.lineTo(startX+item.width-2,opts.height - opts.area[2]); |
| 2556 | context.lineTo(startX,opts.height - opts.area[2]); |
| 2557 | context.lineTo(startX,item.y); |
| 2558 | //context.rect(startX, item.y, item.width, height); |
| 2559 | context.closePath(); |
| 2560 | context.stroke(); |
| 2561 | context.fill(); |
| 2562 | context.closePath(); |
| 2563 | context.fill(); |
| 2564 | } |
| 2565 | }); |
| 2566 | columnIndex += 1; |
| 2567 | } |
| 2568 | |
| 2569 | //绘制区域图数据 |
no test coverage detected