简体   繁体   English

从Highstock图表工具提示中删除日期名称

[英]Remove day name from highstock chart tooltip

How can i remove day name from the tooltip (highlighted in red) in high-stock chart. 如何从高库存图表的工具提示中删除日期名称(以红色突出显示)。

在此处输入图片说明

You can change the standard dateTimeFormat for the day* label this chart uses. 您可以更改此图表使用的日期*标签的标准dateTimeFormat

* It might be you need to change something else as day , depending on your chart content. *可能是您需要更改其他day ,具体取决于图表内容。 See the dateTimeLabel API for all possibilities you can change. 有关可以更改的所有可能性,请参见dateTimeLabel API。

 tooltip: {
            dateTimeLabelFormats: {
                day: '%b %e, %Y'
            }
        },

This changes the format to Mar 01, 2000 , for example. 例如,这会将格式更改为Mar 01, 2000 If you want a different time format you can check out the PHP strftime which Highcharts uses for their formatting as stated in their dateFormat API 如果您希望使用其他时间格式,则可以按照Highcharts的dateFormat API中所述的格式检查PHP strftime

Here you can find a working JSFiddle 在这里,您可以找到一个有效的JSFiddle

I guess you can achieve this by editing your tooltip format during the declaration. 我想您可以通过在声明期间编辑工具提示格式来实现此目的。

example of tooltip configuration 工具提示配置示例

 tooltip: {
        formatter: function() {
            return  '<b>' + this.series.name +'</b><br/>' +
                Highcharts.dateFormat('%e %b %Y',
                                      new Date(this.x))
            + ' date, ' + this.y;
        }
    },

You can also customize your X axis tooltip by using this doc : 您还可以使用以下文档来自定义X轴工具提示:

https://api.highcharts.com/highcharts/plotOptions.series.tooltip https://api.highcharts.com/highcharts/plotOptions.series.tooltip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM