首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >HighCharts -增加杆高,减小杆间距

HighCharts -增加杆高,减小杆间距
EN

Stack Overflow用户
提问于 2014-08-28 23:52:00
回答 1查看 12.1K关注 0票数 8

尝试增加条形高度以适应条形内的系列化名称,并尝试缩小串联组之间的默认间隔。"series:[]“部分是,我假设JSON返回函数要填充。从所有慷慨的JSFiddle示例中尝试了许多示例,但都没有结果。我是个菜鸟所以请耐心点。有什么想法吗?到目前为止,我有:http://jsfiddle.net/PeterHanekom/7ue5bkm8/1/

代码语言:javascript
运行
复制
        var options = {
            chart: {
                renderTo: 'container',
                type: 'bar'
            },
            colors: ['#00B9B9', '#527CED', '#A7D36B', '#B9B900', '#0097FF', '#400040', '#EA4D00', '#336699', '#8080C0', '#ADA870'],
            title: {
                text: 'Cluster Totals',
                x: -20 //center
            },
            subtitle: {
                text: 'Dept - Branch',
                x: -20
            },
            xAxis: {
                categories: []

            },
            yAxis: {
                min: 0,
                max: 100,                   
                title: {
                    text: 'Percentage'
                },
                labels: {
                    overflow: 'justify'
                }
            },
            tooltip: {
                formatter: function() {
                        return '<b>'+ this.series.name +'</b><br/>'+
                        this.x +': '+ this.y;
                }
            },
            legend: {
                align: 'center',
                borderWidth: 0
            }, 
            plotOptions: {
                bar: {              
                stacking: 'normal',
                pointWidth: 20,
                pointPadding: 0,
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {
                            alert('later drilldown events');
                        }
                    }
              dataLabels: {
                  enabled: true,
                  inside:true,
                  useHTML: true,
                  align: 'left',
                  color: 'white',
                  style: {
                      fontWeight: 'bold'
                  },                      
                  verticalAlign: 'middle',                      
                  formatter: function () {
                      if (this.series.name) 
                        return '<span style="color:black; height: 25px;">' + this.series.name + ' = ' + this.y + '</span>';
                      else return '';
                  }
                }
                }
            },
            series: []
        }

      $.getJSON("./services/get360Pivot.php?s_Search=" + sOperatorSearch, function(json) 
      {
        options.xAxis.categories = json[0]['data'];
        options.series[0] = json[1];
        options.series[1] = json[2];
        options.series[2] = json[3];
        options.series[3] = json[4];
        chart = new Highcharts.Chart(options);
      });          
EN

回答 1

Stack Overflow用户

发布于 2014-08-29 12:41:28

我认为你需要的选择是groupPadding和pointWidth。例如:

代码语言:javascript
运行
复制
              groupPadding:0.1,
              pointWidth:20,

http://jsfiddle.net/s3t2pL94/

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25559713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档