简体   繁体   English

高图:向反转的柱形图系列添加符号

[英]Highcharts: adding symbol to inverted columnrange chart series

I'm looking to develop a gantt chart from highcharts using an inverted columnrange chart and need to ability to visualize milestones (a highcharts symbol?) for a given data point. 我正在寻找使用反向列范围图从highcharts开发甘特图,并且需要能够可视化给定数据点的里程碑(highcharts符号?)。 What I have so far: http://jsfiddle.net/gys2jxhw/ . 到目前为止,我所拥有的: http : //jsfiddle.net/gys2jxhw/ Is this possible? 这可能吗?

$(function () { $(函数(){

$('#container').highcharts({

    chart: {
        type: 'columnrange',
        inverted: true
    },

    title: {
        text: 'Project Deliverables'
    },

    xAxis: {
        categories: ['Task X']
    },

    yAxis: {
        title: {
            text: 'Timeline'
        },            
        type: 'datetime'
    },

    tooltip: {
        xDateFormat: '%Y-%m-%d'
    },

    plotOptions: {
        columnrange: {
            dataLabels: {
                enabled: false,
                formatter: function () {
                    return this.y;
                }
            }
        }
    },

    legend: {
        enabled: false
    },

    series: [{
        name: 'Timeline',
        data: [{
            low:Date.UTC(2013,5,2), 
            high: [Date.UTC(2013,5,12)]
        }]
    }]
});

}); });

You can use a scatter series to place a point anywhere you want. 您可以使用散点图系列将点放置在所需的任何位置。

So, with your series setup: 因此,通过系列设置:

series: [{
  name: 'Timeline',
  data: [{
    low: Date.UTC(2013, 5, 2),
    high: [Date.UTC(2013, 5, 12)]
  }]
}]

Add a second series that is type: scatter, and place the point wherever you need it: 添加第二个类型为:散点图的序列,并将该点放置在需要的位置:

series: [{
  name: 'Timeline',
  data: [{
    low: Date.UTC(2013, 5, 2),
    high: [Date.UTC(2013, 5, 12)]
  }]
}, {
  name: 'Marker',
  type: 'scatter',
  data: [
    [0, Date.UTC(2013, 5, 12, 12, 0, 0)]
  ]
}]

Updated fiddle: 更新的小提琴:

You could then further enhance the value by using the tooltip, and/or the data label, to communicate additional information. 然后,您可以使用工具提示和/或数据标签来传达其他信息,从而进一步提高价值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM