javascript - 使用 Highcharts 将条形图显示为箭头

标签 javascript charts highcharts visualization

是否可以使用 Highcharts.js 绘制柱形条形图,其中一个条形显示为箭头?

我有以下图表

$(function () {

$('#container').highcharts({
    chart: {
        type: 'column'
    },
    title: {
        text: 'Title'
    },
    xAxis: {
        categories: [
            '2016',
            '2017',
            '2018'
        ]
    },
    yAxis: [{
        min: 0,
        title: {
            text: 'Header'
        }
    }, {
        title: {
            text: ''
        },
        opposite: true
    }],
    legend: {
        shadow: false
    },
    tooltip: {
        shared: true
    },
    plotOptions: {
        column: {
            grouping: false,
            shadow: false,
            borderWidth: 0,



        }

    },
    series: [{
        name: 'Bar1',
        color: 'rgba(165,170,217,1)',
        data: [150, 73, 20],
        pointPadding: 0.3,
        pointPlacement: -0.0
    }, {
        name: 'Bar2',
        color: 'rgba(126,86,134,.9)',
        data: [140, 90, 40],
        pointPadding: 0.4,
        pointPlacement: -0.0

    },{
        name: 'Bar3',
        color: 'rgba(100,86,100,.9)',
        data: [120, 70, 50],
        pointPadding: 0.43,
        pointPlacement: -0.0
    },{
        name: 'Bar4',
        color: 'rgba(126,86,100,.9)',
        data: [100, 70, 50],
        pointPadding: 0.43,
        pointPlacement: -0.2


    }]
});

});

https://jsfiddle.net/hha2o3bu/我希望最后一个栏显示为箭头或带有箭头提示。

感谢您的帮助。

最佳答案

我建议为箭头添加一个带有三 Angular 形标记的“虚拟”线系列。我从 Highcharts 论坛的一篇提出类似问题的帖子中得到了灵感(请参阅 http://forum.highcharts.com/highcharts-usage/creating-an-arrowhead-with-the-renderer-t27746/ )。

这是我编写的代码,并对每个部分的功能进行了注释:

/* dummy series */
{ 
    name: 'marker series', 
    type: 'line', 
    lineColor: 'transparent', /* makes line invisible */
    data: [null,null,50], /* use nulls where you don't want arrowheads to appear */
    showInLegend: false, /* will not show in legend */
    enableMouseTracking: false, /* users can't interact with the series */
    marker: {
        symbol: 'triangle', 
        fillColor: 'rgba(126,86,100,.9)', /* match to the color of your column */
        radius:25
    }
}

查看工作 fiddle :https://jsfiddle.net/brightmatrix/hha2o3bu/2/

希望这对您有帮助!

enter image description here

关于javascript - 使用 Highcharts 将条形图显示为箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37148788/

相关文章:

javascript - 更新 DecalGeometry 顶点、UV、

javascript - 工厂方法中的数据更改后 AngularJS 范围不更新

javascript - x 轴上 dateTime 的 Highcharts 最大间隔?

javascript - 在末尾获取 url 的最后一部分

javascript - Node 表达父文件夹

javascript - 没有静态 ID 的 jqPlot 目标

html - Google 图表仪表板未扩展至 100% 高度?

javascript - 如何将我的数据传递到 google 图表 api?

javascript - 如何让 Highcharts 栏消失?

Ember.js 和 Highcharts : how to render a graph only after slow-loading model data has been loaded?