Search code examples
javascriptvuejs3lightningchart

LightningChart js getting error on adding Y-axis


                 var dx = chart
                    .addAxisX()
                     .setAnimationZoom(undefined)
                    .setStrokeStyle(emptyLine)
                    .setTitleFillStyle(new SolidFill({ color: ColorHEX("#000") }));  

          var yAxis = chart.getDefaultAxisY()
            .setTitle(yAxisTitle)
            .setAnimationZoom(undefined)
            .setTitleFillStyle(new SolidFill({ color: ColorHEX("#000") }))

         var series = chart.addPointSeries({ pointShape: seriesShape[tpGroupedData], xAxis: dx , yAxis: yAxis.value}).setPointFillStyle(new SolidFill({ color: ColorHEX(Palette[seriesColor[tpGroupedData]) })).setName(groupTag.slice(0, groupTag.indexOf('(')) + '( ' + tpName + ' )');```

I am using Vue3 for creating chart and adding multiple x axis.When I try to add yaxis while adding point series, I get the following error : @arction_lcjs.js?v=665003cc:24189 Uncaught (in promise) Error: No attach handler for axis Make sure that passed axes definitely belong to this chart and that they haven't been disposed of.

Looking for solution so as to know what might be causing it.


Solution

  • I'm not very familiar with Vue, but this strikes my eye:

    xAxis: dx , yAxis: yAxis.value
    

    In the code the variables dx and yAxis are assigned more or less in same manner (addAxisX(), getDefaultAxisY()), how come one of them is used as is, and the other one with .value?

    I would debug the application to see what you are passing as series xAxis, and yAxis values.