(series, opts, config, context)
| 2008 | } |
| 2009 | |
| 2010 | function drawColumnDataPoints(series, opts, config, context) { |
| 2011 | let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; |
| 2012 | let ranges = [].concat(opts.chartData.yAxisData.ranges); |
| 2013 | let xAxisData = opts.chartData.xAxisData, |
| 2014 | xAxisPoints = xAxisData.xAxisPoints, |
| 2015 | eachSpacing = xAxisData.eachSpacing; |
| 2016 | let columnOption = assign({}, { |
| 2017 | type: 'group', |
| 2018 | width: eachSpacing / 2, |
| 2019 | meter: { |
| 2020 | border: 4, |
| 2021 | fillColor: '#FFFFFF' |
| 2022 | } |
| 2023 | }, opts.extra.column); |
| 2024 | let minRange = ranges.pop(); |
| 2025 | let maxRange = ranges.shift(); |
| 2026 | let calPoints = []; |
| 2027 | |
| 2028 | context.save(); |
| 2029 | if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { |
| 2030 | context.translate(opts._scrollDistance_, 0); |
| 2031 | } |
| 2032 | if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) { |
| 2033 | drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing); |
| 2034 | } |
| 2035 | |
| 2036 | series.forEach(function(eachSeries, seriesIndex) { |
| 2037 | var data = eachSeries.data; |
| 2038 | switch (columnOption.type) { |
| 2039 | case 'group': |
| 2040 | var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); |
| 2041 | var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process); |
| 2042 | calPoints.push(tooltipPoints); |
| 2043 | points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts); |
| 2044 | points.forEach(function(item, index) { |
| 2045 | if (item !== null) { |
| 2046 | context.beginPath(); |
| 2047 | context.setStrokeStyle(item.color || eachSeries.color); |
| 2048 | context.setLineWidth(1) |
| 2049 | context.setFillStyle(item.color || eachSeries.color); |
| 2050 | var startX = item.x - item.width / 2; |
| 2051 | var height = opts.height - item.y - opts.area[2]; |
| 2052 | context.moveTo(startX-1, item.y); |
| 2053 | context.lineTo(startX+item.width-2,item.y); |
| 2054 | context.lineTo(startX+item.width-2,opts.height - opts.area[2]); |
| 2055 | context.lineTo(startX,opts.height - opts.area[2]); |
| 2056 | context.lineTo(startX,item.y); |
| 2057 | //context.rect(startX, item.y, item.width, height); |
| 2058 | context.closePath(); |
| 2059 | context.stroke(); |
| 2060 | context.fill(); |
| 2061 | } |
| 2062 | }); |
| 2063 | break; |
| 2064 | case 'stack': |
| 2065 | // 绘制堆叠数据图 |
| 2066 | var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, |
| 2067 | seriesIndex, |
no test coverage detected