function layoutSingleSeries(seriesModel, offset, boxWidth) {
    var coordSys = seriesModel.coordinateSystem;
    var data = seriesModel.getData();
    var halfWidth = boxWidth / 2;
    var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
    var vDimIdx = 1 - cDimIdx;
    var coordDims = ['x', 'y'];
    var cDim = data.mapDimension(coordDims[cDimIdx]);
    var vDims = data.mapDimension(coordDims[vDimIdx], true);

    if (cDim == null || vDims.length < 5) {
        return;
    }

    for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
        var axisDimVal = data.get(cDim, dataIndex);

        var median = getPoint(axisDimVal, vDims[2], dataIndex);
        var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
        var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
        var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
        var end5 = getPoint(axisDimVal, vDims[4], dataIndex);

        var ends = [];
        addBodyEnd(ends, end2, 0);
        addBodyEnd(ends, end4, 1);

        ends.push(end1, end2, end5, end4);
        layEndLine(ends, end1);
        layEndLine(ends, end5);
        layEndLine(ends, median);

        data.setItemLayout(dataIndex, {
            initBaseline: median[vDimIdx],
            ends: ends
        });
    }

    function getPoint(axisDimVal, dimIdx, dataIndex) {
        var val = data.get(dimIdx, dataIndex);
        var p = [];
        p[cDimIdx] = axisDimVal;
        p[vDimIdx] = val;
        var point;
        if (isNaN(axisDimVal) || isNaN(val)) {
            point = [NaN, NaN];
        }
        else {
            point = coordSys.dataToPoint(p);
            point[cDimIdx] += offset;
        }
        return point;
    }

    function addBodyEnd(ends, point, start) {
        var point1 = point.slice();
        var point2 = point.slice();
        point1[cDimIdx] += halfWidth;
        point2[cDimIdx] -= halfWidth;
        start
            ? ends.push(point1, point2)
            : ends.push(point2, point1);
    }

    function layEndLine(ends, endCenter) {
        var from = endCenter.slice();
        var to = endCenter.slice();
        from[cDimIdx] -= halfWidth;
        to[cDimIdx] += halfWidth;
        ends.push(from, to);
    }
}
function layoutSingleSeries(seriesModel, offset, boxWidth) {
    var coordSys = seriesModel.coordinateSystem;
    var data = seriesModel.getData();
    var halfWidth = boxWidth / 2;
    var cDimIdx = seriesModel.get('layout') === 'horizontal' ? 0 : 1;
    var vDimIdx = 1 - cDimIdx;
    var coordDims = ['x', 'y'];
    var cDim = data.mapDimension(coordDims[cDimIdx]);
    var vDims = data.mapDimension(coordDims[vDimIdx], true);

    if (cDim == null || vDims.length < 5) {
        return;
    }

    for (var dataIndex = 0; dataIndex < data.count(); dataIndex++) {
        var axisDimVal = data.get(cDim, dataIndex);

        var median = getPoint(axisDimVal, vDims[2], dataIndex);
        var end1 = getPoint(axisDimVal, vDims[0], dataIndex);
        var end2 = getPoint(axisDimVal, vDims[1], dataIndex);
        var end4 = getPoint(axisDimVal, vDims[3], dataIndex);
        var end5 = getPoint(axisDimVal, vDims[4], dataIndex);

        var ends = [];
        addBodyEnd(ends, end2, 0);
        addBodyEnd(ends, end4, 1);

        ends.push(end1, end2, end5, end4);
        layEndLine(ends, end1);
        layEndLine(ends, end5);
        layEndLine(ends, median);

        data.setItemLayout(dataIndex, {
            initBaseline: median[vDimIdx],
            ends: ends
        });
    }

    function getPoint(axisDimVal, dimIdx, dataIndex) {
        var val = data.get(dimIdx, dataIndex);
        var p = [];
        p[cDimIdx] = axisDimVal;
        p[vDimIdx] = val;
        var point;
        if (isNaN(axisDimVal) || isNaN(val)) {
            point = [NaN, NaN];
        }
        else {
            point = coordSys.dataToPoint(p);
            point[cDimIdx] += offset;
        }
        return point;
    }

    function addBodyEnd(ends, point, start) {
        var point1 = point.slice();
        var point2 = point.slice();
        point1[cDimIdx] += halfWidth;
        point2[cDimIdx] -= halfWidth;
        start
            ? ends.push(point1, point2)
            : ends.push(point2, point1);
    }

    function layEndLine(ends, endCenter) {
        var from = endCenter.slice();
        var to = endCenter.slice();
        from[cDimIdx] -= halfWidth;
        to[cDimIdx] += halfWidth;
        ends.push(from, to);
    }
}
function layoutSingleSeries ( seriesModel , offset , boxWidth ) { var coordSys = seriesModel . coordinateSystem ; var data = seriesModel . getData ( ) ; var halfWidth = boxWidth / 2 ; var cDimIdx = seriesModel . get ( 'layout' ) === 'horizontal' ? 0 : 1 ; var vDimIdx = 1 - cDimIdx ; var coordDims = [ 'x' , 'y' ] ; var cDim = data . mapDimension ( coordDims [ cDimIdx ] ) ; var vDims = data . mapDimension ( coordDims [ vDimIdx ] , true ) ; if ( cDim == null || vDims . length < 5 ) { return ; } for ( var dataIndex = 0 ; dataIndex < data . count ( ) ; dataIndex ++ ) { var axisDimVal = data . get ( cDim , dataIndex ) ; var median = getPoint ( axisDimVal , vDims [ 2 ] , dataIndex ) ; var end1 = getPoint ( axisDimVal , vDims [ 0 ] , dataIndex ) ; var end2 = getPoint ( axisDimVal , vDims [ 1 ] , dataIndex ) ; var end4 = getPoint ( axisDimVal , vDims [ 3 ] , dataIndex ) ; var end5 = getPoint ( axisDimVal , vDims [ 4 ] , dataIndex ) ; var ends = [ ] ; addBodyEnd ( ends , end2 , 0 ) ; addBodyEnd ( ends , end4 , 1 ) ; ends . push ( end1 , end2 , end5 , end4 ) ; layEndLine ( ends , end1 ) ; layEndLine ( ends , end5 ) ; layEndLine ( ends , median ) ; data . setItemLayout ( dataIndex , { initBaseline : median [ vDimIdx ] , ends : ends } ) ; } function getPoint ( axisDimVal , dimIdx , dataIndex ) { var val = data . get ( dimIdx , dataIndex ) ; var p = [ ] ; p [ cDimIdx ] = axisDimVal ; p [ vDimIdx ] = val ; var point ; if ( isNaN ( axisDimVal ) || isNaN ( val ) ) { point = [ NaN , NaN ] ; } else { point = coordSys . dataToPoint ( p ) ; point [ cDimIdx ] += offset ; } return point ; } function addBodyEnd ( ends , point , start ) { var point1 = point . slice ( ) ; var point2 = point . slice ( ) ; point1 [ cDimIdx ] += halfWidth ; point2 [ cDimIdx ] -= halfWidth ; start ? ends . push ( point1 , point2 ) : ends . push ( point2 , point1 ) ; } function layEndLine ( ends , endCenter ) { var from = endCenter . slice ( ) ; var to = endCenter . slice ( ) ; from [ cDimIdx ] -= halfWidth ; to [ cDimIdx ] += halfWidth ; ends . push ( from , to ) ; } }
Calculate points location for each series.
Calculate points location for each series .
Layouts a single series