Search code examples
lightningchart

Bug found in ChartXY when setting axis to not visible


I've noticed quite a strange behaviour on LightningChart JS ChartXY if axis x visibility is set to false.

axisX.setVisible(false)

I'm combining ZoomBandChart with multiple ChartXY's. I just want the axisX to be displayed in the ZoomBandChart, so I'm setting the charts axisX visibility to false. However, if I zoom in, data is displayed outside the charts (in both cases, horizontally and vertically).

I assume it is a bug, although it may also be a coding error.

I'm attaching a screenshot. screenshot


Solution

  • I've found the solution.

    Instead of...

    axisX.setVisible(false)

    I've modified the axis TickStrategy to hide it.

    axisX
        .setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks
          .setMajorTickStyle((tickStyle) => tickStyle
            .setLabelFont(new FontSettings({ size: 0 }))
            .setTickLength(0)
            .setTickPadding(2)
          )
          .setMinorTickStyle((tickStyle) => tickStyle
            .setLabelFont(new FontSettings({ size: 0 }))
            .setTickLength(0)
            .setTickPadding(2)
          )
        )