在Highcharts中格式化工具提示的日期值

时间:2016-11-23 12:00:57

标签: highcharts

我有一个显示日期的Highcharts图表,但工具提示标题显示日期为(例如)1477958400000,当我想要它说" 2016年11月1日星期二"。如何更改工具提示标题上的日期格式?

更新:这是我的Highcharts代码:

Highcharts.chart('div-container', {
    chart: {
        type: 'area'
    },
    title: {
        text: 'Balances'
    },

    tooltip: {
      shared: true,
      useHTML: true,
      pointFormat: '<span style="font-weight: bold;color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',

      valueDecimals: 4
    },

    plotOptions: {
        area: {
            stacking: 'normal',

            lineColor: '#666666',
            lineWidth: 1, 

            marker: {
                lineWidth: 1,
                lineColor: '#666666'
            }
        }
    },

    series: contribution_type_balances_series
});

......这是我的数据:

Date,Series1,Series2,Series3
2016-11-01,51133.8941,5709.6097,22837.8403
2016-11-02,50507.2502,5639.6387,22557.9634
2016-11-03,50967.3341,5644.3896,22576.977
2016-11-04,51310.3385,5663.6562,22654.0417
2016-11-05,51310.3385,5663.6562,22654.0417
2016-11-06,51310.3385,5663.6562,22654.0417
2016-11-07,52434.202,5787.7087,23150.239
2016-11-08,52607.4831,5806.8356,23226.7444
2016-11-09,53741.9039,5932.0534,23727.6028
2016-11-10,54068.759,5968.1318,23871.9127
2016-11-11,54068.759,5968.1318,23871.9127
2016-11-12,54068.759,5968.1318,23871.9127
2016-11-13,54068.759,5968.1318,23871.9127
2016-11-14,55476.6901,6123.5396,24493.53
2016-11-15,55483.3455,6124.2742,24496.4684
2016-11-16,55552.7511,6131.9353,24527.1117
2016-11-17,56104.0877,6147.0583,24587.6056
2016-11-18,56088.9295,6126.8777,24506.8854

1 个答案:

答案 0 :(得分:0)

$(function() {
  Highcharts.chart('container', {
    chart: {
      type: 'area'
    },
    title: {
      text: 'Balances'
    },


    data: {
      csv: document.getElementById('csv').innerHTML
    },

    plotOptions: {
      area: {
        stacking: 'normal',

        lineColor: '#666666',
        lineWidth: 1,

        marker: {
          lineWidth: 1,
          lineColor: '#666666'
        }
      }
    },
    series: [{
      lineWidth: 1
    }]
  });
});

<强> DEMO