Home forums Using CanvasJS What can cause axisX and axisY to be undefined?

This topic contains 1 reply, has 2 voices, and was last updated by  Indranil Deo 2 weeks, 2 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17248

    ayy
    Member

    I haven’t looked at my canvasjs project for over a month or so, and last time I touched it it was working fine.

    I access the axis objects like so: chart.axisY[0]. My chart is not undefined and when I log the chart object and I can see that the axis objects are being set correctly. I was wondering what can cause the axis to be undefined?

    Here is how I set the y axis

    ` axisY:
    {
    title: “Curve Data”,
    lineThickness: 2,
    lineColor: “black”,
    gridColor: “#f1f0ed”,
    tickLength: 0,
    labelFormatter: function(e)
    {
    return “”;
    }
    }, `

    and here is where is try to access axisY

    `for(var i = chart.axisY[0].get(“minimum”); i < chart.axisY[0].get(“maximum”); i+=chart.axisY[0].get(“interval”))
    {
    chart.axisY[0].addTo(“stripLines”,
    {
    value: i, color: “transparent”, label: i, showOnTop: true, labelAlign: “near”, labelFontColor: “black”
    })
    }`

    #17253

    Indranil Deo
    Member

    @ayy,

    Kindly make sure that chart is rendered before get method is used.

    If the issue still persists, can you kindly create a jsfiddlereproducing the same so that we can understand your requirements better and help you out.

    _________
    Indranil Deo,
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.