为了账号安全,请及时绑定邮箱和手机立即绑定

无论如何要在 xAxis 上居中柱形图

无论如何要在 xAxis 上居中柱形图

C#
江户川乱折腾 2022-11-21 16:26:57
我只想将列居中放置在他们的 xAxis 上,有没有办法做到这一点?这是我的高图代码看起来该列总是从刻度开始,我只想显示 2 个刻度之间的列。检查这个https://imgur.com/lvV006MHighcharts.chart('YearNS', {        chart: {            width: 1200,            height: 450,           type: 'column',            events: {                click: function (e) {                    console.log(e.type, this.name);            },            }        },        exporting: {            enabled: false        },        title: {            text: 'This Year NS vs Last 4 Years'        },        subtitle: {            text: 'Click the columns to view the breakdown by Term. Click again to view by Program. Updated as of ' + MyUpdateDate        },        credits: {            enabled: false        },        xAxis: {            min: 0,            max: 4,            categories: categories        },        yAxis: {            title: {                text: "Number of Students"            }        },        legend: {            enabled: true,            align: 'center',            layout: 'horizontal',            verticalAlign: 'top',            floating: false,            borderWidth: 1,            backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),            shadow: true        },        plotOptions: {            series: {                point: {                    events: {                        click: function () {                            ParamYear = this.category                             var res = ParamYear.substring(0, 4);                          // let urlParams = new URLSearchParams('=');                            window.location = "http://localhost:37590/NewStudentReportTerm?ParYear="  + res                        }                    }                },我希望 th 列出现在这些线之间,每年的中心。这可能吗?
查看完整描述

1 回答

?
森林海

TA贡献2011条经验 获得超2个赞


您需要禁用grouping该系列的选项column:


 plotOptions: {

     column: {

         grouping: false

     }

 }

现场演示:http: //jsfiddle.net/BlackLabel/ow8vkq1f/


API 参考:https ://api.highcharts.com/highcharts/plotOptions.column.grouping


查看完整回答
反对 回复 2022-11-21
  • 1 回答
  • 0 关注
  • 94 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号