javascript - 从 highcharts 中删除周末

标签 javascript c# charts highcharts

是否可以删除 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/

相关文章:

c# - 如何自动更改 Silverlight 文本框中的文本?

c# - 如何使用具有 "greedy"构造函数的 Scan 将 StructureMap 与通用未封闭类型一起使用

javascript - Google Charts - 向彩色柱形图添加工具提示

javascript - 添加到数组中

c# - ASP.NET Core 验证客户端(控制台/WPF)

android - 如果饼图中的值为 0%,如何删除线条

javascript - d3 折线图字符串作为 x 轴域

javascript - 如何使用 Parsley JS 验证文件输入?

javascript - 检查 CSS 和 JS 文件文件夹的工具

javascript - 如何使用javascript将文本转换为二进制