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();
—————————————————————————————————-