maxCandlesticks){
// change graph type
g0.type = "line";
g0.setStyle("fillAlphas", [0]);
// disable radio buttons
rb1.enabled = false;
rb2.enabled = false;
}
else{
// change graph type
g0.type = graphType;
g0.setStyle("fillAlphas", [1]);
// enable radio buttons
rb1.enabled = true;
rb2.enabled = true;
}
}
// this function is called when user changes type by clicking on radio buttons
private function setType():void{
if(rb1.selected){
graphType = "candlestick";
}
else{
graphType = "ohlc";
}
// only change type if selected number of data points is less then maxCandlesticks
if(chart.endIndex - chart.startIndex < maxCandlesticks){
g0.type = graphType;
}
}
private function zoom():void{
chart.zoomToIndexes(chartData.length - 20, chartData.length - 1);
}
private function toggleRecalculate():void
{
if(cb.selected)
{
v1.recalculateToPercents = true;
g0.balloonText = "[[percents.close]]%";
}
else
{
v1.recalculateToPercents = false;
g0.balloonText = "[[close]]";
}
}
]]>