score:1

Accepted answer

What about setting the x values for those lines? http://jsfiddle.net/qPqCW/

, {
        name: "Revenue",
        data: [
            {x:-0.2, y:49},
            {x:0.8, y:71.5},
            {x:1.8, y:106.4}],
        type: "line"
    }, 

, {
        name: "Operating Expenses",
        data: [
            {x:.2,y:48.9},
            {x:1.2, y:38.8},
            {x:2.2, y:39.3}],
        type: "line"
    }

To calculate the X values, I looked to the source code. The following assumes you are using the default values of groupPadding .2, and pointPadding .1. I modified the getColumnMetrics function to get the general solution. Here's what I came up with:

var columnMetrics = [];
    for (j=0;j<index;j++) {

        var categoryWidth = 1,
            groupPadding = categoryWidth * .2,
            groupWidth = categoryWidth - 2 * groupPadding,
            pointOffsetWidth = groupWidth / index,
            pointPadding =  pointOffsetWidth * .1,
            pointWidth = pointOffsetWidth - 2 * pointPadding, 
            colIndex =  j,
            pointXOffset = pointPadding + (groupPadding + colIndex *
                pointOffsetWidth - (categoryWidth / 2));

        columnMetrics.push( { 
            width: pointWidth, 
            offset: pointXOffset,
            center: pointXOffset + (pointWidth /2.0)
        });
    }
    var series = [];
    for(i=0;i<index;i++) {
        series.push({
            name: "Column" + index,
            data: [
            49.9,
            71.5,
            106.4],
            type: "column"
        });
        series.push({
            name: "Line" + index,
            data: [
                {x:0 + columnMetrics[i].center, y:49},
                {x:1 + columnMetrics[i].center, y:71.5},
                {x:2 + columnMetrics[i].center, y:106.4}],
            type: "line"
        });
    }

This shows the results with 1 to 10 series: http://jsfiddle.net/b8gS5/


Related Query

More Query from same tag