Home forums Using CanvasJS Getting the Plot Area from CanvasJS

This topic contains 1 reply, has 2 voices, and was last updated by  Sunil Urs 3 years, 7 months ago.

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

    Jit
    Participant

    Hi pple,

    I really like CanvasJS and i am also using it as part of my project. I am a novice in JavaScript programming and will need some help here is getting the function :  getPlotArea() from CanvasJS to my Main JavaScript. Below is what i attempted but failed.

    Basically i added a function to the Chart region Public API called getCustomPlotArea. 

    My Main Script tries to call that function but it always return “undefined”. 

    May i know what am i missing ? Please help. Thanks Thanks in advance !!

    —————————————————————————————————

    #region Public API

    var CanvasJS = {

    Chart: function (containerId, options,value) {

    var _chart = new Chart(containerId, options, this);

    this.render = function () { _chart.render() };

    this.options = _chart._options;

        this.getCustomPlotArea = function(){_chart.getCustomPlotArea()};

    },

    addColorSet: function (name, colorSet) {

    colorSets[name] = colorSet;

    }

    }

    —————————————————————————————————

    Chart.prototype.getCustomPlotArea = function (){

    var plotArea = this.getPlotArea();

    return plotArea;

    }

    —————————————————————————————————

    Main Script:

    var chart = new CanvasJS.Chart(“chartContainer”,{….. }

    var tmpPlot;

    tmpPlot = chart.getCustomPlotArea();

    —————————————————————————————————-

    #4313

    Sunil Urs
    Keymaster

    Jit,

    We have not exposed the function getPlotArea and that is the reason why you are not able to call it. As of now you can only use the APIs mentioned in our documentation. May I know why you need this method?…

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

You must be logged in to reply to this topic.