Highcharts Highchart:x-Highchart根据按钮(小时、天、周、月、季度、年)动态更改日期时间标签格式

Highcharts Highchart:x-Highchart根据按钮(小时、天、周、月、季度、年)动态更改日期时间标签格式,highcharts,Highcharts,Highchrt:x轴上的点击时间按钮日期格式将为小时,x轴上的点击日期按钮将为天(一周中的某一天(周一、周日、周二等))需要显示周、日、月、季度、年等 if (e.rangeSelectorButton.type === "month") { this.update( { minorTickInterval: 30 * 24 * 3600 * 1000 }, false ); } if (e.rangeSelectorButton.type ===

Highchrt:x轴上的点击时间按钮日期格式将为小时,x轴上的点击日期按钮将为天(一周中的某一天(周一、周日、周二等))需要显示周、日、月、季度、年等

if (e.rangeSelectorButton.type === "month") {
  this.update(
    {
      minorTickInterval: 30 * 24 * 3600 * 1000
    },
    false
  );
}
if (e.rangeSelectorButton.type === "year") {
  this.update(
    {
      tickInterval: 12 * 30 * 24 * 3600 * 1000,
      minorTickInterval: 30 * 24 * 3600 * 1000
    },
    false
  );
}
if (e.rangeSelectorButton.type === "week") {
  this.update(
    {
      tickInterval: 7 * 24 * 3600 * 1000,
      minorTickInterval: 7 * 24 * 3600 * 1000
    },
    false
  );
}
if (e.rangeSelectorButton.text === "Qtr") {
  this.update(
    {
      tickInterval: 4 * 30 * 24 * 3600 * 1000,
      minorTickInterval: 4 * 30 * 24 * 3600 * 1000
    },
    false
  );
}
if (e.rangeSelectorButton.text === "Day") {
  this.update(
    {
      tickInterval: 24 * 3600 * 1000,
      minorTickInterval: 24 * 3600 * 1000
    },
    false
  );
}

你怎么回事啊?看起来你已经有答案了。嗨@Sravan,你能更准确地描述一下这个问题吗?此外,一些实时示例将非常有用。点击时数按钮,x轴标签上的时间序列将仅为小时{[1h,2h,3h等]},与点击日按钮相同,x轴标签将仅为天数序列[1d,2d,3d,],需要显示,如周,月,qtr和年,所有按钮点击x轴格式将基于按钮点击进行更改。Hi@Sravan,很抱歉反应太晚。看起来您只需要设置
范围选择器。按钮
请检查此示例:如果有任何进一步的问题,请毫不犹豫地询问。