如何动态绘制HighChart XAxis

Pra*_*eep 4 jquery highcharts

我正在绘制一个高图 -

options.series.push({ name: this.SubCity, data: this.Data });
Run Code Online (Sandbox Code Playgroud)

其中data是一系列数据的数组.

我还有一个xAxis Categeries阵列 -

 Categ['Jan-Mar', 'Apr-Jun', 'Jul-Sep', 'Oct-Dec']
Run Code Online (Sandbox Code Playgroud)

我的图表绘制正确但xAxis类别的问题是我不知道如何动态设置类别.

为了更清楚,我正在添加一些代码 -

 var PriceTrend = JSON.parse(Data);
 var AvgRate = new Array();
 var Categories = new Array();

 $(PriceTrend).each(function (index)
        {
            MaxRate.push(this.Max);
            MinRate.push(this.Min);
            AvgRate.push((this.Max + this.Min) / 2);
            Categories.push(this.Quarter);
        });


        TrendData.push({ SeriesID: SeriesID, Data: AvgRate, Visible: true, SubCity: SubCity, Categ: Categories });

        DisplayTrend();


function DisplayTrend()
{
options.series = [];

$(TrendData).each(function (Index)
{
    if (this.Visible)
    {
        options.series.push({ name: this.SubCity, data: this.Data });
    }
});
chart = new Highcharts.Chart(options);
Run Code Online (Sandbox Code Playgroud)

}

Mar*_*ark 7

您正在寻找该Axis.update()方法.

Highcharts.charts[0].xAxis[0].update({categories:['some','new','categories']}, true);
Run Code Online (Sandbox Code Playgroud)

这是一个例子.

动画x轴更新