如何在highcharts中在x轴上绘制终点线

时间:2016-07-21 07:34:13

标签: highcharts

我使用的是Highcharts叠加条形图,但没有像下面的图像那样在值的末尾获取行,有人可以使用构建的API或方法中的Highcharts帮助我。 http://i.stack.imgur.com/y3AVm.png

1 个答案:

答案 0 :(得分:0)

在js代码中创建图像并更改sun.png。

$(function () {


    $('#container').highcharts({
        title: {
            text: 'Combination chart'
        },
        xAxis: {
            categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
        },
        labels: {
            items: [{
                html: 'Total fruit consumption',
                style: {
                    left: '50px',
                    top: '18px',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
                }
            }]
        },
            plotOptions: {
            series: {
                stacking: 'normal'
            }
        },
        series: [{
            type: 'bar',
            name: 'Jane',
            data: [3, 2, 1, 3, 4]
        }, {
            type: 'bar',
            name: 'John',
            data: [2, 3, 5, 7, 6]
        }, {
            type: 'bar',
            name: 'Joe',
            data: [4, 3, 3, 9, 0]
        }, {
            data: [9, 8, 9, 19, 10],
            lineWidth: 0,
            enableMouseTracking: false,

            marker: {
                    symbol:                'url(https://www.highcharts.com/samples/graphics/sun.png)'
                }         
               
        }]
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>