小编Not*_*nez的帖子

如何在Highchart中自定义工具提示?

我希望我的工具提示根据x轴显示时间范围。
下图显示了我想要的。因此,如果有人知道我该怎么做,请让我知道或建议我。谢谢 :)

在此处输入图片说明

这是我的代码

Highcharts.chart('container', {
    chart: {
        type: 'areaspline'
    },
    title: {
        text: '<b>Power consumption</b>'
    },
    xAxis: {
      categories: [
                    '00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00',
                    '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00',
                    '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00',
                    '21:00', '22:00', '23:00'
                  ]
      },
    yAxis: {
        title: {
            text: 'Power (watt)'
        }
    },
    tooltip: {
      borderColor: '#2c3e50',
      shared: true
    },
    plotOptions: {
        areaspline: {
            marker: {
                enabled: true,
                symbol: 'circle',
                radius: 3,
                states: {
                    hover: {
                        enabled: …
Run Code Online (Sandbox Code Playgroud)

javascript jquery highcharts

5
推荐指数
1
解决办法
3670
查看次数

如何获得前一年的月份?

我试着根据当月来得到上个月.但问题发生在"年"不是2017年.

在此输入图像描述

那我怎么能得到上一年的月份?下面的代码将描述我想要的内容,如果有人知道如何获取它,请告诉我方法.谢谢 :)

var month = new Array();
		month[0] = "January";
		month[1] = "February";
		month[2] = "March";
		month[3] = "April";
		month[4] = "May";
		month[5] = "June";
		month[6] = "July";
		month[7] = "August";
		month[8] = "September";
		month[9] = "October";
		month[10] = "November";
		month[11] = "December";

		var cur_month = new Date();
		var cur_month_now = month[cur_month.getMonth()];
		var pre_month_1 = month[cur_month.getMonth()-1];
		var pre_month_2 = month[cur_month.getMonth()-2];
		var pre_month_3 = month[cur_month.getMonth()-3];
		var pre_month_4 = month[cur_month.getMonth()-4];
		var pre_month_5 = month[cur_month.getMonth()-5];

		document.getElementById("cur_month").innerHTML = cur_month_now;
		document.getElementById("pre_month_1").innerHTML = …
Run Code Online (Sandbox Code Playgroud)

html javascript

4
推荐指数
1
解决办法
87
查看次数

标签 统计

javascript ×2

highcharts ×1

html ×1

jquery ×1