I have this object 'cp'. and it has got some properties like labels and arcSettings in it. Whenever i initialize this object and call the method 'graph()' it says
Uncaught TypeError: Cannot read property '0' of undefined
Am I doing something wrong?
function cp() {
this.labels = [{
"pointThickness": 0.8,
"distance": 8,
"textDistance": 7,
"strokeColor": "#888",
"strokeWidth": 0.5,
"textColor": "#777",
"pointColor": "#888",
"textSize": 4,
//"interval":100,
//"precision":2,
"num": 10,
"startValue": 0,
"endValue": 300
}
];
this.arcSettings = [
{
"totalArcAngle":300,
"startAngle":(-this.totalArcAngle/2),
"endAngle":(this.totalArcAngle/2),
"progressValue":200,
"radius":150,
"thickness":30,
"displayValue":this.progressValue
}
];
}
cp.prototype.getOneUnit = function () {
return oneUnit = (this.arcSettings[0].totalArcAngle) / (this.label[0].endValue - this.label[0].startValue);
}
cp.prototype.graph= function(){
var oneUnit = this.getOneUnit();
}
var cp = new cp();
cp.graph();