Highcharts -在对数轴上缩放的线性序列

v6ylcynt  于 2022-11-10  发布在  Highcharts
关注(0)|答案(1)|浏览(183)

我在放大对数y轴上的线性数列时遇到问题。有什么简单的解决方法?
缩小:

放大:

线性系列未正确重新缩放,这些系列应保持在相对于主系列的相同位置,这些系列是否缺少任何配置,以将其调整到对数轴?
演示:https://jsfiddle.net/bernardo0marques/dfqouLm5/30/
程式码片段:

Highcharts.stockChart("container", {
  chart: {
    type: "line",
    zoomType: "xy",
  },
  series: [
    {
      data: [
        {
          x: -220924800000,
          high: 63,
          low: 56,
          close: 62,
          open: 56,
          name: "01/01/1963",
          color: "#F57350",
        },
        {
          x: 1657670400000,
          high: 18893.92,
          low: 18159.03,
          close: 18159.03,
          open: 18593.15,
          name: "13/07/2022",
          color: "#297F0D",
        },
      ],
      dataGrouping: {
        forced: true,
        groupPixelWidth: 0,
        units: [["day", 1]],
      },
      id: "main-series",
      name: "Demo series",
      type: "candlestick",
      yAxis: "default",
    },
    {
      color: "#C0C0C0",
      data: [
        [-220914000000, 369],
        [1659236400000, 198817.91340815497],
      ],
      dashStyle: "LongDash",
      id: "upper-tendency",
      tooltip: {
        valueDecimals: 0,
        xDateFormat: "%B %Y",
      },
      showInLegend: false,
      yAxis: "default",
    },
    {
      color: "#C0C0C0",
      data: [
        [-220914000000, 34],
        [1659236400000, 16672.03531810569],
      ],
      dashStyle: "Solid",
      id: "lower-tendency",
      tooltip: {
        valueDecimals: 0,
        xDateFormat: "%B %Y",
      },
      showInLegend: false,
      yAxis: "default",
    },
  ],
  title: { text: "Logarithmic Zoom: Linear series" },
  tooltip: { shared: true, split: false },
  xAxis: {
    dateTimeLabelFormats: {
      second: "%d/%m/%y<br/>%H:%M:%S",
      minute: "%d/%m/%y<br/>%H:%M",
      hour: "%d/%m/%y<br/>%H:%M",
      day: "%d/%m/%y",
      month: "%m/%y",
      year: "%Y",
    },
    type: "datetime",
  },
  yAxis: [
    {
      id: "default",
      opposite: true,
      type: "logarithmic",
      title: { text: "" },
      reversed: false,
      offset: 50,
      tickInterval: 0.4,
    },
  ],
});
7cwmlq89

7cwmlq891#

这是一个错误,您可以在以下票证中跟踪:https://github.com/highcharts/highcharts/issues/16784
作为一种临时解决方法,您可以在配置中将xAxis.ordinal设置为false

演示:https://jsfiddle.net/BlackLabel/rfxygz5m/

相关问题