highCharts 常見用法整理

highCharts用法

tooltip

tooltip: {
  valueDecimals: 0,  // 保留幾位小數
  shared: true,  // 提示框被共享,有序數據的系列類型將被顯示在同一個提示框中
  crosshairs: true,
  // 時間格式化字符
  // 默認會根據當前的數據點間隔取對應的值
  // 圖表中數據點間隔爲 1天,配置 day 值即可
  dateTimeLabelFormats: {
    millisecond: '%H:%M:%S.%L',
    second: '%H:%M:%S',
    minute: '%Y-%m-%d %H:%M',
    hour: '%Y-%m-%d %H:%M',
    day: '%Y-%m-%d',
    week: '%m-%d',
    month: '%Y-%m',
    year: '%Y'
  }
},

xAxis

xAxis: {
  type: 'datetime',
  tickInterval: 1000 * 60 * 60 * 24 * 365,
  // milliseconds * seconds * minutes * hours * days = 1 year
  crosshair: true,  //十字準星線
  dateTimeLabelFormats: {
    day: '%m-%d',
    hour: '%H:%M',
    minute: '%H:%M',
    month: '%Y-%m',
  },
  // labels: {
  //   formatter: (x)=>{
  //     return x.value
  //   }
  // }
},

yAxis

yAxis: {
  title: {
    text: '數量',
  },
  crosshair: true,  //十字準星線
},
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章