柱形图后面的样条曲线

时间:2014-07-15 09:36:12

标签: javascript highcharts

我有一个柱形图,每个点有两列和n个样条线。样条曲线在IE8中的列后面呈现,但在chrome中工作正常,我需要在IE8中工作。

Chart Image

series: [{ data: [minReturn], name: "Minimum Projected Return" }, { data: [maxReturn], name: "Maxmimum Projected Return" },
    {
        type: 'spline',
        name: 'Target - ' + targetName0 + " : " + targetReturn0 + "%",
        data: [targetReturn0],
        marker: {
            lineWidth: 2,
            lineColor: Highcharts.getOptions().colors[3],
            fillColor: 'white'
        }
    }]

我动态添加了额外的样条线:

riskReturnoptions.series.push({ type: 'spline', name: 'Target - ' + $('#targetname' + i).val() + " : " + parseFloat($('#targetreturn' + i).val()) + "%", data: [parseFloat($('#targetreturn' + i).val())], marker: { lineWidth: 2, lineColor: Highcharts.getOptions().colors[3], fillColor: 'white'} });

然后为每个系列添加点:

var pointcounter = 3;
    riskReturnchart.xAxis[0].setCategories(categoryArray);
    riskReturnchart.series[0].addPoint(minReturn);
    riskReturnchart.series[1].addPoint(maxReturn);
    riskReturnchart.series[2].addPoint(targetReturn0);
    for (i = 1; i <= targetno; i++) {
        riskReturnchart.series[pointcounter].addPoint(parseFloat($('#targetreturn' + i).val());
        pointcounter++;
    }
    riskReturnchart.redraw();

1 个答案:

答案 0 :(得分:1)

对于每个系列,您可以设置zIndex,请参阅docs

现在只为样条线设置zIndex高于列。