[英]how to format flot char yaxis by value seconds in highcharts?
I'm working with highcharts char. 我正在使用highcharts char。 I need to show the yaxis labels H:i:s time format(for ex. yaxis - 00:00:00, 00:05:00, 00:10:00 and etc.). 我需要显示yaxis标签H:i:s时间格式(例如yaxis-00:00:00、00:05:00、00:10:00等)。
Here is my code (full code in this fiddle ): 这是我的代码(此小提琴中的完整代码):
LiveFeeds = {
init: function(tab)
{
var tab = tab || '#calling-intensity';
$(tab+'-chart').highcharts({
chart: {
zoomType: 'x'
},
title: {
text: ''
},
xAxis: {
type: 'datetime'
},
yAxis: {
min: 0,minRange: 0.1,
title: {
text: chartYaxis
}
},
legend: {
enabled: false
},
plotOptions: {
area: {
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get('rgba')]
]
},
marker: {
radius: 2
},
lineWidth: 1,
states: {
hover: {
lineWidth: 1
}
},
threshold: null
}
},
tooltip: tooltipData,
series: seriesData
});
}
};
This is a example but on Flot chart https://jsfiddle.net/p41d165j/14/ . 这是一个示例,但在Flot图表https://jsfiddle.net/p41d165j/14/上 。
To change date format of labels you could use dateTimeLabelFormats
like: 要更改标签的日期格式,可以使用dateTimeLabelFormats
例如:
dateTimeLabelFormats: {
millisecond: '%H:%M:%S',
second: '%H:%M:%S',
minute: '%H:%M:%S',
hour: '%H:%M:%S',
day: '%H:%M:%S',
week: '%H:%M:%S',
month: '%H:%M:%S',
year: '%H:%M:%S'
},
Example: https://jsfiddle.net/hzjbb848/10/ 示例: https : //jsfiddle.net/hzjbb848/10/
Axis by default will display labels for each day, because of axis range, but if you zoom in - you will see hours. 由于轴范围,默认情况下,轴默认会显示每天的标签,但是如果放大,则会看到小时数。
You could consider using different format for day
or use tickPositioner
to set ticks not on days. 您可以考虑为day
使用不同的格式,或者使用tickPositioner
设置不在日期上的刻度。
To fully control what is displayed in axis labels set up formatter
function. 要完全控制轴标签中显示的内容,请设置formatter
功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.