RTL(从右到左)模式

Gantt 图表支持从右到左(RTL)模式,可以通过 rtl 配置项进行激活。
当该选项设置为 true 时,时间轴的时间刻度方向会发生变化,网格中的行顺序也会反转,从右向左排列。

gantt.config.rtl = true;

启用 rtl 模式并不会自动更新 gantt.config.layout,因此需要手动调整布局,将网格和时间轴的位置进行交换。可以按照如下方式设置:

gantt.config.layout = {
    css: "gantt_container",
    rows: [
        {
            cols: [
                {view: "scrollbar", id: "scrollVer"},
                {view: "timeline", scrollX: "scrollHor", scrollY: "scrollVer"},
                {resizer: true, width: 1},
                {view: "grid", scrollX: "scrollHor", scrollY: "scrollVer"}
            ]
        },
        {view: "scrollbar", id: "scrollHor", height: 20}
    ]
};

Related sample:  Right to left gantt

您还可以根据需要调整甘特图中标签的文本方向

Back to top