gpt4 book ai didi

javascript - 从 highcharts 中删除周末

转载 作者:行者123 更新时间:2023-11-29 23:17:11 25 4
gpt4 key购买 nike

是否可以删除 highcharts 中的某些日期?我有一个图表,它只获取周一到周五的数据间隔。问题是周六和周日会自动添加到图表中,即使这些天没有数据也是如此。我找不到任何对 api.highcharts.com 有帮助的东西他们通常对所有与图形相关的问题都有解决方案,但我似乎找不到关于我的问题的任何信息。这可能是图表中的一些简单选项,但我找不到任何有效的方法。 enter image description here

最佳答案

您有两个选择,使用 highcharts 和 breaks .

An array defining breaks in the axis, the sections defined will be left out and all the points shifted closer to each other. Requires that the broken-axis.js module is loaded.

在日期时间轴上看起来像这样:

xAxis: {
tickInterval: 1,
breaks: [{
from: 1537567200000,
to: 1537740000000,
breakSize: 1
}]
}

工作示例: http://jsfiddle.net/ewolden/L3ykegzq/

或者切换到 highstock,在那里你可以获得 ordinal轴(默认使用序号):

In an ordinal axis, the points are equally spaced in the chart regardless of the actual time or x distance between them. This means that missing data periods (e.g. nights or weekends for a stock chart) will not take up space in the chart. Having ordinal: false will show any gaps created by the gapSize setting proportionate to their duration.

工作示例: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/stock/xaxis/ordinal-true/

关于javascript - 从 highcharts 中删除周末,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52362879/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com