X轴未在高图表

时间:2017-12-01 12:21:32

标签: javascript highcharts

我使用高图表lib来渲染日期时间柱形图。但是x轴没有采用图表的确切起始值。在下面的示例中,我们需要在12th NOV x-axis

之前设置条宽
chart: {
            type: 'column',
            width : 709,
            marginTop : 100,
            reflow: false
        },
        exporting: {
          enabled: false
        },
      credits: {
        enabled: false
      },
            colors: ["#00ACE6", "#EA8939", "#2D8093", "#EB5C6A", "#D9A300", "#1B7CDE", "#8D69E0", "#378A4E", "#4F5A65"],
      xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
          month: '%e %b',
          year: '%b'
        },
      },
      yAxis: {
        allowDecimals: false,
        min: 0,
      },
      plotOptions: {
        column: {
          stacking: 'normal'
        },
        series: {
          animation: false
        }
      },
        series:[{"name":"sent","data":[],"stack":"sent","_colorIndex":0},{"name":" received","data":[],"stack":"received","_colorIndex":1},{"name":"1 sent","data":[[1511136000000,1],[1510531200000,1],[1510444800000,1]],"stack":"sent","_colorIndex":2},{"name":"1 received","data":[],"stack":"received","_colorIndex":3},{"name":" made","data":[[1510531200000,1],[1510444800000,2]],"stack":"sent","_colorIndex":4},{"name":" received","data":[],"stack":"received","_colorIndex":5}], //Server data
        loading: {
          style: {
            marginTop: "-25px"
          }
        }

    });

js小提琴链接:http://jsfiddle.net/L94731ge/5/

请你帮我解决一下。

1 个答案:

答案 0 :(得分:0)

startOnTick添加xAxis可能会更正您的图表

xAxis: {
    type: 'datetime',
            startOnTick:true,
    dateTimeLabelFormats: {
      month: '%e %b',
      year: '%b'
    },
  },

请查看此fiddle